Commit c52ebdc3 authored by 赵啸非's avatar 赵啸非

修改部分一键部署功能

parent 8d69b108
package com.mortals.xhx.base.system.param.web;
import cn.hutool.core.net.Ipv4Util;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.IpUtils;
import com.mortals.framework.annotation.RepeatSubmit;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.code.PageDisplayType;
......@@ -10,7 +12,10 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.util.FileUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.module.site.model.SiteQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
......@@ -24,6 +29,9 @@ import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_HTTP_URL;
/**
* 参数信息
......@@ -36,7 +44,6 @@ import java.util.Map;
public class ParamController extends BaseCRUDJsonBodyMappingController<ParamService, ParamEntity, Long> {
public ParamController() {
super.setFormClass(ParamForm.class);
super.setModuleDesc("参数信息");
}
......@@ -102,6 +109,43 @@ public class ParamController extends BaseCRUDJsonBodyMappingController<ParamServ
}
/**
* 更新终端访问服务器应用ip地址
*/
@GetMapping(value = "updateServerIp")
@UnAuth
public String updateServerip(String serverIp) {
JSONObject jsonObject = new JSONObject();
try {
//校验ip地址
boolean ipv4 = IpUtils.isIpv4(serverIp);
if (!ipv4) {
throw new AppException("请输入正确的ip地址");
}
ParamQuery paramQuery = new ParamQuery();
paramQuery.setParamKey(PARAM_SERVER_HTTP_URL);
ParamEntity paramEntity = this.service.selectOne(paramQuery);
if (!ObjectUtils.isEmpty(paramEntity)) {
//paramEntity.setParamValue(serverIp);
String value = "http://" + serverIp + ":11078";
paramEntity.setParamValue(value);
this.service.update(paramEntity);
}
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "更新终端访问服务端ip成功!");
} 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();
}
private Map<String, Object> getPageDisplayType() {
PageDisplayType[] pageDisplayTypes = PageDisplayType.values();
Map<String, Object> result = new HashMap<>(pageDisplayTypes.length);
......@@ -112,7 +156,10 @@ public class ParamController extends BaseCRUDJsonBodyMappingController<ParamServ
}
public static void main(String[] args) {
FileUtil.delete("E:\\pic\\1.png");
//FileUtil.delete("E:\\pic\\1.png");
System.out.println(IpUtils.isIpv4("10.102.252.13"));
}
}
\ No newline at end of file
/**
* 文件:ParamForm.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.param.web;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
/**
* <p>Title: 参数信息</p>
* <p>Description: ParamForm </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class ParamForm extends BaseCRUDFormLong<ParamEntity> {
private ParamEntity entity = new ParamEntity();
private ParamQuery query = new ParamQuery();
public ParamForm(){
}
@Override
public ParamEntity getEntity() {
return entity;
}
public void setEntity(ParamEntity entity) {
this.entity = entity;
}
@Override
public ParamQuery getQuery() {
return query;
}
public void setQuery(ParamQuery query) {
this.query = query;
}
public static void main(String[] args) {
ParamForm form = new ParamForm();
String entityName =form.getEntity().getClass().getSimpleName();
System.out.println(entityName);
if ((entityName = entityName.substring(0, 1).toLowerCase() + entityName.substring(1, entityName.length())).endsWith("Entity")) {
entityName = entityName.substring(0, entityName.length() - "Entity".length());
}
System.out.println(entityName);
System.out.println(JSON.toJSONString(form));
}
}
\ No newline at end of file
......@@ -479,8 +479,8 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
//eba467f81fb265befdf1f6ab041d39ab 原始admin密码
System.out.println(SecurityUtil.md5DoubleEncoding("xhxADMIN8@a"));
// System.out.println(SecurityUtil.md5DoubleEncoding("123"));
System.out.println(SecurityUtil.md5DoubleEncoding(" 123456 "));
System.out.println(SecurityUtil.md5DoubleEncoding("123"));
// System.out.println(SecurityUtil.md5DoubleEncoding("Qt123456@"));
/*
......
......@@ -333,6 +333,9 @@ public class DemoWebApiController {
//复制部门
Long copySiteId = siteQuery.getCopySiteId();
Long targetSiteId = siteQuery.getTargetSiteId();
List<DeptEntity> deptEntityList = deptService.find(new DeptQuery().siteId(copySiteId).source(SourceEnum.政务网.getValue()));
deptEntityList.stream().forEach(item -> {
item.setSiteId(targetSiteId);
......@@ -390,6 +393,49 @@ public class DemoWebApiController {
}
@PostMapping(value = "saveSiteMattersTwo")
@UnAuth
public Rest<String> saveSiteMattersTwo(@RequestBody SiteQuery siteQuery) {
log.info("保存站点事项相关222==");
//复制部门
Long copySiteId = siteQuery.getCopySiteId();
Long targetSiteId = siteQuery.getTargetSiteId();
SiteEntity siteEntity = siteService.get(targetSiteId);
/* Long[] ids = siteMatterService.find(new SiteMatterQuery().siteId(targetSiteId)).stream().map(SiteMatterEntity::getId).toArray(Long[]::new);
siteMatterService.remove(ids,null);*/
Map<String, Long> targetDeptMap = deptService.find(new DeptQuery().siteId(targetSiteId)).stream().collect(Collectors.toMap(x -> x.getDeptNumber(), y -> y.getId(), (o, n) -> n));
SiteMatterQuery siteMatterQuery = new SiteMatterQuery();
siteMatterQuery.setSiteId(targetSiteId);
List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(siteMatterQuery);
List<SiteMatterEntity> targetSiteMatterEntities = new ArrayList<>();
for (SiteMatterEntity siteMatterEntity : siteMatterEntities) {
siteMatterEntity.getDeptId();
String targetDeptCode= siteMatterEntity.getDeptCode()+ "_50";
Long targetDeptId = targetDeptMap.get(targetDeptCode);
if(!ObjectUtils.isEmpty(targetDeptId)){
siteMatterEntity.setDeptId(targetDeptId);
siteMatterEntity.setDeptCode(targetDeptCode);
targetSiteMatterEntities.add(siteMatterEntity);
}
}
if(!ObjectUtils.isEmpty(targetSiteMatterEntities)){
siteMatterService.update(targetSiteMatterEntities);
}
return Rest.ok();
}
@PostMapping(value = "limit")
@UnAuth
//@TokenBucketLimit
......
......@@ -122,18 +122,12 @@ public final class Constant {
public static final String APP_BASE_DISTRIBUTE_PATH = "app_base_distribute_path";
/**
* 版本前缀
*/
public static final String VERSION_PREFIX = "V";
/**
* 服务器http
*/
public final static String PARAM_SERVER_HTTP_URL = "server_http_url";
/**
* 服务器http
* php服务器http
*/
public final static String PARAM_SERVER_PHP_HTTP_URL = "server_php_http_url";
......
package com.mortals.xhx.daemon.task;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
......@@ -61,14 +62,26 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
MatterQuery matterQuery = new MatterQuery();
matterQuery.setEventTypeShowNotList(Arrays.asList("行政处罚"));
int total = matterService.count(matterQuery.source(SourceEnum.政务网.getValue()).deptCode(deptEntity.getDeptNumber()), null);
int total = 0;
if (StrUtil.contains(deptEntity.getDeptNumber(), "_")) {
String deptCode = StrUtil.subBefore(deptEntity.getDeptNumber(), "_", true);
total = matterService.count(matterQuery.source(SourceEnum.政务网.getValue()).deptCode(deptCode), null);
} else {
total = matterService.count(matterQuery.source(SourceEnum.政务网.getValue()).deptCode(deptEntity.getDeptNumber()), null);
}
DeptEntity deptQuery = new DeptEntity();
deptQuery.setTotal(total);
deptQuery.setUpdateTime(new Date());
//统计入驻事项
SiteMatterQuery siteMatterQuery = new SiteMatterQuery();
siteMatterQuery.setDeptCode(deptEntity.getDeptNumber());
//siteMatterQuery.setDeptCode(deptEntity.getDeptNumber());
siteMatterQuery.setDeptId(deptEntity.getId());
siteMatterQuery.setSource(SourceEnum.政务网.getValue());
siteMatterQuery.setHallCheckIn(YesNoEnum.YES.getValue());
int incount = siteMatterService.count(siteMatterQuery, null);
......@@ -113,4 +126,12 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
public void stopTask(ITask task) throws AppException {
}
public static void main(String[] args) {
String deptCode = StrUtil.subBefore("4166885406123696128_50", "_", true);
System.out.println(deptCode);
}
}
......@@ -129,7 +129,7 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService,
entity.setSiteIdList(appEntityList.stream().map(AppEntity::getSiteId).collect(Collectors.toList()));
SiteEntity siteEntity = siteService.getCache(entity.getSiteId().toString());
if (!ObjectUtils.isEmpty(siteEntity)) {
//请求地址 http://domian/app/siteCode/appcode/html
//请求地址 http://domian/app/siteCode/appcode/html 应用终端访问服务器地址,可能是政务网,也可能是内网
String domainUrl = GlobalSysInfo.getParamValue(Constant.PARAM_SERVER_HTTP_URL, "http://192.168.0.98:11078");
entity.setCustUrl(UrlBuilder.of(domainUrl)
.addPath(CUSTAPP_ROOT_PATH)
......
......@@ -116,7 +116,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
}
//通知第三方平台
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
phpUrl += "/inter/device/baseDataSave";
BussinessThirdPartyReq bussinessThirdPartyReq = new BussinessThirdPartyReq();
BeanUtils.copyProperties(entity, bussinessThirdPartyReq, BeanUtil.getNullPropertyNames(entity));
......@@ -159,7 +159,7 @@ public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDa
}
}
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
phpUrl += "/inter/device/baseDataSave";
for (BusinessEntity entity : businessEntities) {
BussinessThirdPartyReq bussinessThirdPartyReq = new BussinessThirdPartyReq();
......
......@@ -199,7 +199,7 @@ public class WindowBusinessServiceImpl extends AbstractCRUDServiceImpl<WindowBus
super.updateAfter(entity, context);
}*/
private void pushChangeMsg(WindowBusinessEntity entity) {
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
phpUrl += "/api/window/winNameChange";
HashMap<String, Object> paramsMap = new HashMap<>();
paramsMap.put("windowid", entity.getWindowId());
......
......@@ -152,7 +152,7 @@ public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatte
}
private void pushChangeMsg(WindowMatterEntity entity) {
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
phpUrl += "/api/window/winNameChange";
HashMap<String, Object> paramsMap = new HashMap<>();
paramsMap.put("windowid", entity.getWindowId());
......
......@@ -63,7 +63,7 @@ public class WindowMatterController extends BaseCRUDJsonBodyMappingController<Wi
*/
@Override
protected int saveAfter(WindowMatterEntity entity, Map<String, Object> model, Context context) throws AppException {
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://127.0.0.1:11078/zwfw_api");
HashMap<String, Object> paramsMap = new HashMap<>();
paramsMap.put("windowid", entity.getWindowId());
String resp = null;
......
......@@ -7,10 +7,10 @@ Content-Type: application/json
###部门列表1
POST {{baseUrl}}/dept/list
POST {{baseUrl}}/dept/interlist
Content-Type: application/json
{"siteId":1,"page":"1","size":"3","idList":[422,420,413,412],"orderColList":[{"colName":"sort","sortKind":"asc"}]}
{"siteId":11,"isWordGuide": 1,"filter": 1,"page":"1","size":"10","orderColList":[{"colName":"sort","sortKind":"asc"}]}
###部门更新与保存
POST {{baseUrl}}/dept/save
......
......@@ -16,12 +16,11 @@ Content-Type: application/json
###基础事项列表
POST {{baseUrl}}/site/matter/list
POST {{baseUrl}}/site/matter/interlist
Content-Type: application/json
{
"siteId": 1,
"hallCheckIn":1
"deptId": 987
}
......
......@@ -146,7 +146,7 @@ POST {{baseUrl}}/site/syncGovMatterBySiteId
Content-Type: application/json
{
"id":50
"id":6
}
......
......@@ -278,3 +278,14 @@ Content-Type: application/json
{"copySiteId":11,"targetSiteId": 50,"areaCode": "511523000000"}
###保存站点事项与主题事项
POST {{baseUrl}}/test/saveSiteMattersTwo
Content-Type: application/json
{"copySiteId":11,"targetSiteId": 50}
###更新服务ip
GET {{baseUrl}}/param/updateServerIp?serverIp=192.168.0.98
Content-Type: application/json
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