Commit 5fbfa3f0 authored by “yiyousong”'s avatar “yiyousong”
parents ae42d7ac 26edbee0
......@@ -255,32 +255,23 @@ export default {
// 获取数据列表
async getDatasetList() {
this.loading = true;
let orConditionList = [
{
fieldCode: this.fieldCode,
fieldValue: `%${this.searchVal}%`,
},
...this.sortSearch,
];
let res = await getDatasetList({
let obj = {};
let orConditionList = [];
let form = {
page: this.current,
size: this.size,
appId: this.appId,
orConditionList,
// fieldCode: this.fieldCode,
// fieldValue: `%${this.searchVal}%`,
// orConditionList: [
// {
// fieldCode: this.fieldCode,
// fieldValue: `%${this.searchVal}%`,
// },
// {
// fieldCode: "top",
// fieldValue: `%%`,
// },
// ],
});
};
if (this.fieldCode) {
obj.fieldCode = this.fieldCode;
obj.fieldValue = `%${this.searchVal}%`;
orConditionList.push(obj);
}
orConditionList = [...orConditionList, ...this.sortSearch];
if (orConditionList.length) {
form.orConditionList = orConditionList;
}
let res = await getDatasetList(form);
this.loading = false;
if (res.data.code === 1) {
let { data, total } = res.data.data;
......
......@@ -14,11 +14,6 @@
v-model="searchForm.name"
allowClear
/>
<a-input
placeholder="请输入二级组织搜索"
v-model="searchForm.secondOrganize"
allowClear
/>
<a-button type="primary" @click="onSearch">搜索</a-button>
<a-button @click="resetSearch">重置</a-button>
</a-space>
......@@ -185,7 +180,6 @@ export default {
searchValue: "", // 搜索
searchForm: {
name: "",
secondOrganize: "",
},
tableData: [],
selectedRowKeys: [],
......@@ -205,7 +199,6 @@ export default {
page: this.current,
size: this.size,
name: `%${this.searchForm.name}%`,
secondOrganize: `%${this.searchForm.secondOrganize}%`,
});
this.loading = false;
if (res.data.code == 1) {
......
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>release</id>
<formats>
<format>tar.gz</format>
</formats>
<!-- 需要打包的文件集 -->
<fileSets>
<fileSet>
<directory>${project.parent.basedir}/base-manager-ui/admin/dist</directory>
<includes>
<include>**/*</include>
</includes>
<outputDirectory>/dist</outputDirectory>
</fileSet>
</fileSets>
</assembly>
\ No newline at end of file
......@@ -22,8 +22,6 @@
<directory>./db</directory>
<includes>
<include>*.sql</include>
<include>service.exe</include>
<include>service.xml</include>
</includes>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
......
......@@ -253,3 +253,17 @@ INSERT INTO mortals_xhx_task VALUES (null, '同步全部站点事项材料附件
-- 2024-07-20
-- ----------------------------
INSERT INTO `mortals_sys_base_area`(`id`, `ancestors`, `name`, `iid`, `pid`, `haveSonArea`, `haveSonDept`, `haveGetDept`, `haveGetMatterList`, `areaCode`, `areaLevel`, `shortName`, `domain`, `status`, `createTime`, `createUserId`, `updateTime`) VALUES (null, '', '巴中经济开发区', 'f190133f82dd46f0ae2e2116a8b9b13b', '60a505e9dfa643e9826902e0810de55f', 'false', 'True', 'false', 'false', '511971000000', 3, '巴中经济开发区', 'bzsbzq.sczwfw.gov.cn', 1, '2021-07-19 11:59:30', NULL, NULL);
-- ----------------------------
-- 2024-11-20 索引添加
-- ----------------------------
CREATE INDEX idx_matterId ON mortals_sys_matter_accept (matterId);
CREATE INDEX idx_matterId ON mortals_sys_matter_datum (matterId);
CREATE INDEX idx_matterId ON mortals_sys_matter_charges (matterId);
CREATE INDEX idx_matterId ON mortals_sys_matter_flowlimit (matterId);
CREATE INDEX idx_matterId ON mortals_sys_matter_intermediary (matterId);
CREATE INDEX idx_matterId ON mortals_sys_matter_question (matterId);
CREATE INDEX idx_matterId ON mortals_sys_matter_setbase (matterId);
CREATE INDEX idx_datumId ON mortals_sys_matter_datum_file (datumId);
\ No newline at end of file
This diff is collapsed.
......@@ -24,6 +24,10 @@
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.req.json.check>false</profiles.req.json.check>
<profiles.trustedReferer></profiles.trustedReferer>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
<profiles>
......@@ -44,10 +48,9 @@
<properties>
<profiles.active>test</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5513</profiles.server.debug>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<package.environment>test</package.environment>
<skipUi>true</skipUi>
<profiles.req.json.check>false</profiles.req.json.check>
<profiles.trustedReferer>192.168.0.98,localhost</profiles.trustedReferer>
</properties>
</profile>
......@@ -55,9 +58,8 @@
<id>product</id>
<properties>
<profiles.active>product</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5513</profiles.server.debug>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -67,7 +69,6 @@
<profiles.active>yibin</profiles.active>
<profiles.nacos.server-addr>172.15.28.120:8848</profiles.nacos.server-addr>
<package.environment>yibin</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -77,7 +78,6 @@
<profiles.active>regtest</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -86,7 +86,6 @@
<properties>
<profiles.active>qiling</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -95,8 +94,6 @@
<properties>
<profiles.active>reg</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -105,8 +102,6 @@
<properties>
<profiles.active>yanyuan</profiles.active>
<profiles.nacos.server-addr>172.16.30.245:8848</profiles.nacos.server-addr>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -115,8 +110,6 @@
<properties>
<profiles.active>pengxi</profiles.active>
<profiles.nacos.server-addr>192.168.106.6:8848</profiles.nacos.server-addr>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -125,8 +118,6 @@
<properties>
<profiles.active>bzjkq</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -323,51 +314,9 @@
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<skip>${skipUi}</skip>
</configuration>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument></argument>
</arguments>
<workingDirectory>${project.parent.basedir}/base-manager-ui/admin</workingDirectory>
</configuration>
</execution>
<execution>
<id>exec-npm-run-build</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>yarn</executable>
<arguments>
<argument>run</argument>
<arguments>${package.environment}</arguments>
</arguments>
<workingDirectory>${project.parent.basedir}/base-manager-ui/admin</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>make-assembly</id>
......@@ -384,22 +333,6 @@
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
<execution>
<id>make-assembly-ui</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<skipAssembly>${skipUi}</skipAssembly>
<finalName>${project.artifactId}-ui</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>./assembly/assembly-manager-ui.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}/dist/${project.artifactId}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
......
#!/bin/sh
RETVAL=$?
SHELL_NAME="deploy"
BASEDIR=$(dirname $0)
BASEDIR=$( (
cd "$BASEDIR"
pwd
))
LOCK_FILE="/tmp/deploy.lock"
# 时间变量
CDATE=$(date "+%Y-%m-%d")
CTIME=$(date "+%H:%M:%S")
SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
JAVA_HOME="/usr/local/java/jdk1.8"
SERVICE_PATH="/usr/lib/systemd/system"
PUBLISH_PATH="/home/publish"
PROJECT_NAME="@project.artifactId@"
PROJECT_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}"
PROJECT_FILENAME="${PROJECT_NAME}.tar.gz"
PROJECT_SERVICE="${SERVICE_PATH}/${PROJECT_NAME}.service"
#写日志
writelog() {
LOGINFO=$1
echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
echo ${LOGINFO}
}
#清理目标
clear_deploy() {
SERVICE=$1
EXECPATH=$2
#清理后台自启服务
rm -f ${SERVICE}
#清理执行文件目录
}
build_service() {
SERVICE=$1
EXECPATH=$2
echo "" >${SERVICE}
echo "[Unit]" >>${SERVICE}
echo "Description=${PROJECT_NAME}" >>${SERVICE}
echo "After=network.target" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE}
echo "ExecStartPre=-/bin/sleep 5s" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Install]" >>${SERVICE}
echo "WantedBy=multi-user.target" >>${SERVICE}
writelog "${PROJECT_NAME}服务创建完成!"
}
#启动服务与nginx
start_service() {
systemctl enable ${PROJECT_NAME}
systemctl daemon-reload
writelog "${PROJECT_NAME}服务启动..."
systemctl stop ${PROJECT_NAME}&&systemctl start ${PROJECT_NAME}
project_status=$(systemctl status "${PROJECT_NAME}"|grep Active |awk '{print $2}')
jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
writelog "${PROJECT_NAME}服务启动,PID is ${jcpid} ,status:${project_status}"
}
#部署后台服务
project_deploy() {
writelog "${PROJECT_NAME}_deploy"
clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
writelog "${PROJECT_NAME}_clear_finish"
tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH}
build_service ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
start_service
writelog "${PROJECT_NAME}_deploy_finish"
}
#主函数
main() {
echo "后台服务部署"
project_deploy
exit ${RETVAL}
}
main $1
package com.mortals.xhx.base.framework.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mortals.xhx.base.framework.DateJacksonConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean;
......@@ -10,6 +12,10 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
@Configuration
public class ConverterConfig {
@Value("${jsonCheck:false}")
private Boolean jsonCheck;
@Bean
public DateJacksonConverter dateJacksonConverter() {
return new DateJacksonConverter();
......@@ -24,8 +30,14 @@ public class ConverterConfig {
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(ObjectMapper objectMapper) {
if(jsonCheck!=null&&jsonCheck){
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
}
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper);
return mappingJackson2HttpMessageConverter;
}
}
......@@ -11,7 +11,7 @@ import javax.servlet.http.HttpServletResponse;
* @date: 2022/6/6 15:05
* @description:添加跨域响应
**/
@Component
//@Component
public class CrossInterceptor extends HandlerInterceptorAdapter {
@Override
......
package com.mortals.xhx.base.framework.config;
import com.mortals.framework.filter.RepeatableFilter;
import com.mortals.framework.filter.XssFilter;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.framework.filter.RepeatReadHttpRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
......@@ -21,6 +21,7 @@ import java.util.Map;
* @author zxfei
*/
@Configuration
@Slf4j
public class FilterConfig {
@Value("${xss.enabled}")
private String enabled;
......@@ -60,7 +61,6 @@ public class FilterConfig {
public static class RequestReplaceFilter implements Filter {
@Override
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
}
@Override
......
package com.mortals.xhx.base.framework.exception;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import javax.servlet.http.HttpServletResponse;
/**
* 统一异常处理
......@@ -17,6 +21,10 @@ import com.mortals.framework.exception.AppException;
@Slf4j
public class ExceptionHandle {
@Autowired
private HttpServletResponse response;
public static final String KEY_RESULT_CODE = "code";
public static final String KEY_RESULT_MSG = "msg";
public static final String KEY_RESULT_DATA = "data";
......@@ -33,9 +41,14 @@ public class ExceptionHandle {
stack.getClassName(), stack.getMethodName(), stack.getLineNumber(), e.getClass().getName());
AppException ex = (AppException) e;
ret.put(KEY_RESULT_MSG, ex.getMessage());
} else if (e instanceof HttpMessageNotReadableException || e instanceof MethodArgumentTypeMismatchException) {
log.error("[system error]", e);
response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
ret.put(KEY_RESULT_MSG, "参数错误," + StrUtil.subBefore(e.getMessage(), ";", false));
} else {
log.error("[system error]", e);
ret.put(KEY_RESULT_MSG, "未知错误!");
response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
ret.put(KEY_RESULT_MSG, "未知错误!" + e.getMessage());
}
return ret.toJSONString();
}
......
package com.mortals.xhx.base.framework.filter;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.common.key.RedisKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.List;
@Slf4j
//@Component
//@Profile({"yanyuan", "test"})
public class SameSiteCookieFilter implements Filter {
@Autowired
private ICacheService cacheService;
@Value("${token.database:0}")
private Integer portalDb;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
String trustedReferer =redisTemplate.opsForValue().get(RedisKey.KEY_REFERERS_CACHE);
List<String> allowedOrigins = StrUtil.split(trustedReferer, ",");
// Set allowedOrigins= new HashSet(Arrays.asList(allowDomain));
String originHeader=((HttpServletRequest) request).getHeader("Origin");
if(!ObjectUtils.isEmpty(originHeader)){
URI host = URLUtil.getHost(new URL(originHeader));
String origin = host.getHost();
if (allowedOrigins.contains(origin)){
httpResponse.setHeader("Access-Control-Allow-Origin", originHeader);
httpResponse.setContentType("application/json;charset=UTF-8");
httpResponse.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
httpResponse.setHeader("Access-Control-Max-Age", "3600");
httpResponse.setHeader("Access-Control-Allow-Headers", "Content-Type,authorization,authtoken");
// 如果要把Cookie发到服务器,需要指定Access-Control-Allow-Credentials字段为true
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpResponse.setHeader("Access-Control-Expose-Headers", "*");
}
}
chain.doFilter(request, response);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
@Override
public void destroy() {}
}
package com.mortals.xhx.base.framework.interceptor;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpStatus;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.common.key.RedisKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.List;
import static com.mortals.xhx.common.key.ErrorCode.*;
......@@ -34,6 +47,11 @@ public class AuthUserInterceptor extends BaseInterceptor {
private InterceptorConfig config;
@Autowired
private IAuthTokenService authTokenService;
@Autowired
private ICacheService cacheService;
@Value("${token.database:0}")
private Integer portalDb;
@Override
public int getOrder() {
......@@ -43,7 +61,22 @@ public class AuthUserInterceptor extends BaseInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
//response.setContentType("application/json");
String referer = request.getHeader("Referer");
RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
String trustedReferer =redisTemplate.opsForValue().get(RedisKey.KEY_REFERERS_CACHE);
if (!ObjectUtils.isEmpty(referer)) {
//校验host即可
URI host = URLUtil.getHost(new URL(referer));
referer = host.getHost();
//referer = StrUtil.removeSuffix(referer, "/");
List<String> trustReferers = StrUtil.split(trustedReferer, ",");
if (!ObjectUtils.isEmpty(trustReferers)) {
if (!trustReferers.contains(referer)) {
response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
return false;
}
}
}
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
......@@ -64,7 +97,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (!auth) {
//校验token不正常
String token = authTokenService.getToken(request);
if(ObjectUtils.isEmpty(token)){
if (ObjectUtils.isEmpty(token)) {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_UNAUTHORIZED, ERROR_TOKEN_UNAUTHORIZED_CONTENT)));
return false;
}
......@@ -106,4 +139,10 @@ public class AuthUserInterceptor extends BaseInterceptor {
}
public static void main(String[] args) throws MalformedURLException {
String url="http://192.168.0.1:9989";
URI host = URLUtil.getHost(new URL(url));
System.out.println(host.getHost());
}
}
......@@ -62,24 +62,5 @@ public class OperLogController extends BaseCRUDJsonBodyMappingController<OperLog
});
}
/* @Override
protected void init(HttpServletRequest request, HttpServletResponse response, OperLogForm form,
Map<String, Object> model, Context context) {
Map<String, Object> status = new HashMap<String, Object>(1);
// 返回日志类型
status.put("operType", OperTypeEnum.getEnumMap());
model.put(KEY_RESULT_DICT, status);
super.init(request, response, form, model, context);
}
@Override
protected void doListBefore(HttpServletRequest request, HttpServletResponse response, OperLogForm form, Map<String, Object> model, Context context) throws AppException {
form.getQuery().setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.logDate", "desc"));
}
});
}*/
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.code.PageDisplayType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.FileUtil;
......@@ -21,6 +22,7 @@ import com.mortals.xhx.common.code.ModStatusEnum;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -48,6 +50,16 @@ public class ParamController extends BaseCRUDJsonBodyMappingController<ParamServ
model.put(KEY_RESULT_DICT, status);
}
/**
* @param query
* @param list
* @param context
* @throws AppException
*/
@Override
protected void doListAfter(ParamEntity query, List<ParamEntity> list, Context context) throws AppException {
super.doListAfter(query, list, context);
}
@RequestMapping(method = {RequestMethod.GET, RequestMethod.POST}, value = "key")
@UnAuth
......
......@@ -395,23 +395,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
siteService.updateAllSiteTree(null);
/* //单独更新全站点
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(0L);
Context contextTemp = new Context();
contextTemp.setUser(userEntity);
SyncTreeSiteThread syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(1L);
contextTemp = new Context();
contextTemp.setUser(userEntity);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
*/
}
......@@ -429,7 +412,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
List<UserEntity> newUserList = userPduList.stream().map(newUser -> {
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
BeanUtils.copyProperties(newUser, userEntity, new String[]{ "lastLoginTime", "lastLoginAddress"});
BeanUtils.copyProperties(newUser, userEntity, new String[]{"lastLoginTime", "lastLoginAddress"});
return userEntity;
}).collect(Collectors.toList());
......@@ -497,7 +480,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
System.out.println(SecurityUtil.md5DoubleEncoding("xhxADMIN8@a"));
System.out.println(SecurityUtil.md5DoubleEncoding("123"));
// System.out.println(SecurityUtil.md5DoubleEncoding("123"));
// System.out.println(SecurityUtil.md5DoubleEncoding("Qt123456@"));
/*
......
......@@ -38,4 +38,10 @@ public class RedisKey {
*/
public static final Long KEY_SEARCH_TIMEOUTT_CACHE = 3600L;
/**
* referers
*/
public static final String KEY_REFERERS_CACHE = "referers";
}
......@@ -20,8 +20,8 @@ public class AreaMatchCodeUtil {
if (AreaLevelEnum.地市州.getValue() == areaLevel) {
matchCode=StrUtil.sub(matchCode, 0, 3);
return StrUtil.padAfter(matchCode, 3, "0");
matchCode=StrUtil.sub(matchCode, 0, 4);
return StrUtil.padAfter(matchCode, 4, "0");
} else if (AreaLevelEnum.区县.getValue() == areaLevel) {
//510921174000
matchCode=StrUtil.sub(matchCode, 0, 6);
......
......@@ -81,10 +81,28 @@ public class MatterDetailHtmlParseUtil {
String blankSampleExp = "//div[@id=\"zhezhao\"]//div[@class='zhezhao4']";
String sampleExp = "//div[@id=\"zhezhao\"]//div[@class='zhezhao2']";
String baseInfoExp = "//div[@id=\"zhezhao\"]//div[@class='zhezhao3']";
String baseInfoTableNameExp = "//*[@id=\"material\"]//tr//td[2]/span[1]";
// String baseInfoTableNameExp = "//*[@id=\"material\"]//tr/td[2]/span[1]";
String baseInfoTableMustExp = "//*[@id=\"material\"]//tr/td[3]/span[1]";
try {
Elements baseInfoTableNameElements = dom.selectXpath(baseInfoTableNameExp);
Elements baseInfoTableMustElements = dom.selectXpath(baseInfoTableMustExp);
int size = baseInfoTableNameElements.size();
int size1 = baseInfoTableMustElements.size();
Map<String, String> nameMustMap = new HashMap<>();
if (size == size1) {
for (int i = 0; i < size; i++) {
Element element = baseInfoTableNameElements.get(i);
Element element1 = baseInfoTableMustElements.get(i);
if (!ObjectUtils.isEmpty(element)&&!ObjectUtils.isEmpty(element1)) {
nameMustMap.put(element.text(), element1.text());
}
}
}
Elements elements = dom.selectXpath(blankSampleExp);
int rowNum = elements.size();
for (int i = 1; i <= rowNum; i++) {
HashMap<String, Object> map = new HashMap<>();
List<MatterDatumFileEntity> datumFileEntities = new ArrayList<>();
......@@ -111,20 +129,8 @@ public class MatterDetailHtmlParseUtil {
List<String> allGroup = ReUtil.findAllGroup1("'(.*?)'", onclickStr);
if (!ObjectUtils.isEmpty(allGroup)) {
/* String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + allGroup.get(0);
String resp = HttpUtil.get(encryUrl);
JSONObject obj = JSON.parseObject(resp);
String code = obj.getString("code");
String data = obj.getString("data");
if ("0".equals(code)) {
fileEntity.setFileUrl(data);
fileEntity.setLocalFileUrl(data);
}*/
fileEntity.setFileUrl(allGroup.get(0));
}
// fileEntity.setFileUrl(node.firstChild().attr("href").trim());
datumFileEntities.add(fileEntity);
}
}
......@@ -151,25 +157,13 @@ public class MatterDetailHtmlParseUtil {
List<String> allGroup = ReUtil.findAllGroup1("'(.*?)'", onclickStr);
if (!ObjectUtils.isEmpty(allGroup)) {
/* String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + allGroup.get(0);
String resp = HttpUtil.get(encryUrl);
JSONObject obj = JSON.parseObject(resp);
String code = obj.getString("code");
String data = obj.getString("data");
if ("0".equals(code)) {
fileEntity.setFileUrl(data);
fileEntity.setLocalFileUrl(data);
}*/
fileEntity.setFileUrl(allGroup.get(0));
}
// fileEntity.setFileUrl(node.firstChild().attr("href").trim());
datumSampleFileEntities.add(fileEntity);
}
map.put("sampleList", datumSampleFileEntities);
}
//查询基本信息
String tempxPath2 = baseInfoExp + String.format("[%d]//table//tr//td", i);
Elements baseinfoList = dom.selectXpath(tempxPath2);
......@@ -184,6 +178,11 @@ public class MatterDetailHtmlParseUtil {
baseInfoMap.put(prenode.text().trim(), node.text().trim());
}
}
String name = baseInfoMap.get("材料名称");
String must = nameMustMap.get(name);
if(!ObjectUtils.isEmpty(must)){
baseInfoMap.put("材料必要性", must);
}
map.put("baseinfo", baseInfoMap);
mapList.add(map);
}
......@@ -441,7 +440,8 @@ public class MatterDetailHtmlParseUtil {
// String url = "http://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&itemCode=511A0151400000-511500000000-000-511501-7-1-00&taskType=1&deptCode=511501-7";
// String url = "http://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&itemCode=511A0000400004-511500000000-000-1151120000870212XU-1-00&taskType=1&deptCode=3922757070285361152";
// String url = "http://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&itemCode=512036008003-511500000000-000-11511200MB1503849K-1-00&taskType=20&deptCode=3907787168696946688";
String url = "https://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&itemCode=511A0101600004-511500000000-000-11511200008702584B-1-00&taskType=1&deptCode=511501-7";
//String url = "https://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&itemCode=511A0101600004-511500000000-000-11511200008702584B-1-00&taskType=1&deptCode=511501-7";
String url = "http://www.sczwfw.gov.cn/jiq/front/transition/ywTransToDetail?areaCode=511500000000&itemCode=511A0358400001-511500000000-000-11511200MB1666138E-1-00&taskType=1&deptCode=11511200008702664Y";
Document dom = MatterDetailHtmlParseUtil.getDomByHtml(url);
Map<String, String> baseInfoMap = MatterDetailHtmlParseUtil.getbaseInfoMapByHtml(dom);
......
......@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import static com.mortals.xhx.common.key.Constant.USER_SITE_TREE;
......@@ -22,6 +23,8 @@ public class DemoStartedService implements IApplicationStartedService {
private ICacheService cacheService;
@Autowired
private SiteService siteService;
@Autowired
private UserService userService;
@Override
public void start() {
......@@ -29,7 +32,9 @@ public class DemoStartedService implements IApplicationStartedService {
log.info("开始服务..[初始化用户站点树]");
//删除redis 中的 站点树
cacheService.del(USER_SITE_TREE);
siteService.updateAllSiteTree(null);
//从门户获取所有站点用户
userService.refreshUser();
}
@Override
......
package com.mortals.xhx.daemon.task;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.module.matter.model.MatterDatumFileEntity;
import com.mortals.xhx.module.matter.model.MatterDatumFileQuery;
import com.mortals.xhx.module.matter.service.MatterDatumFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StopWatch;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ConnectException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.List;
import static com.mortals.xhx.common.key.Constant.MAX_RETRY_COUNT;
/**
* 同步全部站点事项材料附件
*
* @author: zxfei
* @date: 2024/2/27 15:34
*/
@Slf4j
//@Service("SyncMatterDaumFileTask")
public class SyncMatterDaumFileTaskImpl implements ITaskExcuteService {
@Autowired
private MatterDatumFileService matterDatumFileService;
@Autowired
private UploadService uploadService;
@Override
public void excuteTask(ITask task) throws AppException {
log.info("开始同步材料列表附件! 分页获取");
int total = matterDatumFileService.count(new MatterDatumFileQuery(), null);
int page = total / 1000 + 1;
StopWatch stopWatch = new StopWatch("watch daum file");
for (int i = 1; i <= page; i++) {
try {
stopWatch.start("同步附件");
PageInfo pageInfo = new PageInfo();
pageInfo.setCurrPage(i);
pageInfo.setPrePageResult(1000);
List<MatterDatumFileEntity> datumFileEntities = matterDatumFileService.find(new MatterDatumFileQuery(), pageInfo, null).getList();
List<MatterDatumFileEntity> updateList = new ArrayList<>();
for (MatterDatumFileEntity datumFileEntity : datumFileEntities) {
String localFileUrl = datumFileEntity.getLocalFileUrl();
if (ObjectUtils.isEmpty(localFileUrl) && !ObjectUtils.isEmpty(datumFileEntity.getFileUrl())) {
String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + datumFileEntity.getFileUrl();
// Thread.sleep(300);
String resp = HttpUtil.get(encryUrl, 60000);
JSONObject obj = JSON.parseObject(resp);
String code = obj.getString("code");
String data = obj.getString("data");
if ("0".equals(code)) {
//下载文件
int reCount = 0;
while (reCount < 3) {
try {
byte[] fileData = HttpUtil.downloadBytes(data);
InputStream inputStream = new ByteArrayInputStream(fileData);
MultipartFile file = ServletUtils.getMultipartFile(inputStream, datumFileEntity.getFileName());
String filePath = uploadService.saveFileUpload(file, "file/fileupload/daumfile", null);
if (!ObjectUtils.isEmpty(filePath)) {
datumFileEntity.setLocalFileUrl("/" + filePath);
MatterDatumFileEntity updateEntity = new MatterDatumFileEntity();
updateEntity.setId(datumFileEntity.getId());
updateEntity.setLocalFileUrl(datumFileEntity.getLocalFileUrl());
updateList.add(updateEntity);
}
break;
} catch (Exception e) {
log.error("下载附件异常,id:{},url:{}",datumFileEntity.getFileUrl(),data, e);
reCount++;
try {
Thread.sleep(2000);
} catch (InterruptedException ie) {
}
}
}
}
}
}
if (!ObjectUtils.isEmpty(updateList)) {
log.info("开始更新附件本地地址==》{}", updateList.size());
matterDatumFileService.update(updateList);
}
log.info("同步材料附件{}条完成,耗时:{}s", updateList.size(), stopWatch.getLastTaskTimeMillis() / 1000);
} catch (Exception e) {
log.error("同步材料附件异常", e);
}
stopWatch.stop();
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
public static void main(String[] args) {
int total = 1001;
int page = total / 1000;
System.out.println(page);
}
}
......@@ -36,54 +36,10 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired
private UserService userService;
@Autowired
private IUserFeign userFeign;
@Override
public void excuteTask(ITask task) throws AppException {
userService.refreshUser();
log.info("同步用户");
/* UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());*/
//resourceService.updateUserList();
/* UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
*//* List<UserPdu> firstList = list.getData().getData();
List<UserEntity> secondList = userService.find(new UserQuery());
//交叉对比后,多的新增 少的删除
List<UserEntity> diffList = secondList.parallelStream()
.filter(item -> !firstList.parallelStream().map(e -> e.getId()).collect(Collectors.toList()).contains(item.getId()))
.collect(Collectors.toList());*//*
//log.info("diffList:{}",JSON.toJSONString(diffList));
//更新本地用户信息,并且更新用户站点树
list.getData().getData().forEach(user -> {
//查询用户是否存在,
//UserEntity userEntity = userService.get(user.getId());
UserEntity userEntity =userService.selectOne(new UserQuery().loginName(user.getLoginName()));
if (ObjectUtils.isEmpty(userEntity)) {
//新增
UserEntity entity = new UserEntity();
entity.initAttrValue();
BeanUtils.copyProperties(user, entity, BeanUtil.getNullPropertyNames(user));
userService.save(entity);
Context context = new Context();
context.setUser(entity);
new Thread(new SyncTreeSiteThread(siteService, context)).start();
}
});*/
userService.refreshUser();
}
......
......@@ -13,5 +13,5 @@ import java.util.List;
public interface AppDao extends ICRUDDao<AppEntity,Long>{
String doSting();
}
......@@ -17,5 +17,12 @@ import java.util.List;
public class AppDaoImpl extends BaseCRUDDaoMybatis<AppEntity,Long> implements AppDao {
/**
* @return
*/
@Override
public String doSting() {
//todo
return null;
}
}
......@@ -23,10 +23,22 @@ public class AppVo extends BaseEntityLong {
* 站点列表
*/
private List<Long> siteIdList;
private Long siteIdStart
;
private Long siteIdEnd;
/**
*
*/
private List <Long> idList;
private Long idStart;
private Long idEnd;
private Long idIncrement;
/**
* 自主应用访问地址
*/
......
......@@ -33,4 +33,6 @@ public interface AppService extends ICRUDService<AppEntity, Long> {
AppDao getAppDao();
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.YesNoEnum;
......@@ -49,7 +50,7 @@ import static com.mortals.xhx.common.key.Constant.CUSTAPP_ROOT_PATH;
*/
@Service("appService")
@Slf4j
public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, Long> implements AppService {
public class AppServiceImpl extends AbstractCRUDCacheServiceImpl<AppDao, AppEntity, Long> implements AppService {
@Autowired
private UploadService uploadService;
......@@ -110,42 +111,8 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
} else {
item.setAppIconUrl(item.getAppIconPath());
}
};
super.findAfter(params, pageInfo, context, list);
}
private void sortAppByIdList(AppEntity params, List<AppEntity> list) {
if (!ObjectUtils.isEmpty(params.getIdList())) {
log.info("请求的排序id列表:{}", JSON.toJSONString(params.getIdList()));
try {
//去除idlist中不存在的
Set<Long> idSet = list.stream().map(item -> item.getId()).collect(Collectors.toSet());
List<Long> idList = params.getIdList();
Iterator<Long> ite = idList.iterator();
while (ite.hasNext()) {
Long next = ite.next();
if (!idSet.contains(next)) {
ite.remove();
}
}
//根据idList进行排序
for (int i = 0; i < idList.size(); i++) {
Long id = idList.get(i);
for (int j = 0; j < list.size(); j++) {
if (id.equals(list.get(j).getId())) {
//判断位置是否一直
if (i != j) {
//交换
Collections.swap(list, i, j);
}
}
}
}
} catch (Exception e) {
log.error("排序异常!", e);
}
}
super.findAfter(params, pageInfo, context, list);
}
private void checkDeviceBlackApp(AppEntity params, List<AppEntity> list) {
......@@ -452,7 +419,7 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
versionEntity.initAttrValue();
versionEntity.setAppId(entity.getId());
versionEntity.setAppName(entity.getAppName());
versionEntity.setVersion(++versionNum);
versionEntity.setVersion(versionNum);
versionEntity.setNotes(entity.getNotes());
versionEntity.setFileName(entity.getFileName());
versionEntity.setFilePath(entity.getFilePath());
......
package com.mortals.xhx.module.base.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.keys.RedisCacheKeys;
import com.mortals.xhx.common.utils.SyncGovMatterDetailThread;
import com.mortals.xhx.common.utils.SyncSubAreaThread;
......@@ -99,7 +101,13 @@ public class BaseAreaController extends BaseCRUDJsonBodyMappingController<BaseAr
if (!bool) {
throw new AppException("当前正在同步区域数据中,请勿重复提交!");
}
ThreadPool.getInstance().execute(new SyncSubAreaThread(this.service, baseAreaEntity, getContext()));
Rest<String> rest = this.service.genSubAreaByRootName(baseAreaEntity, getContext());
if(YesNoEnum.NO.getValue()==rest.getCode()){
throw new AppException("更新子区域失败,"+rest.getMsg());
}
// ThreadPool.getInstance().execute(new SyncSubAreaThread(this.service, baseAreaEntity, getContext()));
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "初始同步区域数据命令下发成功!");
......
......@@ -1108,6 +1108,9 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
Map<String, String> baseInfoMap = MatterDetailHtmlParseUtil.getbaseInfoMapByHtml(dom);
Integer matterEditionRemote = DataUtil.converStr2Int(baseInfoMap.getOrDefault("事项版本", "0"), 0);
//由于附件连接有效性,强制更新材料属性与附件地址
saveDatumInfo(matterEntity, context, dom, sqclInfoSetting);
if (matterEditionLocal >= matterEditionRemote) {
return Rest.fail("本地事项版本大于等于远端,不需要更新!");
}
......@@ -1118,8 +1121,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
matterEntity.setDeptName(extCache == null ? "" : extCache.getName());
//构建基础信息参数
savebaseInfo(matterEntity, baseInfoMap, baseInfoSetting);
//更新材料属性
saveDatumInfo(matterEntity, context, dom, sqclInfoSetting);
//更新受理条件
saveSltjInfo(matterEntity, context, dom);
//更新办理流程
......
......@@ -15,6 +15,7 @@ import java.util.List;
@Data
public class ModelVo extends BaseEntityLong {
private List <Long> idList;
private Long siteId;
/** 模块下包含的数据统计 */
private List<ModelCensusEntity> censusList;
......
......@@ -194,9 +194,9 @@ public class SiteEntity extends SiteVo {
this.districtCode = "";
this.siteIp = "";
this.siteIp = "127.0.0.1";
this.sitePort = "";
this.sitePort = "9980";
this.longitude = "";
......
......@@ -26,8 +26,12 @@ public class SiteVo extends BaseEntityLong {
private Integer areaLevel;
private List<Integer> areaLevelList;
private Integer total =0;
private List<SiteEntity> subList=new ArrayList<>();
private List<String> modelData;
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaTreeSelect;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.site.dao.SiteDao;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteQuery;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
......@@ -28,6 +29,9 @@ import java.util.Set;
*/
public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
SiteDao getDao();
/**
* 区域站点树
*
......@@ -69,4 +73,8 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
void deleteBysiteIdAndSource(Long siteId, Integer source, Context context);
void updateAllSiteTree(Context context);
void updateSiteInfo(SiteEntity siteEntity, Context context);
}
\ No newline at end of file
......@@ -8,15 +8,21 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.util.ThreadPool;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.code.AreaLevelEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.keys.RedisCacheKeys;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.SyncDeptThread;
import com.mortals.xhx.common.utils.SyncGovMatterDetailThread;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.service.AreaService;
......@@ -34,6 +40,7 @@ import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
......@@ -58,15 +65,12 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
@Autowired
private ICacheService cacheService;
@Autowired
private MatterService matterService;
@Autowired
private DeptService deptService;
@Autowired
private SiteService siteService;
@Autowired
private SiteMatterService siteMatterService;
@Autowired
private AreaService areaService;
@Autowired
@Lazy
private IUserFeign userFeign;
public SiteController() {
super.setModuleDesc("站点");
......@@ -536,4 +540,77 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
return jsonObject.toJSONString();
}
/**
* 外部站点添加
*/
@PostMapping(value = "api/add")
@UnAuth
public String apiAdd(@RequestBody SiteEntity siteEntity) {
JSONObject jsonObject = new JSONObject();
String busiDesc = "外部站点添加" + this.getModuleDesc();
try {
String areaCode = siteEntity.getAreaCode();
String siteName = siteEntity.getSiteName();
if (ObjectUtils.isEmpty(areaCode)) {
throw new AppException("区域编码不能为空!");
}
SiteEntity one = this.service.selectOne(new SiteQuery().areaCode(areaCode).siteName(siteName), getContext());
if (!ObjectUtils.isEmpty(one)) throw new AppException("当前区域下站点名称已存在!");
AreaEntity areaEntity = areaService.selectOne(new AreaQuery().areaCode(areaCode), getContext());
siteEntity.initAttrValue();
//查询是否有站点了,如果有站点,这强制更新为站点 id=1的数据
SiteEntity site = this.service.get(1L);
if (!ObjectUtils.isEmpty(site)) {
siteEntity.setId(site.getId());
}
siteEntity.setAreaCode(areaCode);
siteEntity.setSiteName(siteName);
if (!ObjectUtils.isEmpty(areaEntity)) {
siteEntity.setAreaID(areaEntity.getIid());
siteEntity.setAreaName(areaEntity.getName());
siteEntity.setAreaLevel(areaEntity.getAreaLevel());
}
if (!ObjectUtils.isEmpty(siteEntity.getId())) {
List<SiteEntity> siteEntities = this.service.find(new SiteQuery().areaCode(siteEntity.getAreaCode()));
siteEntity.setSiteCode(siteEntity.getAreaCode() + Constant.SITE_SPLIT_MARK + StringUtils.lpad(siteEntities.size() + 1, Constant.SITE_CODE_NUM));
this.service.getDao().update(siteEntity);
//todo 更新用户站点树
/* Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
this.service.updateUserList(list.getData().getData());
// ThreadPool.getInstance().execute(new SyncTreeSiteThread(this,context));
this.service.updateAllSiteTree(null);*/
} else {
this.service.save(siteEntity, getContext());
}
//todo 更新相关表中的站点名称,站点编码,站点ID
this.service.updateSiteInfo(siteEntity, getContext());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_DATA, siteEntity);
jsonObject.put(KEY_RESULT_MSG, "外部站点添加成功!");
} catch (Exception e) {
log.error("外部站点添加", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
}
\ No newline at end of file
......@@ -139,10 +139,9 @@ public class SkinBaseController extends BaseCRUDJsonBodyMappingController<SkinBa
/**
* 获取皮肤所有相关资源文件并压缩打包成zip
*/
// @PostMapping(value = "skinzip")
@GetMapping(value = "skinzip")
@GetMapping(value = "zip")
@UnAuth
public void skinzip() {
public void zip() {
JSONObject jsonObject = new JSONObject();
try {
SkinBaseEntity query = new SkinBaseEntity();
......
......@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.window.dao.WindowBusinessDao;
import com.mortals.xhx.module.window.service.WindowBusinessService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.util.*;
......@@ -133,14 +134,10 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
@Override
protected void findAfter(WindowBusinessEntity entity, PageInfo pageInfo, Context context, List<WindowBusinessEntity> list) throws AppException {
// Map<Long, WindowEntity> collect = windowService.getCacheList().stream().collect(Collectors.toMap(x -> x.getId(), y -> y, (o, n) -> n));
//Map<Long, WindowEntity> collect = windowService.findToMap(new WindowQuery(), context);
Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.getCacheList().stream().collect(Collectors.toMap(x -> x.getWindowId(), y -> y, (o, n) -> n));
// Map<Long, WindowHallEntity> windowHallEntityMap = windowHallService.find(new WindowHallQuery(), context).parallelStream().collect(Collectors.toMap(x -> x.getWindowId(), Function.identity()));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
WindowBusinessEntity item = (WindowBusinessEntity) iterator.next();
//WindowEntity windowEntity = collect.get(item.getWindowId());
WindowEntity windowEntity = windowService.getCache(item.getWindowId().toString());
if (!ObjectUtils.isEmpty(item.getWindowId()) && !ObjectUtils.isEmpty(windowEntity)) {
item.setDeptId(windowEntity.getDeptId());
......@@ -189,7 +186,9 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
}*/
/* *//**
/* */
/**
* @param entity
* @param context
* @throws AppException
......@@ -199,7 +198,6 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
pushChangeMsg(entity);
super.updateAfter(entity, context);
}*/
private void pushChangeMsg(WindowBusinessEntity entity) {
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
phpUrl += "/api/window/winNameChange";
......
spring:
main:
allow-bean-definition-overriding: true
# jackson:
# deserialization:
# fail-on-unknown-properties: true
application:
log:
level: info
......
......@@ -13,6 +13,7 @@ spring:
jackson:
serialization:
WRITE_DATES_AS_TIMESTAMPS: true
fail_on_empty_beans: true
default-property-inclusion: NON_NULL
# time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss
......@@ -47,3 +48,5 @@ application:
uncheckUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/assessment/*
dm:
enable: true
jsonCheck: @profiles.req.json.check@
trustedReferer : @profiles.trustedReferer@
\ No newline at end of file
......@@ -19,7 +19,7 @@
</plugin>
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="false" />
<property name="showSql" value="true" />
<property name="showSql" value="false" />
</plugin>
<!-- <plugin interceptor="com.mortals.framework.thirty.dm.DmTransInterceptor">
......
......@@ -20,12 +20,12 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###自助终端应用列表
POST {{baseUrl}}/app/list
POST {{baseUrl}}/app/interlist
Content-Type: application/json
{
"idList": [2,3,1],
"siteId": 1,
"appTypeNotList": [4],
"page": 1,
"size": -1
}
......@@ -91,7 +91,7 @@ client.global.set("App_id", JSON.parse(response.body).data.id);
%}
###自助终端应用查看
GET {{baseUrl}}/app/info?id=1
GET {{baseUrl}}/app/interinfo?id=19999999999999999999999
Accept: application/json
###自助终端应用编辑
......
......@@ -56,12 +56,15 @@ POST {{baseUrl}}/app/dataset/list
Content-Type: application/json
{
"appId": 54,
"fieldCode": "title",
"page": 1,
"size": 10
"size": 10,
"appId": "84",
"orConditionList": [
{
"fieldCode": "",
"fieldValue": "%%"
}
]
}
......
......@@ -54,7 +54,7 @@ POST {{baseUrl}}/base/area/genSubAreaByAreaName
Content-Type: application/json
{
"areaCode": "513224000000"
"areaCode": "511900000000"
}
......
......@@ -9,11 +9,21 @@
"baseUrl": "http://192.168.0.98:11071/base"
},
"base-product": {
"baseUrl": "http://192.168.0.250:11071/base"
},
"base-yanyuan-test": {
"baseUrl": "http://192.168.0.119:11078/base"
},
"base-myjkq": {
"baseUrl": "http://10.6.50.2:11078/base"
},
"base-test-https": {
"baseUrl": "https://192.168.0.98:31071/basics_api/base"
},
......
......@@ -45,12 +45,14 @@ Content-Type: application/json
###基础事项列表
POST {{baseUrl}}/site/matter/list
POST {{baseUrl}}/site/matter/interlist
Content-Type: application/json
{
"page": 1,
"size": 10
"size": 10,
"siteId": 1,
"matterName": "特种设备作业人员资格认定取证"
}
###微官网事项列表
......@@ -151,7 +153,7 @@ client.global.set("Matter_id", JSON.parse(response.body).data.id);
%}
###基础事项查看
GET {{baseUrl}}/matter/interinfo?id=34081
GET {{baseUrl}}/matter/interinfo?id=40248
Accept: application/json
###基础事项编辑
......
......@@ -20,6 +20,17 @@ Content-Type: application/json
}
###站点列表
POST http://10.233.82.175:11078/base/site/interlist
Content-Type: application/json
{
"page":1,
"size":10
}
###站点更新与保存
POST {{baseUrl}}/site/save
Content-Type: application/json
......@@ -98,9 +109,20 @@ POST {{baseUrl}}/site/getAreaSitesByAreaLevel
Content-Type: application/json
{
"areaLevel":2
"areaLevelList": [3,4,5]
}
###根据区域等级获取站点列表
POST {{baseUrl}}/site/getSitesGroupByAreaLevel
Content-Type: application/json
{
"areaLevel":3,
"areaLevelList": [3]
}
###站点列表
POST {{baseUrl}}/site/getAreaSitesBySite
Content-Type: application/json
......@@ -147,4 +169,4 @@ Content-Type: application/json
POST {{baseUrl}}/site/getSitesGroupByAreaLevel
Content-Type: application/json
{"areaLevel":2}
{"areaLevel":3,"siteName": "%翠屏区%"}
GET http://localhost:80/api/item?id=99
Accept: application/json
###
###登录
POST {{baseUrl}}/login/login
......@@ -43,7 +47,7 @@ Content-Type: application/json
###短信设置查看
GET {{baseUrl}}/sms/set/info?id=1
GET {{baseUrl}}/sms/set/interinfo?id=1
Authorization: {{authToken}}
Accept: application/json
......@@ -208,14 +212,12 @@ Content-Type: application/x-www-form-urlencoded
businessid=125&matter=125&devicenum=C0-FB-F9-CD-3B-5D&peopleid=13
### 参数列表组合查询
POST {{baseUrl}}/param/list
POST {{baseUrl}}/param/interlist
Content-Type: application/json
{
"page":1,
"size": -1,
"firstOrganize": "Window",
"secondOrganize": "hongqi"
"name": "%domain%"
}
......@@ -259,3 +261,13 @@ Content-Type: application/json
{}
###参数信息更新与保存
POST http://192.168.0.98:8090/basics_api/zwfw/page/bury/save
Content-Type: application/json
{
"name":"upd19g"
}
......@@ -29,7 +29,7 @@ JAVA_HOME="${SOFT_PATH}/java/jdk1.8"
# nginx
NGINX="nginx"
NGINX_FILENAME="nginx-1.22.0.tar.gz"
NGINX_FILENAME="nginx-1.27.1.tar.gz"
NGINX_SERVICE="${SERVICE_PATH}/${NGINX}.service"
NGINX_EXECPATH="${OPT_PATH}/${NGINX}"
NGINX_CONF="/etc/nginx/nginx.conf"
......@@ -37,7 +37,7 @@ NGINX_CONF_PATH="/etc/nginx/conf.d"
# mysql变量
MYSQL="mysql"
MYSQL_CENTOS_FILENAME="mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz"
MYSQL_CENTOS_FILENAME="mysql-5.7.43-linux-glibc2.12-x86_64.tar.gz"
MYSQL_EXECPATH="${SOFT_PATH}/${MYSQL}"
MYSQL_CONF_PATH="/etc/my.cnf"
MYSQL_DATA_PATH="${BASE_PATH}/${MYSQL}/data"
......@@ -129,7 +129,7 @@ unix_is_centos() {
if [ -f "/etc/redhat-release" ]; then
writelog "centos"
else
writelog "ubuntu"
writelog "centos"
fi
}
......@@ -497,8 +497,8 @@ nacos_deploy() {
rm -rf ${NACOS_SERVICE}
rm -rf ${NACOS_EXECPATH}
mkdir -p ${NACOS_EXECPATH}
writelog "tar -zvxf $BASEDIR/release/nacos/${NACOS_FILENAME} -C ${NACOS_EXECPATH} --strip-components 2"
tar -zvxf $BASEDIR/release/nacos/${NACOS_FILENAME} -C ${NACOS_EXECPATH} --strip-components 2
writelog "tar -zvxf $BASEDIR/release/nacos/${NACOS_FILENAME} -C ${NACOS_EXECPATH} --strip-components 3"
tar -zvxf $BASEDIR/release/nacos/${NACOS_FILENAME} -C ${NACOS_EXECPATH} --strip-components 3
writelog "${NACOS}_deploy init db..."
writelog " mysql -h${MYSQL_HOST} -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PASSWORD} <${NACOS_EXECPATH}/db/nacos.sql"
mysql -h${MYSQL_HOST} -P${MYSQL_PORT} -u${MYSQL_USER} -p${MYSQL_PASSWORD} <${NACOS_EXECPATH}/db/nacos.sql
......
......@@ -101,6 +101,10 @@
<configuration>
<delimiters>@</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>exe</nonFilteredFileExtension>
<nonFilteredFileExtension>doc</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
......
......@@ -427,12 +427,6 @@ export default {
// }
}
&:nth-child(1) {
.type-list {
border-style: solid;
border-right-width: 2px;
border-image: linear-gradient(180deg, #0000 0%, #fff 30%, #0000 90%) 1;
// border-image-slice: 2;
}
.item-logo {
background: linear-gradient(180deg, #c7e1f6 0%, #ffffff 85%);
}
......@@ -440,6 +434,8 @@ export default {
&:nth-child(2) {
.type-list {
border-style: solid;
border-width: 0px;
border-left-width: 2px;
border-right-width: 2px;
border-image: linear-gradient(180deg, #0000 0%, #fff 30%, #0000 90%) 1;
// border-image-slice: 2;
......
......@@ -18,7 +18,7 @@
<outputDirectory>boot</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
<fileSet>
<!-- <fileSet>
<directory>./db</directory>
<includes>
<include>*.sql</include>
......@@ -27,7 +27,7 @@
</includes>
<outputDirectory>db</outputDirectory>
<fileMode>0755</fileMode>
</fileSet>
</fileSet>-->
</fileSets>
<files>
......
This diff is collapsed.
......@@ -19,9 +19,15 @@
<profiles.server.debug></profiles.server.debug>
<profiles.server.port>17212</profiles.server.port>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.level>info</profiles.log.level>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.req.json.check>false</profiles.req.json.check>
<profiles.trustedReferer></profiles.trustedReferer>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
......@@ -31,24 +37,16 @@
<properties>
<profiles.active>develop</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>test</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profiles.active>test</profiles.active>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>test</package.environment>
<skipUi>true</skipUi>
<profiles.trustedReferer>192.168.0.98,localhost,192.168.0.252</profiles.trustedReferer>
<profiles.req.json.check>false</profiles.req.json.check>
</properties>
</profile>
......@@ -56,11 +54,7 @@
<id>product</id>
<properties>
<profiles.active>product</profiles.active>
<profiles.nacos.server-addr>192.168.0.250:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
</properties>
</profile>
<profile>
......@@ -68,10 +62,6 @@
<properties>
<profiles.active>yibin</profiles.active>
<profiles.nacos.server-addr>172.15.28.120:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>yibin</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -80,22 +70,7 @@
<properties>
<profiles.active>sngx</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>yibin</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
<profile>
<id>regtest</id>
<properties>
<profiles.active>regtest</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -104,10 +79,6 @@
<properties>
<profiles.active>reg</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -116,10 +87,6 @@
<properties>
<profiles.active>qiling</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -128,10 +95,7 @@
<properties>
<profiles.active>yanyuan</profiles.active>
<profiles.nacos.server-addr>172.16.30.245:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
<profiles.trustedReferer>127.0.0.1,localhost,10.233.82.175,172.16.30.245,172.16.30.246,172.16.30.247,172.16.30.248</profiles.trustedReferer>
</properties>
</profile>
......@@ -140,10 +104,6 @@
<properties>
<profiles.active>pengxi</profiles.active>
<profiles.nacos.server-addr>192.168.106.6:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......@@ -152,10 +112,6 @@
<properties>
<profiles.active>bzjkq</profiles.active>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<package.environment>build</package.environment>
<skipUi>true</skipUi>
</properties>
</profile>
......
This diff is collapsed.
#!/bin/sh
RETVAL=$?
SHELL_NAME="deploy"
BASEDIR=$(dirname $0)
BASEDIR=$( (
cd "$BASEDIR"
pwd
))
LOCK_FILE="/tmp/deploy.lock"
# 时间变量
CDATE=$(date "+%Y-%m-%d")
CTIME=$(date "+%H:%M:%S")
SHELL_LOG="${BASEDIR}/${SHELL_NAME}.log"
JAVA_HOME="/usr/local/java/jdk1.8"
SERVICE_PATH="/usr/lib/systemd/system"
PUBLISH_PATH="/home/publish"
PROJECT_NAME="@project.artifactId@"
PROJECT_EXECPATH="${PUBLISH_PATH}/${PROJECT_NAME}"
PROJECT_FILENAME="${PROJECT_NAME}.tar.gz"
PROJECT_SERVICE="${SERVICE_PATH}/${PROJECT_NAME}.service"
#写日志
writelog() {
LOGINFO=$1
echo "${CDATE} ${CTIME}: ${SHELL_NAME} : ${LOGINFO}" >>${SHELL_LOG}
echo ${LOGINFO}
}
#清理目标
clear_deploy() {
SERVICE=$1
EXECPATH=$2
#清理后台自启服务
rm -f ${SERVICE}
#清理执行文件目录
}
build_service() {
SERVICE=$1
EXECPATH=$2
echo "" >${SERVICE}
echo "[Unit]" >>${SERVICE}
echo "Description=${PROJECT_NAME}" >>${SERVICE}
echo "After=network.target" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Service]" >>${SERVICE}
echo "Environment=\"JAVA_HOME=$JAVA_HOME\"" >>${SERVICE}
echo "Type=forking" >>${SERVICE}
echo "ExecStartPre=-/bin/sleep 5s" >>${SERVICE}
echo "ExecStart=${EXECPATH}/bin/start.sh" >>${SERVICE}
echo "ExecStop=${EXECPATH}/bin/shutdown.sh" >>${SERVICE}
echo "PrivateTmp=true" >>${SERVICE}
echo "" >>${SERVICE}
echo "[Install]" >>${SERVICE}
echo "WantedBy=multi-user.target" >>${SERVICE}
writelog "${PROJECT_NAME}服务创建完成!"
}
#启动服务与nginx
start_service() {
systemctl enable ${PROJECT_NAME}
systemctl daemon-reload
writelog "${PROJECT_NAME}服务启动..."
systemctl stop ${PROJECT_NAME}&&systemctl start ${PROJECT_NAME}
project_status=$(systemctl status "${PROJECT_NAME}"|grep Active |awk '{print $2}')
jcpid=$(ps -ef | grep -v "grep" | grep "${PROJECT_NAME} " | awk '{print $2}')
writelog "${PROJECT_NAME}服务启动,PID is ${jcpid} ,status:${project_status}"
}
#部署后台服务
project_deploy() {
writelog "${PROJECT_NAME}_deploy"
clear_deploy ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
writelog "${PROJECT_NAME}_clear_finish"
tar -zvxf ./${PROJECT_FILENAME} -C ${PUBLISH_PATH}
build_service ${PROJECT_SERVICE} ${PROJECT_EXECPATH}
start_service
writelog "${PROJECT_NAME}_deploy_finish"
}
#主函数
main() {
echo "后台服务部署"
project_deploy
exit ${RETVAL}
}
main $1
#!/bin/sh
PORT="@profiles.server.port@"
DEBUG=@profiles.server.debug@
BASEDIR=`dirname $0`/..
BASEDIR=`(cd "$BASEDIR"; pwd)`
PROJECT_NAME="@project.artifactId@";
MAIN_CLASS="$PROJECT_NAME-@project.version@.jar";
LOG_PATH="@profiles.log.path@/$PROJECT_NAME"
GC_PATH=$LOG_PATH/PROJECT_NAME"-gc.log"
HS_ERR_PATH=$LOG_PATH/PROJECT_NAME"-hs_err.log"
HEAP_DUMP_PATH=$LOG_PATH/PROJECT_NAME"-heap_dump.hprof"
GC_PATH=$LOG_PATH/$PROJECT_NAME"-gc.log"
HS_ERR_PATH=$LOG_PATH/$PROJECT_NAME"-hs_err.log"
HEAP_DUMP_PATH=$LOG_PATH/$PROJECT_NAME"-heap_dump.hprof"
TEMP_PATH=$LOG_PATH/temp/
SUCCESS=0
FAIL=9
......@@ -45,7 +46,7 @@ fi
if [ -e "$BASEDIR" ]
then
JAVA_OPTS="-Xms512M -Xmx1024M -Xss256K -XX:+UseAdaptiveSizePolicy -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:GCTimeRatio=39 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$GC_PATH -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=$HS_ERR_PATH -XX:HeapDumpPath=$HEAP_DUMP_PATH"
JAVA_OPTS="-Xms1024M -Xmx2048M -Xss256K -XX:+UseAdaptiveSizePolicy -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:GCTimeRatio=39 -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$GC_PATH -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=$HS_ERR_PATH -XX:HeapDumpPath=$HEAP_DUMP_PATH"
fi
CLASSPATH=$CLASSPATH_PREFIX:
......@@ -56,13 +57,12 @@ cd "$BASEDIR/boot";
echo "starting application $PROJECT_NAME......"
exec "$JAVACMD" $JAVA_OPTS \
$EXTRA_JVM_ARGUMENTS \
$DEBUG \
-Dapp.name="$PROJECT_NAME" \
-Dapp.port="$PORT" \
-Dbasedir="$BASEDIR" \
-Dfile.encoding=utf-8 \
-Djava.io.tmpdir=$TEMP_PATH \
-Dloader.path="file://$BASEDIR/conf,file://$BASEDIR/lib" \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=21072 \
-jar $MAIN_CLASS \
> /dev/null &
......
package com.mortals.xhx.base.framework;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
/**
* 自定义Jackson反序列化日期类型时应用的类型转换器,一般用于@RequestBody接受参数时使用
*/
public class DateJacksonConverter extends JsonDeserializer {
private static String[] pattern = new String[]{"yyyy-MM-dd", "yyyy-MM-dd HH:mm", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss.S", "yyyy.MM.dd", "yyyy.MM.dd HH:mm", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm:ss.S", "yyyy/MM/dd", "yyyy/MM/dd HH:mm", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm:ss.S"};
@Override
public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
Date targetDate = null;
String originDate = p.getText();
if (StringUtils.isNotEmpty(originDate)) {
try {
long longDate = Long.valueOf(originDate.trim());
targetDate = new Date(longDate);
} catch (NumberFormatException e) {
try {
targetDate = DateUtils.parseDate(originDate, DateJacksonConverter.pattern);
} catch (ParseException pe) {
throw new IOException(String.format("'%s' can not convert to type 'java.util.Date',just support timestamp(type of long) and following date format(%s)",
originDate,
StringUtils.join(pattern, ",")));
}
}
}
return targetDate;
}
@Override
public Class handledType() {
return Date.class;
}
}
package com.mortals.xhx.base.framework;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import java.util.ArrayList;
import java.util.List;
/**
* @author: zxfei
* @date: 2022/6/28 15:57
* @description:
**/
// 创建一个新的转换器 解析微信的 [text/plain]
public class WxMessageConverter extends MappingJackson2HttpMessageConverter {
public WxMessageConverter() {
List<MediaType> mediaTypes = new ArrayList<>();
mediaTypes.add(MediaType.TEXT_PLAIN);
setSupportedMediaTypes(mediaTypes);
}
}
\ No newline at end of file
package com.mortals.xhx.base.framework.config;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mortals.xhx.base.framework.DateJacksonConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
public class ConverterConfig {
@Value("${jsonCheck:false}")
private Boolean jsonCheck;
@Bean
public DateJacksonConverter dateJacksonConverter() {
return new DateJacksonConverter();
}
@Bean
public Jackson2ObjectMapperFactoryBean jackson2ObjectMapperFactoryBean(DateJacksonConverter dateJacksonConverter) {
Jackson2ObjectMapperFactoryBean jackson2ObjectMapperFactoryBean = new Jackson2ObjectMapperFactoryBean();
jackson2ObjectMapperFactoryBean.setDeserializers(dateJacksonConverter);
return jackson2ObjectMapperFactoryBean;
}
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(ObjectMapper objectMapper) {
if(jsonCheck!=null&&jsonCheck){
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);
}
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
mappingJackson2HttpMessageConverter.setObjectMapper(objectMapper);
return mappingJackson2HttpMessageConverter;
}
}
......@@ -23,7 +23,7 @@ public class CorsConfig implements WebMvcConfigurer {
CorsConfiguration configuration = new CorsConfiguration();
//允许跨域访问的域名
configuration.addAllowedOrigin("*");
// configuration.setAllowCredentials(true); //运行携带cookie
configuration.setAllowCredentials(true); //运行携带cookie
configuration.addAllowedMethod("*"); //代表所有请求方法
configuration.addAllowedHeader("*"); //允许携带任何头信息
......
package com.mortals.xhx.base.framework.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.messaging.handler.annotation.support.MethodArgumentTypeMismatchException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 统一异常处理
*/
@ControllerAdvice
@Slf4j
public class ExceptionHandle {
private final static Logger log = LoggerFactory.getLogger(ExceptionHandle.class);
@Autowired
private HttpServletResponse response;
public static final String KEY_RESULT_CODE = "code";
public static final String KEY_RESULT_MSG = "msg";
......@@ -33,9 +42,14 @@ public class ExceptionHandle {
stack.getClassName(), stack.getMethodName(), stack.getLineNumber(), e.getClass().getName());
AppException ex = (AppException) e;
ret.put(KEY_RESULT_MSG, ex.getMessage());
} else if (e instanceof HttpMessageNotReadableException || e instanceof MethodArgumentTypeMismatchException) {
log.error("[system error]", e);
//response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
ret.put(KEY_RESULT_MSG, "参数错误," + StrUtil.subBefore(e.getMessage(), ";", false));
} else {
log.error("[system error]", e);
ret.put(KEY_RESULT_MSG, "未知错误!");
//response.setStatus(HttpStatus.HTTP_BAD_REQUEST);
ret.put(KEY_RESULT_MSG, "未知错误!" + e.getMessage());
}
return ret.toJSONString();
}
......
package com.mortals.xhx.base.framework.filter;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import javax.servlet.*;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.*;
@Slf4j
//@Component
//@Profile({"yanyuan"})
public class SameSiteCookieFilter implements Filter {
@Value("${trustedReferer:''}")
private String trustedReferer;
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
List<String> allowedOrigins = StrUtil.split(trustedReferer, ",");
// Set allowedOrigins= new HashSet(Arrays.asList(allowDomain));
String originHeader=((HttpServletRequest) request).getHeader("Origin");
if(!ObjectUtils.isEmpty(originHeader)){
URI host = URLUtil.getHost(new URL(originHeader));
String origin = host.getHost();
if (allowedOrigins.contains(origin)){
httpResponse.setHeader("Access-Control-Allow-Origin", originHeader);
httpResponse.setContentType("application/json;charset=UTF-8");
httpResponse.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
httpResponse.setHeader("Access-Control-Max-Age", "3600");
httpResponse.setHeader("Access-Control-Allow-Headers", "Content-Type,authorization,authtoken");
// 如果要把Cookie发到服务器,需要指定Access-Control-Allow-Credentials字段为true
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpResponse.setHeader("Access-Control-Expose-Headers", "*");
}
}
// addSameSiteAttribute((HttpServletResponse) response);
chain.doFilter(request, response);
}
private void addSameSiteAttribute(HttpServletResponse response) {
Collection<String> headers = response.getHeaders("Set-Cookie");
boolean firstHeader = true;
for (String header : headers) {
if (firstHeader) {
response.setHeader("Set-Cookie", String.format("%s; %s", header, "SameSite=Strict"));
firstHeader = false;
continue;
}
response.addHeader("Set-Cookie", String.format("%s; %s", header, "SameSite=Strict"));
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
@Override
public void destroy() {}
}
package com.mortals.xhx.base.framework.interceptor;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.druid.support.http.ResourceServlet;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
......@@ -18,14 +21,19 @@ import com.mortals.xhx.module.user.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.ParameterResolutionDelegate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URL;
import java.util.List;
import java.util.Set;
/**
......@@ -47,6 +55,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
private ResourceService resourceService;
@Autowired
private UserService userService;
@Value("${trustedReferer:''}")
private String trustedReferer;
@Override
public int getOrder() {
......@@ -56,6 +66,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
JSONObject ret = new JSONObject();
try {
if (handler instanceof HandlerMethod) {
......
......@@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse;
* @date: 2022/6/6 15:05
* @description:添加跨域响应
**/
@Component
//@Component
public class CrossInterceptor extends BaseInterceptor {
@Override
......
......@@ -111,299 +111,9 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userEntity.getId().toString(), menuUrlCode);
}
userEntity.setMenuUrl(menuUrlCode);
return userEntity;
/*return new IUser() {
*//**
* @return
*//*
@Override
public Long getId() {
return userEntity.getId();
}
*//**
* @return
*//*
@Override
public Long getDeptId() {
return userEntity.getDeptId();
}
*//**
* @return
*//*
@Override
public String getDeptName() {
return userEntity.getDeptName();
}
*//**
* @return
*//*
@Override
public Long getCustomerId() {
return userEntity.getCustomerId();
}
*//**
* @return
*//*
@Override
public Long getSiteId() {
return userEntity.getSiteId();
}
*//**
* @return
*//*
@Override
public String getSiteIds() {
return userEntity.getSiteIds();
}
*//**
* @return
*//*
@Override
public String getAreaCodes() {
return userEntity.getAreaCodes();
}
*//**
* @return
*//*
@Override
public Long getCustomerJoinId() {
return userEntity.getCustomerJoinId();
}
*//**
* @return
*//*
@Override
public String getCustomerNum() {
return userEntity.getCustomerNum();
}
*//**
* @return
*//*
@Override
public String getLoginName() {
return userEntity.getLoginName();
}
*//**
* @return
*//*
@Override
public String getRealName() {
return userEntity.getRealName();
}
*//**
* @return
*//*
@Override
public boolean isAdmin() {
return userEntity.isAdmin();
}
*//**
* @return
*//*
@Override
public boolean isSystemUser() {
return userEntity.isSystemUser();
}
*//**
* @return
*//*
@Override
public boolean isManager() {
return userEntity.isManager();
}
*//**
* @return
*//*
@Override
public Integer getUserType() {
return userEntity.getUserType();
}
*//**
* @return
*//*
@Override
public String getToken() {
return userEntity.getToken();
}
*//**
* @return
*//*
@Override
public Long getLoginTime() {
return userEntity.getLoginTime();
}
*//**
* @return
*//*
@Override
public Long getExpireTime() {
return userEntity.getExpireTime();
}
*//**
* @param expireTime
*//*
@Override
public void setExpireTime(Long expireTime) {
}
*//**
* @return
*//*
@Override
public String getMenuUrl() {
return userEntity.getMenuUrl();
}
};*/
// return userEntity;
/* if (StringUtils.isNotEmpty(userStr)) {
JSONObject userObj = JSON.parseObject(userStr);
Long userId = userObj.getLongValue("id");
Integer userType = userObj.getIntValue("userType");
Long customerId = userObj.getLongValue("customerId");
Long siteId = userObj.getLongValue("siteId");
Long loginTime = userObj.getLongValue("loginTime");
Long expireTime = userObj.getLongValue("expireTime");
String loginName = userObj.getString("loginName");
String realName = userObj.getString("realName");
String siteIds = userObj.getString("siteIds");
String menuUrl = userObj.getString("menuUrl");
Boolean isManager = userObj.getBoolean("manager");
Boolean isSystemUser = userObj.getBoolean("systemUser");
String areaCodes = userObj.getString("areaCodes");
return new IUser() {
@Override
public Long getId() {
return userId;
}
@Override
public Long getDeptId() {
return null;
}
@Override
public String getDeptName() {
return null;
}
@Override
public Long getCustomerId() {
return customerId;
}
@Override
public Long getSiteId() {
return siteId;
}
@Override
public String getSiteIds() {
return siteIds;
}
@Override
public String getAreaCodes() {
return areaCodes;
}
@Override
public Long getCustomerJoinId() {
return null;
}
@Override
public String getCustomerNum() {
return null;
}
@Override
public String getLoginName() {
return loginName;
}
@Override
public String getRealName() {
return realName;
}
@Override
public boolean isAdmin() {
return userId == 1L;
}
@Override
public boolean isSystemUser() {
return isSystemUser;
}
@Override
public boolean isManager() {
return isManager;
}
@Override
public Integer getUserType() {
return userType;
}
@Override
public String getToken() {
return token;
}
@Override
public Long getLoginTime() {
return loginTime;
}
@Override
public Long getExpireTime() {
return expireTime;
}
@Override
public void setExpireTime(Long expireTime) {
}
@Override
public String getMenuUrl() {
return menuUrl;
}
};
}*/
// return cacheService.get(userKey, IUser.class);
} catch (Exception e) {
log.error("解析jwt token异常!", e);
log.error("解析jwt token异常!", e.getMessage());
return null;
}
}
......
......@@ -58,10 +58,17 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
@RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception {
//log.info("Session:"+this.request.getSession().getId());
JSONObject ret = new JSONObject();
Map<String, Object> data = new HashMap<>();
String loginName = loginForm.getLoginName();
String password = loginForm.getPassword();
//loginForm.setSecurityCode("admin");
// if(!StringUtils.isEmpty(loginForm.getMark())){
// ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
// ret.put(KEY_RESULT_MSG, "非法的参数");
// return ret.toJSONString();
// }
String ip = super.getRequestIP(request);
if (StringUtils.isEmpty(loginName) || StringUtils.isEmpty(password)) {
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
......
......@@ -6,7 +6,6 @@ import com.mortals.xhx.base.login.service.GifSecurityImage;
import com.mortals.xhx.base.system.valid.model.ValidCodeEntity;
import com.mortals.xhx.base.system.valid.service.ValidCodeService;
import com.mortals.xhx.base.system.valid.web.ValidCodeForm;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -25,9 +24,9 @@ public class SecurityCodeController
@RequestMapping("createCode")
public void createCode(HttpServletRequest request, HttpServletResponse response) {
//log.info("Session:"+this.request.getSession().getId());
// 获取默认难度和长度的验证码
String securityCode = validCodeService.createImageValidCode(request.getParameter("mark"), super.getRequestIP(request));
String securityCode = validCodeService.createImageValidCode(request.getParameter("t"), super.getRequestIP(request));
// int imageType = ParamUtil.getInt("securityImage", 1);
int imageType = 0;
switch (imageType) {
......
......@@ -113,6 +113,9 @@ public class OperLogServiceImpl extends AbstractCRUDServiceImpl<OperLogDao,OperL
operLogEntity.setContent(content);
save(operLogEntity, null);
}
private void formatterLogContent(OperLogEntity operLogEntity, String content, String id, OperTypeEnum operType) {
if (operType == OperTypeEnum.SAVE) {
......
/**
* 文件:OperLogController.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.oper.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.oper.model.OperLogEntity;
import com.mortals.xhx.base.system.oper.service.OperLogService;
import com.mortals.xhx.common.code.OperTypeEnum;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
......@@ -39,65 +25,42 @@ import java.util.Map;
*/
@RestController
@RequestMapping("oper/log")
public class OperLogController extends BaseCRUDJsonMappingController<OperLogService,OperLogForm,OperLogEntity,Long> {
public class OperLogController extends BaseCRUDJsonBodyMappingController<OperLogService,OperLogEntity,Long> {
public OperLogController(){
super.setFormClass(OperLogForm.class);
super.setModuleDesc("操作日志");
}
/**
* @param model
* @param context
*/
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, OperLogForm form,
Map<String, Object> model, Context context) {
protected void init(Map<String, Object> model, Context context) {
Map<String, Object> status = new HashMap<String, Object>(1);
// 返回日志类型
status.put("operType", OperTypeEnum.getEnumMap());
model.put(KEY_RESULT_DICT, status);
super.init(request, response, form, model, context);
}
@Override
@PostMapping({"list"})
@UnAuth
public String list(@RequestBody OperLogForm form) {
Map<String, Object> model = new HashMap();
JSONObject ret = new JSONObject();
Context context = this.getContext();
String busiDesc = "查询" + this.getModuleDesc();
int code;
try {
this.doListBefore(this.request, this.response, form, model, context);
Result result = this.getService().find(form.getQuery(), form.getPageInfo(), context);
model.put("result", result.getList());
model.put("pageInfo", result.getPageInfo());
model.put("total", result.getPageInfo().getTotalResult());
model.putAll(form.getModel());
code = this.doListAfter(this.request, this.response, form, model, context);
this.recordSysLog(this.request, busiDesc + " 【成功】");
} catch (Exception var8) {
code = -1;
this.doException(this.request, busiDesc, model, var8);
}
form.getModel().clear();
this.init(this.request, this.response, form, model, context);
ret.put("code", code);
ret.put("msg", model.remove("message_info"));
ret.put("query", form.getQuery());
ret.put("data", model);
return ret.toJSONString();
super.init(model, context);
}
/**
* @param query
* @param model
* @param context
* @throws AppException
*/
@Override
protected void doListBefore(HttpServletRequest request, HttpServletResponse response, OperLogForm form, Map<String, Object> model, Context context) throws AppException {
form.getQuery().setOrderColList(new ArrayList<OrderCol>() {
protected void doListBefore(OperLogEntity query, Map<String, Object> model, Context context) throws AppException {
super.doListBefore(query, model, context);
query.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.logDate", "desc"));
}
});
}
}
\ No newline at end of file
......@@ -69,6 +69,7 @@ public class ValidCodeServiceImpl extends AbstractCRUDServiceImpl<ValidCodeDao,V
if(StringUtils.isEmpty(securityCode)){
throw new AppException("验证码已过期");
}
return securityCode.equals(code);
}
......
......@@ -5,14 +5,13 @@ package com.mortals.xhx.common.key;
*/
public class RedisKey {
/**
* 登录 cookies key
*/
public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:";
public static final String KEY_USER_MENU_CACHE = "user:menu";
public static final String KEY_BURY_POINT_CACHE = "bury:point";
public static final String KEY_REFERERS_CACHE = "referers";
}
......@@ -3,11 +3,13 @@ package com.mortals.xhx.daemon.applicationservice;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.net.NetUtil;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.CipherUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
......@@ -35,13 +37,17 @@ import java.util.List;
@Slf4j
public class DemoStartedService implements IApplicationStartedService {
private static Log logger = LogFactory.getLog(DemoStartedService.class);
@Value("${trustedReferer:''}")
private String trustedReferer;
@Autowired
private ICacheService cacheService;
@Override
public void start() {
if(!ObjectUtils.isEmpty(trustedReferer)){
cacheService.set(RedisKey.KEY_REFERERS_CACHE,trustedReferer);
}
//获取网卡并封装信息
Collection<NetworkInterface> networkInterfaces = NetUtil.getNetworkInterfaces();
......@@ -58,18 +64,15 @@ public class DemoStartedService implements IApplicationStartedService {
StringBuilder sb = new StringBuilder();
sb.append("mac=").append(macAddress).append("|ip=").append(ip);
CipherUtil.macAndIp.add(sb.toString());
}
}
logger.info("开始服务..[配置已加载完成,并且所有框架都已经初始化]");
log.info("开始服务..[配置已加载完成,并且所有框架都已经初始化]");
}
@Override
public void stop() {
logger.info("停止服务..");
log.info("停止服务..");
}
@Override
......
......@@ -3,6 +3,7 @@ package com.mortals.xhx.module.cipher.web;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......@@ -13,8 +14,11 @@ import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.utils.CipherUtil;
import com.mortals.xhx.common.utils.DecodeUtil;
import com.mortals.xhx.common.utils.LicenseUtil;
import com.mortals.xhx.module.menu.model.MenuEntity;
import com.mortals.xhx.module.menu.service.MenuService;
import com.mortals.xhx.utils.EncodeUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -23,11 +27,16 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import static com.mortals.framework.web.BaseController.VALUE_RESULT_SUCCESS;
import static com.mortals.xhx.base.framework.exception.ExceptionHandle.*;
......@@ -59,6 +68,7 @@ public class CipherController {
private UploadService uploadService;
/**
* 用户在点击,查看`授权信息`按钮时,请求check接口,进行一次授权验证(每天第一次通过其他接口访问系统时,也会验证一次 )
* 如果通过则返回授权信息(开始+结束时间)
......@@ -131,4 +141,7 @@ public class CipherController {
return jsonStr;
}
}
package com.mortals.xhx.module.uploadfile.web;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.module.menu.model.MenuEntity;
import com.mortals.xhx.module.menu.service.MenuService;
import com.mortals.xhx.module.param.service.ParamService;
import com.mortals.xhx.module.product.model.ProductAppsEntity;
import com.mortals.xhx.module.product.model.ProductDocumentEntity;
import com.mortals.xhx.module.product.service.ProductAppsService;
import com.mortals.xhx.module.product.service.ProductDocumentService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -18,6 +30,9 @@ import com.mortals.xhx.module.uploadfile.service.UploadfileService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -26,11 +41,15 @@ import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.framework.web.BaseController.VALUE_RESULT_SUCCESS;
import static com.mortals.xhx.base.framework.exception.ExceptionHandle.*;
/**
* 上传文件业务
......@@ -40,11 +59,22 @@ import static com.mortals.framework.ap.SysConstains.*;
*/
@RestController
@RequestMapping("uploadfile")
@Slf4j
public class UploadfileController extends BaseCRUDJsonBodyMappingController<UploadfileService, UploadfileEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private UploadService uploadService;
@Autowired
private MenuService menuService;
@Autowired
private ProductDocumentService productDocumentService;
@Autowired
private ProductAppsService productAppsService;
public UploadfileController() {
super.setFormClass(UploadfileForm.class);
super.setModuleDesc("上传文件业务");
......@@ -57,4 +87,95 @@ public class UploadfileController extends BaseCRUDJsonBodyMappingController<Uplo
}
/**
* 获取所有相关资源文件并压缩打包成zip
*/
@GetMapping(value = "zip")
@UnAuth
public void zip() {
JSONObject jsonObject = new JSONObject();
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
List<MenuEntity> menuEntities = menuService.find(new MenuEntity());
for (MenuEntity menuEntity : menuEntities) {
String imgPath = menuEntity.getImgPath();
String filePath = uploadService.getFilePath(imgPath);
File file = new File(filePath);
if (file.exists()) {
try {
//zip.putNextEntry(new ZipEntry(StrUtil.subAfter(filePath, "/", false)));
zip.putNextEntry(new ZipEntry(StrUtil.removePrefix(filePath, "/")));
IOUtils.write(FileUtil.readBytes(file), zip);
zip.flush();
zip.closeEntry();
} catch (Exception e) {
log.error("异常", e);
}
}
}
List<ProductDocumentEntity> productDocumentEntities = productDocumentService.find(new ProductDocumentEntity());
for (ProductDocumentEntity productDocumentEntity : productDocumentEntities) {
String docFileUrl = productDocumentEntity.getDocFileUrl();
String filePath = uploadService.getFilePath(docFileUrl);
File file = new File(filePath);
if (file.exists()) {
try {
zip.putNextEntry(new ZipEntry(StrUtil.removePrefix(filePath, "/")));
IOUtils.write(FileUtil.readBytes(file), zip);
zip.flush();
zip.closeEntry();
} catch (Exception e) {
log.error("异常", e.getMessage());
}
}
}
List<ProductAppsEntity> productAppsEntities = productAppsService.find(new ProductAppsEntity());
for (ProductAppsEntity productAppsEntity : productAppsEntities) {
String appFileUrl = productAppsEntity.getAppFileUrl();
String filePath = uploadService.getFilePath(appFileUrl);
File file = new File(filePath);
if (file.exists()) {
try {
zip.putNextEntry(new ZipEntry(StrUtil.removePrefix(filePath, "/")));
IOUtils.write(FileUtil.readBytes(file), zip);
zip.flush();
zip.closeEntry();
} catch (Exception e) {
log.error("异常", e.getMessage());
}
}
}
IOUtils.closeQuietly(zip);
byte[] bytes = outputStream.toByteArray();
genCode(response, bytes);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "压缩文件成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
}
}
/**
* 生成zip文件
*/
private void genCode(HttpServletResponse response, byte[] data) throws IOException {
response.reset();
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("Content-Disposition", "attachment; filename=\"skin.zip\"");
response.addHeader("Content-Length", "" + data.length);
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(data, response.getOutputStream());
}
}
\ No newline at end of file
......@@ -17,4 +17,5 @@ import java.util.List;
public interface UserDao extends ICRUDDao<UserEntity,Long>{
List<Long> getAuthListById(Long id);
Result<UserEntityExt> getListExt(UserEntity params, PageInfo pageInfo);
int initUser(UserEntity userEntity);
}
package com.mortals.xhx.module.user.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.user.dao.UserDao;
import com.mortals.xhx.module.user.model.UserEntity;
import com.mortals.xhx.module.user.model.UserEntityExt;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.user.dao.UserDao;
import com.mortals.xhx.module.user.model.UserEntity;
import java.util.ArrayList;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
......@@ -69,4 +66,9 @@ public class UserDaoImpl extends BaseCRUDDaoMybatis<UserEntity, Long> implements
return result;
}
@Override
public int initUser(UserEntity userEntity) {
return getSqlSession().update(this.getSqlId("initUser"),userEntity);
}
}
......@@ -5,7 +5,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.user.dao.UserDao;
import com.mortals.xhx.module.user.model.UserEntity;
import com.mortals.xhx.module.user.model.UserEntityExt;
......@@ -18,6 +18,9 @@ import com.mortals.xhx.module.user.model.UserEntityExt;
* @date 2022-05-25
*/
public interface UserService extends ICRUDCacheService<UserEntity,Long> {
UserDao getDao();
/**
* 用户登录
*
......@@ -80,4 +83,11 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
*/
boolean resetUserPwd(String loginName, String newPwd , Context context) throws AppException;
/***
* 初始化用户数据
* @param userEntity
* @throws AppException
*/
int initUser(UserEntity userEntity) throws AppException;
}
\ No newline at end of file
......@@ -32,6 +32,7 @@ import com.mortals.xhx.module.user.service.UserService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -61,6 +62,10 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired
private UserPwdRecordDao userPwdRecordDao;
// 当日密码错误次数(默认60分钟)
@Value("${login.errorCount:5}")
private int ErrorCount;
/**
* @param data
* @return
......@@ -208,14 +213,16 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
if (sysUser.getLoginLock() == null) {
sysUser.setLoginLock(0);
}
//取消账户锁定功能
/* if (sysUser.getLoginLock() == 1 && sysUser.getLockTime() != null) {
//账户锁定功能
if (sysUser.getLoginLock() == 1 && sysUser.getLockTime() != null) {
String nowStr = DateUtils.getCurrStrDate();
String loginDateStr = DateUtils.getDateTime(sysUser.getLockTime(), "yyyy-MM-dd");
if (nowStr.equals(loginDateStr)) {
throw new AppException("此账号当天密码错误次数已达上限,已被锁定");
throw new AppException("此账号当天密码错误次数已达上限"+ErrorCount+"次,已被锁定");
}else {
sysUser.setLoginLock(0);
}
}
}*/
try {
if (StringUtils.isNotEmpty(sysUser.getSaltKey())) {
......@@ -225,7 +232,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
UserEntity update = new UserEntity();
update.setId(sysUser.getId());
update.setErrorCount(sysUser.getErrorCount() + 1);
if (update.getErrorCount() == 5) {
if (update.getErrorCount() == ErrorCount) {
update.setLoginLock(1);
update.setLockTime(new Date());
}
......@@ -561,4 +568,8 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
}
@Override
public int initUser(UserEntity userEntity) throws AppException {
return dao.initUser(userEntity);
}
}
\ No newline at end of file
spring:
jackson:
deserialization:
fail-on-ignored-properties: false
main:
allow-bean-definition-overriding: true
application:
......
......@@ -41,7 +41,8 @@ application:
auth:
unloginUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/doc.html
uncheckUrl: /refresh,/error,/login/login,/login/index,/login/logout,/securitycode/createCode,/file/common/*,/test*,/padsign/*,/terminal/*,/resource/list,/api/asset/*,/api/*,/flow/*,/uploads/*,/project/file/*,/file/*,/doc.html
jsonCheck: @profiles.req.json.check@
trustedReferer : @profiles.trustedReferer@
#sys:
# license:
# key: /home/license/license.key
......
......@@ -18,7 +18,7 @@
</plugin>
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="true" />
<property name="showSql" value="false" />
<property name="showSql" value="true" />
</plugin>
</plugins>
</configuration>
\ No newline at end of file
......@@ -163,4 +163,9 @@
</where>
</trim>
</select>
<!-- 初始化用户登录密码admin -->
<update id="initUser" parameterType="UserEntity">
update mortals_xhx_user set loginPwd='43442676c74ae59f219c2d87fd6bad52',errorCount=0,lockTime=NULL,loginLock=0,saltKey=NULL,status=1,siteIds=#{siteIds},areaCodes=#{areaCodes},areaNames=#{areaNames}
</update>
</mapper>
\ No newline at end of file
GET http://localhost:80/api/item?id=99
Accept: application/json
###
###
POST {{baseUrl}}/file/commonupload
......@@ -28,6 +32,9 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
###首页
POST {{baseUrl}}/login/index
Authorization: {{authToken}}
......@@ -52,6 +59,17 @@ Accept: application/json
GET {{baseUrl}}/cipher/check
Accept: application/json
###license check1
GET http://192.168.0.250:11078/zwfw/cipher/check
Accept: application/json
### 测试
GET http://192.168.0.98:11072/zwfw_api/admin/statistic/ages?selected=1& substr(user,1,1) = 'a'
siteid:1
Authtoken: eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjE6MTNiMzE5MDcyMGIzNDQ0ODhiMGJhMmYzN2Y0MTY0MmEifQ.QVWLf0559EbLOUs7RXYu_SStviBkJt0wwiH8461lpd4
### license upload
POST {{baseUrl}}/cipher/upload
......
This diff is collapsed.
This diff is collapsed.
......@@ -11,7 +11,7 @@ import javax.servlet.http.HttpServletResponse;
* @date: 2022/6/6 15:05
* @description:添加跨域响应
**/
@Component
//@Component
public class CrossInterceptor extends HandlerInterceptorAdapter {
@Override
......
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