Commit dadacf10 authored by 王启林's avatar 王启林
parents 4c1bbc2e b455a3bc
......@@ -3,4 +3,4 @@ NODE_ENV = production
VUE_APP_API_BASE_URL=/basics_api
VUE_APP_API_portal_URL=/portal_home
VUE_APP_API_IMG_URL =
VUE_APP_API_IMG_URL = ""
......@@ -2,4 +2,4 @@
NODE_ENV = "test"
VUE_APP_API_BASE_URL=/basics_api
VUE_APP_API_portal_URL=/portal_home
VUE_APP_API_IMG_URL =
\ No newline at end of file
VUE_APP_API_IMG_URL = ""
\ No newline at end of file
#宜宾环境
NODE_ENV = "production"
VUE_APP_API_BASE_URL=/basics_api
VUE_APP_API_portal_URL=/portal_home
\ No newline at end of file
VUE_APP_API_portal_URL=/portal_home
VUE_APP_API_IMG_URL = ""
\ No newline at end of file
......@@ -16,12 +16,8 @@
class="select-department"
placeholder="事项来源"
>
<a-select-option :value="0">
一体化添加
</a-select-option>
<a-select-option :value="1">
手动添加
</a-select-option>
<a-select-option :value="0"> 一体化添加 </a-select-option>
<a-select-option :value="1"> 手动添加 </a-select-option>
</a-select>
<a-input-search
v-model="searchLeftVal"
......@@ -86,7 +82,7 @@
<span v-else-if="text.onlineToTheSceneNum">{{
text.onlineToTheSceneNum
}}</span>
<span v-else>--</span>
<span v-else>0</span>
</template>
<!-- 操作 -->
<template slot="action" slot-scope="text">
......@@ -95,7 +91,7 @@
href="javascript:;"
v-if="text.source == 1"
class="edit"
@click="handleEdit(text.matterId)"
@click="handleSiteEdit(text)"
>编辑</a
>
<a
......@@ -127,12 +123,8 @@
class="select-department"
placeholder="事项来源"
>
<a-select-option :value="0">
一体化事项
</a-select-option>
<a-select-option :value="1">
自建事项
</a-select-option>
<a-select-option :value="0"> 一体化事项 </a-select-option>
<a-select-option :value="1"> 自建事项 </a-select-option>
</a-select>
<a-input-search
v-model="searchRightVal"
......@@ -213,6 +205,12 @@
</a-table>
</div>
</div>
<!-- 编辑站点事项 -->
<EditSiteMatter
ref="EditSiteMatter"
:formVisible.sync="formVisible"
@editSuccess="getMatterSiteData"
></EditSiteMatter>
</div>
</template>
......@@ -225,6 +223,7 @@ import {
delMatter,
} from "@/services/matter";
import { getBusinessMatterList, delBusinessMatter } from "@/services/business";
import EditSiteMatter from "../group/EditSiteMatter.vue";
// import { getDeptList } from "@/services/dept";
import local from "@/utils/local";
import { mapMutations } from "vuex";
......@@ -295,6 +294,9 @@ const rightColumns = [
];
export default {
components: {
EditSiteMatter,
},
data() {
return {
leftColumns,
......@@ -323,6 +325,7 @@ export default {
onlineToTheSceneNum: "", // 网办到现场次数
searchLeftVal: "", // 站点事项搜索
searchRightVal: "", // 一体化事项搜索
formVisible: false,
};
},
created() {
......@@ -559,7 +562,7 @@ export default {
}
}
},
// 编辑
// 编辑基础事项
handleEdit(matterId) {
this.$router.push({
path: "/business/synopsis",
......@@ -569,6 +572,12 @@ export default {
},
});
},
// 编辑站点事项
handleSiteEdit(row) {
this.formVisible = true;
this.$refs.EditSiteMatter.onEdit(row);
console.log(row);
},
},
};
</script>
......
<template>
<a-modal
title="编辑站点事项"
@ok="handleOk"
:visible="Visible"
@cancel="handleClose"
:maskClosable="false"
destroyOnClose
>
<a-form-model
:model="form"
:label-col="labelCol"
:wrapper-col="wrapperCol"
ref="formData"
:rules="rules"
>
<a-form-model-item label="部门名称" prop="matterName">
<a-input v-model="form.matterName" placeholder="请输入事项名称" />
</a-form-model-item>
<a-form-model-item label="所属部门" prop="deptId">
<a-select
showSearch
v-model="curDpt"
optionFilterProp="label"
placeholder="请选择部门"
labelInValue
@change="changeDpt"
>
<a-select-option
v-for="v in deptData"
:key="v.id"
:value="v.id"
:label="v.name"
>
{{ v.name }}</a-select-option
>
</a-select>
</a-form-model-item>
</a-form-model>
</a-modal>
</template>
<script>
import local from "@/utils/local";
import { getDeptList } from "@/services/dept";
import { addSitematter } from "@/services/matter";
export default {
data() {
return {
labelCol: { span: 4 },
wrapperCol: { span: 20 },
siteId: local.getLocal("siteId"),
curDpt: undefined, // 选中部门
deptData: [],
form: {
matterName: "",
deptName: "",
deptId: "",
},
rules: {
matterName: [
{ required: true, message: "请输入事项名称", trigger: "blur" },
],
deptId: [{ required: true, message: "请选择部门", trigger: "change" }],
},
};
},
props: {
formVisible: {
type: Boolean,
default: false,
},
},
computed: {
Visible: {
get() {
return this.formVisible;
},
set(val) {
this.$emit("update:formVisible", val);
},
},
},
created() {
this.getDeptListData();
},
methods: {
// 获取部门列表
async getDeptListData() {
let res = await getDeptList({ siteId: this.siteId, page: 1, size: -1 });
let { code, data } = res.data;
if (code === 1) {
this.deptData = data.data;
}
},
// 切换部门
changeDpt(info) {
this.form.deptId = info.key;
this.form.deptName = info.label;
},
// 编辑
onEdit(data) {
this.form = { ...data };
this.curDpt = {
key: this.form.deptId,
label: this.form.deptName,
};
},
// 保存
handleOk() {
this.$refs.formData.validate(async (valid) => {
if (valid) {
let res = await addSitematter(this.form);
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.$emit("editSuccess");
this.handleClose();
}
}
});
},
// 关闭
handleClose() {
this.$refs.formData.resetFields();
this.Visible = false;
},
},
};
</script>
<style lang="less" scoped>
.ant-form-item {
margin-bottom: 15px;
}
/deep/.ant-form-explain {
position: absolute;
}
</style>
\ No newline at end of file
......@@ -37,7 +37,7 @@
<a-select-option
v-for="v in deptList"
:key="v.id"
:value="v.deptNumber"
:value="v.id"
:label="v.name"
>
{{ v.name }}</a-select-option
......@@ -259,12 +259,7 @@ export default {
},
},
},
created() {
// this.$bus.$off("addDept");
// this.$bus.$on("addDept", () => {
// this.getSiteDeptList();
// });
},
created() {},
methods: {
// 部门下拉选项
handleChange(val, event) {
......
......@@ -376,12 +376,28 @@ export default {
this.$refs.addsite.onEdit(data);
},
// 同步数据
async handleSync(id) {
let res = await SyncSiteData({ id });
let { code, msg } = res.data;
if (code == 1) {
this.$message.success(msg);
}
handleSync(id) {
let _this = this;
this.$confirm({
title: "系统提示",
content: "确定要同步更新站点数据吗?",
okText: "确定",
okType: "primary",
cancelText: "取消",
centered: true,
maskClosable: true,
icon: "question",
async onOk() {
let res = await SyncSiteData({ id });
let { code, msg } = res.data;
if (code == 1) {
_this.$message.success(msg);
}
},
onCancel() {
console.log("Cancel");
},
});
},
},
};
......
......@@ -3,12 +3,15 @@ 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 org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.DispatcherType;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
......@@ -17,8 +20,8 @@ import java.util.Map;
*
* @author zxfei
*/
//@Configuration
public class FilterConfig {
@Configuration
public class FilterConfig {
@Value("${xss.enabled}")
private String enabled;
......@@ -45,7 +48,7 @@ public class FilterConfig {
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Bean
/* @Bean
public FilterRegistrationBean someFilterRegistration() {
FilterRegistrationBean registration = new FilterRegistrationBean();
registration.setFilter(new RepeatableFilter());
......@@ -53,6 +56,33 @@ public class FilterConfig {
registration.setName("repeatableFilter");
registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE);
return registration;
}*/
@Bean
public FilterRegistrationBean requestReplaceFilterRegistration() {
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
registrationBean.setFilter(new RequestReplaceFilter());
registrationBean.addUrlPatterns("/*");
registrationBean.setName("RequestReplaceFilter");
registrationBean.setOrder(1);
return registrationBean;
}
public static class RequestReplaceFilter implements Filter {
@Override
public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {
}
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
filterChain.doFilter(new RepeatReadHttpRequest((HttpServletRequest) servletRequest), servletResponse);
}
}
}
......@@ -6,53 +6,45 @@ import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*
* 请求过滤链
*
* @author: zxfei
* @date: 2022/4/20 14:52
*/
//@Component
//@WebFilter(urlPatterns = "/*")
@Slf4j
public class RequestFilter extends OncePerRequestFilter implements Filter {
public class RequestFilter implements Filter {
private static final String FORM_CONTENT_TYPE = "multipart/form-data";
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
try {
request = new ContentCachingRequestWrapper(request);
filterChain.doFilter(request, response);
} catch (Exception e) {
throw e;
} finally {
//清理ThreadLocal
MDC.clear();
}
public void init(FilterConfig filterConfig) {
}
/*private void setUsername(HttpServletRequest request) {
//通过token解析出username
String token = authTokenService.getToken(request);
//String token = request.getHeader("token");
if (!ObjectUtils.isEmpty(token)) {
MDC.put("token",token);
MDC.put("token", token);
try {
SessionUserInfo info = tokenService.getUserInfo();
if (info != null) {
String username = info.getUsername();
MDC.put("username", username);
}
} catch (CommonJsonException e) {
log.info("无效的token:{}", token);
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
String contentType = request.getContentType();
if (request instanceof HttpServletRequest) {
HttpServletRequest requestWrapper = new ContentCachingRequestWrapper((HttpServletRequest) request);
// #1
if (contentType != null && contentType.contains(FORM_CONTENT_TYPE)) {
chain.doFilter(request, response);
} else {
chain.doFilter(requestWrapper, response);
}
return;
}
}*/
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
}
......@@ -9,9 +9,19 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.model.vo.MatterInfo;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.window.model.*;
import com.mortals.xhx.module.window.service.WindowBusinessService;
import com.mortals.xhx.module.window.service.WindowMatterService;
import com.mortals.xhx.module.window.service.WindowService;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
......@@ -30,6 +40,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -47,6 +58,16 @@ import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
@Slf4j
public class DemoWebApiController {
@Autowired
private WindowService windowService;
@Autowired
private SiteMatterService siteMatterService;
@Autowired
private WindowMatterService windowMatterService;
@Autowired
private DeptService deptService;
@PostMapping(value = "testGov")
@UnAuth
public Rest<String> testGov(@RequestBody MatterQuery query) {
......@@ -83,6 +104,64 @@ public class DemoWebApiController {
}
@PostMapping(value = "reDepts")
@UnAuth
public Rest<String> reDepts() {
log.info("更新部门与设备关联");
//更新窗口部门
List<WindowEntity> windowEntities = windowService.find(new WindowQuery());
for (WindowEntity windowEntity : windowEntities) {
String deptName = windowEntity.getDeptName();
//根据部门名称查询部门
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(deptName+"%"));
if (!ObjectUtils.isEmpty(deptEntity)) {
if (deptEntity.getId() != windowEntity.getDeptId()&&deptEntity.getName().trim().equals(windowEntity.getDeptName().trim())) {
log.info("部门:{},更新部门id:orgin deptId:{} ,updateDeptId:{}", deptName, windowEntity.getDeptId(), deptEntity.getId());
WindowEntity temp = new WindowEntity();
temp.setId(windowEntity.getId());
temp.setDeptId(deptEntity.getId());
windowService.getDao().update(temp);
// windowService.update(windowEntity);
}
}
}
//更新窗口事项中的部门id
List<WindowMatterEntity> windowMatterEntities = windowMatterService.find(new WindowMatterQuery());
for (WindowMatterEntity windowMatterEntity : windowMatterEntities) {
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(windowMatterEntity.getDeptName()+"%"));
if (!ObjectUtils.isEmpty(deptEntity)) {
if (deptEntity.getId() != windowMatterEntity.getDeptId()&&windowMatterEntity.getDeptName().trim().equals(deptEntity.getName())) {
WindowMatterEntity temp = new WindowMatterEntity();
temp.setId(windowMatterEntity.getId());
temp.setDeptId(deptEntity.getId());
temp.setDeptCode(deptEntity.getDeptNumber());
windowMatterService.getDao().update(temp);
// windowMatterService.update(windowMatterEntity);
}
}
}
List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(new SiteMatterQuery());
for (SiteMatterEntity siteMatterEntity : siteMatterEntities) {
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().name(siteMatterEntity.getDeptName()+"%"));
if (!ObjectUtils.isEmpty(deptEntity)) {
if (deptEntity.getId() != siteMatterEntity.getDeptId()&&siteMatterEntity.getDeptName().trim().equals(deptEntity.getName().trim())) {
SiteMatterEntity temp = new SiteMatterEntity();
temp.setId(siteMatterEntity.getId());
temp.setDeptId(deptEntity.getId());
temp.setDeptCode(deptEntity.getDeptNumber());
siteMatterService.getDao().update(temp);
//siteMatterService.update(siteMatterEntity);
}
}
}
return Rest.ok();
}
public static void main(String[] args) {
HttpClient http = null;
CookieStore httpCookieStore = new BasicCookieStore();
......@@ -96,9 +175,9 @@ public class DemoWebApiController {
byte[] data = EntityUtils.toByteArray(httpResponse.getEntity());
String encode = Base64.encode(data);
log.info("encode64:{}",encode);
log.info("encode64:{}", encode);
// String resp = com.mortals.framework.util.HttpUtil.processMultipartResponse(httpResponse);
// log.info("resp:{}", resp);
// log.info("resp:{}", resp);
//String content = EntityUtils.toString(entity, charset);
//httpResponse.getEntity()
//httpResponse.toString()
......@@ -107,7 +186,7 @@ public class DemoWebApiController {
}
/* check cookies */
String cookieStr = Arrays.asList(httpCookieStore.getCookies()).stream().map(item -> JSON.toJSONString(item)).collect(Collectors.joining("|"));
// log.info("cookies:{}", cookieStr);
// log.info("cookies:{}", cookieStr);
}
......
......@@ -65,7 +65,6 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService,
List<AppEntity> appEntityList = this.service.find(new AppQuery().appCode(entity.getAppCode()), context);
entity.setApplianceSiteScope(appEntityList.size());
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
......
......@@ -49,9 +49,6 @@ import static com.mortals.xhx.common.key.Constant.CUSTAPP_ROOT_PATH;
@RequestMapping("app/version")
public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppVersionService, AppVersionEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private SiteService siteService;
@Autowired
......
......@@ -69,6 +69,21 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return data.getDeptNumber();
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void validData(DeptEntity entity, Context context) throws AppException {
super.validData(entity, context);
//校验部门编码是否重复
DeptEntity extCache = this.getExtCache(entity.getDeptNumber());
if (!ObjectUtils.isEmpty(extCache) && SourceEnum.自定义.getValue() == entity.getSource()) {
throw new AppException("部门编码重复!deptCode:" + extCache.getDeptNumber());
}
}
@Override
public void syncDept(String areaCode, Context context) {
List<MattersDeptEntity> deptList = mattersDeptService.find(new MattersDeptQuery());
......@@ -96,22 +111,21 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
public Rest<String> syncDeptBySiteId(SiteEntity siteEntity, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_DEPT_URL, "http://www.sczwfw.gov.cn/jiq/front/channel/deptSwitch");
Long siteId = siteEntity.getId();
String areaCode = siteEntity.getAreaCode();
Map<String, String> params = new HashMap<>();
params.put("areaCode", areaCode);
Rest<Map<String, String>> rest = MatterHtmlParseUtil.syncDeptBySiteId(params, url);
if (rest.getCode() == YesNoEnum.YES.getValue() && rest.getData().keySet().size() > 0) {
//删除部门中属于政务部门的
deptService.deleteGovBySiteId(siteId, context);
// deptService.deleteGovBySiteId(siteId, context);
int sortN = 1;
Map<String, String> data = rest.getData();
for (Map.Entry<String, String> item : data.entrySet()) {
String deptCode = item.getKey();
String deptName = item.getValue();
int count = deptService.count(new DeptQuery().siteId(siteId).deptNumber(deptCode), context);
if (count == 0) {
DeptEntity deptEntity = new DeptEntity();
DeptEntity deptEntity = deptService.selectOne(new DeptQuery().siteId(siteId).deptNumber(deptCode), context);
if (ObjectUtils.isEmpty(deptEntity)) {
deptEntity = new DeptEntity();
deptEntity.initAttrValue();
deptEntity.setDeptNumber(deptCode);
deptEntity.setSiteId(siteId);
......@@ -121,6 +135,13 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
deptEntity.setCreateTime(new Date());
deptEntity.setCreateUserId(1L);
deptService.save(deptEntity, context);
} else {
//更新
deptEntity.setName(deptName);
deptEntity.setSource(SourceEnum.政务网.getValue());
deptEntity.setUpdateTime(new Date());
deptEntity.setUpdateUserId(1L);
deptService.update(deptEntity, context);
}
sortN++;
}
......@@ -136,7 +157,7 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
List<DeptVo> businessDeptList = this.dao.getBusinessByDept(deptQuery);
Map<String, List<DeptVo>> collect = businessDeptList.parallelStream().collect(Collectors.groupingBy(x -> x.getId().toString()));
return Rest.ok(collect);
return Rest.ok(collect);
/* //查询部门窗口
......
......@@ -150,4 +150,6 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
}
}
\ No newline at end of file
......@@ -36,6 +36,8 @@ import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.site.service.SiteThemeMatterService;
import com.mortals.xhx.module.site.service.SiteThemeService;
import com.mortals.xhx.module.window.model.WindowMatterQuery;
import com.mortals.xhx.module.window.service.WindowMatterService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsoup.Jsoup;
......@@ -92,6 +94,8 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
private SiteThemeMatterService siteThemeMatterService;
@Autowired
private SiteThemeService siteThemeService;
@Autowired
private WindowMatterService windowMatterService;
@Override
......@@ -102,7 +106,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
SiteEntity siteEntity = siteService.get(entity.getSiteId(), context);
entity.setAreaCode(siteEntity.getAreaCode());
DeptEntity extCache = deptService.getExtCache(entity.getDeptCode());
entity.setDeptName(extCache==null?"":extCache.getName());
entity.setDeptName(extCache == null ? "" : extCache.getName());
}
}
......@@ -143,8 +147,34 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
SiteEntity siteEntity = siteService.get(entity.getSiteId(), context);
entity.setAreaCode(siteEntity.getAreaCode());
DeptEntity extCache = deptService.getExtCache(entity.getDeptCode());
entity.setDeptName(extCache==null?"":extCache.getName());
entity.setDeptName(extCache == null ? "" : extCache.getName());
}
MatterEntity beforeMatterEntity = this.get(entity.getId(), context);
//如果部门切换了 级联修改关联的其它项
if (!ObjectUtils.isEmpty(entity.getDeptCode())) {
if (!entity.getDeptCode().equals(beforeMatterEntity.getDeptCode())) {
//更新站点事项关联项
SiteMatterQuery condition = new SiteMatterQuery();
condition.setMatterId(entity.getId());
SiteMatterQuery siteMatterQuery = new SiteMatterQuery();
DeptEntity extCache = deptService.getExtCache(entity.getDeptCode());
siteMatterQuery.setDeptId(extCache == null ? 0L : extCache.getId());
siteMatterQuery.setDeptCode(entity.getDeptCode());
siteMatterQuery.setDeptName(entity.getDeptName());
siteMatterService.updateBatch(siteMatterQuery, condition, context);
//更新站点窗口事项关联项
WindowMatterQuery winCondition = new WindowMatterQuery();
winCondition.setSiteMatterId(entity.getId());
WindowMatterQuery windowMatterQuery = new WindowMatterQuery();
windowMatterQuery.setDeptId(extCache == null ? 0L : extCache.getId());
windowMatterQuery.setDeptCode(entity.getDeptCode());
windowMatterQuery.setDeptName(entity.getDeptName());
windowMatterService.updateBatch(windowMatterQuery, winCondition, context);
}
}
}
super.updateBefore(entity, context);
}
......@@ -997,7 +1027,7 @@ public class MatterServiceImpl extends AbstractCRUDServiceImpl<MatterDao, Matter
//更新部门信息
DeptEntity extCache = deptService.getExtCache(matterEntity.getDeptCode());
matterEntity.setDeptName(extCache==null?"":extCache.getName());
matterEntity.setDeptName(extCache == null ? "" : extCache.getName());
/* if(!ObjectUtils.isEmpty(matterEntity.getDeptCode())&&ObjectUtils.isEmpty(matterEntity.getDeptName())){
DeptEntity extCache = deptService.getExtCache(matterEntity.getDeptCode());
......
package com.mortals.xhx.module.site.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.site.dao.SiteMatterDao;
import com.mortals.xhx.module.site.model.SiteMatterEntity;
/**
* SiteMatterService
*
* 站点事项 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteMatterService extends ICRUDService<SiteMatterEntity,Long>{
void deleteBysiteIdAndSource(Long siteId,Integer source, Context context);
* SiteMatterService
* <p>
* 站点事项 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface SiteMatterService extends ICRUDService<SiteMatterEntity, Long> {
SiteMatterDao getDao();
void deleteBysiteIdAndSource(Long siteId, Integer source, Context context);
}
\ No newline at end of file
......@@ -45,15 +45,43 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
@Override
protected void findAfter(SiteBusinessEntity params, PageInfo pageInfo, Context context, List<SiteBusinessEntity> list) throws AppException {
list.stream().peek(item -> {
List<SiteBusinessEntity> childs = this.find(new SiteBusinessQuery().siteId(item.getSiteId()).parentId(item.getBusinessId()));
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
buildChildBusiness(item);
}).count();
super.findAfter(params, pageInfo, context, list);
SiteBusinessQuery siteBusinessQuery = new SiteBusinessQuery();
if (!ObjectUtils.isEmpty(params.getIdNotList())) {
//排除掉已经存在的ids
Iterator<SiteBusinessEntity> iterator = list.iterator();
while (iterator.hasNext()) {
SiteBusinessEntity item = iterator.next();
siteBusinessQuery.siteId(item.getSiteId());
siteBusinessQuery.setParentId(item.getBusinessId());
int count = this.count(siteBusinessQuery, context);
if (count > 0) {
siteBusinessQuery.setIdNotList(params.getIdNotList());
List<SiteBusinessEntity> childs = this.find(siteBusinessQuery);
if (ObjectUtils.isEmpty(childs)) {
//子节点已经全部选中,删除父节点
iterator.remove();
} else {
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
buildChildBusiness(item);
}
}
}
} else {
list.stream().peek(item -> {
List<SiteBusinessEntity> childs = this.find(siteBusinessQuery.siteId(item.getSiteId()).parentId(item.getBusinessId()));
childs.stream().forEach(item1 -> {
buildChildBusiness(item1);
});
item.setChildren(childs);
buildChildBusiness(item);
}).count();
super.findAfter(params, pageInfo, context, list);
}
}
private void buildChildBusiness(SiteBusinessEntity item) {
......@@ -71,7 +99,7 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
if (businessEntity.getIsBusiness() == IsBusinessEnum.一级业务.getValue()) {
//添加二级业务列表
List<BusinessEntity> businessEntities = businessService.find(new BusinessQuery().parentId(businessEntity.getId()));
if(!ObjectUtils.isEmpty(businessEntities)){
if (!ObjectUtils.isEmpty(businessEntities)) {
item.setBusinessChildren(businessEntities);
}
}
......@@ -98,12 +126,11 @@ public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBu
.filter(item -> !item.getSiteBusinessName().equals(entity.getBusinessName()))
.peek(item -> item.setSiteBusinessName(entity.getBusinessName()))
.collect(Collectors.toList());
if(!ObjectUtils.isEmpty(businessMatterEntities)){
businessMatterService.update(businessMatterEntities,context);
if (!ObjectUtils.isEmpty(businessMatterEntities)) {
businessMatterService.update(businessMatterEntities, context);
}
super.updateAfter(entity, context);
}
......
package com.mortals.xhx.module.site.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
......@@ -17,12 +18,12 @@ import java.util.List;
import java.util.Map;
/**
* SiteMatterService
* 站点事项 service实现
*
* @author zxfei
* @date 2022-01-12
*/
* SiteMatterService
* 站点事项 service实现
*
* @author zxfei
* @date 2022-01-12
*/
@Service("siteMatterService")
public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao, SiteMatterEntity, Long> implements SiteMatterService {
......@@ -31,10 +32,10 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
@Override
protected void findAfter(SiteMatterEntity params, PageInfo pageInfo, Context context, List<SiteMatterEntity> list) throws AppException {
list.forEach(item->{
if(!ObjectUtils.isEmpty(item.getMatterId())){
list.forEach(item -> {
if (!ObjectUtils.isEmpty(item.getMatterId())) {
MatterEntity matterEntity = matterService.get(item.getMatterId());
if(!ObjectUtils.isEmpty(matterEntity)){
if (!ObjectUtils.isEmpty(matterEntity)) {
item.setBelongDept(matterEntity.getBelongDept());
item.setWindowToTheSceneNum(matterEntity.getWindowToTheSceneNum());
item.setOnlineToTheSceneNum(matterEntity.getOnlineToTheSceneNum());
......@@ -45,6 +46,26 @@ public class SiteMatterServiceImpl extends AbstractCRUDServiceImpl<SiteMatterDao
super.findAfter(params, pageInfo, context, list);
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void updateBefore(SiteMatterEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
SiteMatterEntity beforeSiteMatterEntity = this.get(entity.getId(), context);
if (!ObjectUtils.isEmpty(beforeSiteMatterEntity.getDeptId())&&!beforeSiteMatterEntity.getDeptId().equals(entity.getDeptId())) {
//更新事项中的部门编号
MatterEntity matterEntity = matterService.get(entity.getMatterId(), context);
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDeptCode(entity.getDeptCode());
matterEntity.setDeptName(entity.getDeptName());
matterService.update(matterEntity, context);
}
}
}
@Override
public void deleteBysiteIdAndSource(Long siteId, Integer source, Context context) {
Map<String, Object> condition = new HashMap<>();
......
......@@ -368,8 +368,16 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
private List<SiteTreeSelect> getSiteTreeSelects(String userId) {
String siteTreeSelectStr = cacheService.hget(USER_SITE_TREE, userId, String.class);
log.info("userId:{},siteTreeSelectStr:{}",userId,siteTreeSelectStr);
//反序列化树对象
if(ObjectUtils.isEmpty(siteTreeSelectStr)){
return new ArrayList<>();
}
JSONArray jsonArray = JSON.parseArray(siteTreeSelectStr);
if(ObjectUtils.isEmpty(jsonArray)){
return new ArrayList<>();
}
List<SiteTreeSelect> collect = jsonArray.stream().map(item -> {
SiteTreeSelect siteTreeSelect = JSON.parseObject(item.toString(), SiteTreeSelect.class);
return siteTreeSelect;
......
......@@ -22,6 +22,17 @@ import java.util.stream.Collectors;
@Service("smsSetService")
public class SmsSetServiceImpl extends AbstractCRUDCacheServiceImpl<SmsSetDao, SmsSetEntity, Long> implements SmsSetService {
/**
* @param key
* @param data
*/
@Override
public void putCache(String key, SmsSetEntity data) {
key=data.getSiteId().toString();
super.putCache(key, data);
}
@Override
public List<SmsSetEntity> find(SmsSetEntity entity) throws AppException {
List<SmsSetEntity> cacheList = this.getCacheList();
......
package com.mortals.xhx.module.window.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.window.dao.WindowMatterDao;
import com.mortals.xhx.module.window.model.WindowMatterEntity;
/**
* WindowMatterService
*
* 窗口事项 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface WindowMatterService extends ICRUDService<WindowMatterEntity,Long>{
* WindowMatterService
* <p>
* 窗口事项 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface WindowMatterService extends ICRUDService<WindowMatterEntity, Long> {
WindowMatterDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.window.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.window.dao.WindowDao;
import com.mortals.xhx.module.window.model.WindowEntity;
/**
* WindowService
*
* 站点部门窗口 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface WindowService extends ICRUDCacheService<WindowEntity,Long> {
* WindowService
* <p>
* 站点部门窗口 service接口
*
* @author zxfei
* @date 2022-01-12
*/
public interface WindowService extends ICRUDCacheService<WindowEntity, Long> {
WindowDao getDao();
/**
* 添加业务到窗口
*
* @param businessIds
* @param windowId
* @param context
......@@ -23,5 +29,4 @@ public interface WindowService extends ICRUDCacheService<WindowEntity,Long> {
void addBusinessToWindow(String businessIds, Long windowId, Context context);
}
\ No newline at end of file
......@@ -6,13 +6,19 @@ import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.window.model.WindowMatterQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.window.dao.WindowMatterDao;
import com.mortals.xhx.module.window.model.WindowMatterEntity;
import com.mortals.xhx.module.window.service.WindowMatterService;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.HashMap;
......@@ -31,6 +37,29 @@ import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_HTTP_URL;
@Service("windowMatterService")
@Slf4j
public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatterDao, WindowMatterEntity, Long> implements WindowMatterService {
@Autowired
private MatterService matterService;
@Autowired
private DeptService deptService;
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void saveBefore(WindowMatterEntity entity, Context context) throws AppException {
super.saveBefore(entity, context);
if (!ObjectUtils.isEmpty(entity.getDeptId())) {
DeptEntity cache = deptService.getCache(entity.getDeptId().toString());
if (ObjectUtils.isEmpty(entity.getDeptCode())) {
entity.setDeptCode(cache == null ? "" : cache.getDeptNumber());
}
}
}
/**
* @param entity
* @param context
......@@ -49,9 +78,9 @@ public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatte
*/
@Override
protected void removeBefore(Long id, Context context) throws AppException {
super.removeBefore(id, context);
WindowMatterEntity windowMatterEntity = this.get(id, context);
pushChangeMsg(windowMatterEntity);
super.removeBefore(id, context);
}
/**
......@@ -61,11 +90,11 @@ public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatte
*/
@Override
protected void removeBefore(Long[] ids, Context context) throws AppException {
super.removeBefore(ids, context);
Arrays.asList(ids).forEach(id -> {
WindowMatterEntity windowMatterEntity = this.get(id, context);
pushChangeMsg(windowMatterEntity);
});
super.removeBefore(ids, context);
}
/**
......@@ -90,6 +119,27 @@ public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatte
}
/**
* @param entity
* @param context
* @throws AppException
*/
@Override
protected void updateBefore(WindowMatterEntity entity, Context context) throws AppException {
super.updateBefore(entity, context);
WindowMatterEntity beforeWindowMatterEntity = this.get(entity.getId(), context);
if (!ObjectUtils.isEmpty(beforeWindowMatterEntity.getDeptCode()) && !beforeWindowMatterEntity.getDeptCode().equals(entity.getDeptCode())) {
//更新
MatterEntity matterEntity = matterService.get(entity.getSiteMatterId());
if (!ObjectUtils.isEmpty(matterEntity)) {
matterEntity.setDeptCode(entity.getDeptCode());
matterEntity.setDeptName(entity.getDeptName());
matterService.update(matterEntity, context);
}
}
}
/**
* @param entity
* @param context
......@@ -97,8 +147,8 @@ public class WindowMatterServiceImpl extends AbstractCRUDServiceImpl<WindowMatte
*/
@Override
protected void updateAfter(WindowMatterEntity entity, Context context) throws AppException {
pushChangeMsg(entity);
super.updateAfter(entity, context);
pushChangeMsg(entity);
}
private void pushChangeMsg(WindowMatterEntity entity) {
......
......@@ -91,8 +91,11 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
if (ObjectUtils.isEmpty(windowId)) {
throw new AppException("请选择对应窗口");
}
List<Long> businessIdList = Arrays.asList(businessIds.split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
WindowBusinessQuery windowBusinessQuery = new WindowBusinessQuery();
List<Long> businessIdList =new ArrayList<>();
if(!ObjectUtils.isEmpty(businessIds)){
businessIdList = Arrays.asList(businessIds.split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
}
WindowBusinessQuery windowBusinessQuery = new WindowBusinessQuery();
//windowBusinessQuery.setSiteBusinessIdList(businessIdList);
//先删除后再新增
......@@ -104,7 +107,6 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
}
WindowEntity windowEntity = this.get(windowId, context);
List<WindowBusinessEntity> windowBusinessEntities = businessIdList.stream().map(id -> {
WindowBusinessEntity windowBusinessEntity = new WindowBusinessEntity();
windowBusinessEntity.initAttrValue();
......@@ -122,7 +124,7 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
return null;
}
return windowBusinessEntity;
}).collect(Collectors.toList());
}).filter(f->f!=null).collect(Collectors.toList());
windowBusinessService.save(windowBusinessEntities, context);
}
......
......@@ -69,8 +69,8 @@
<appender-ref ref="fileError"/>
</logger>
<!-- <logger name="com.mortals.xhx.module">
<logger name="com.mortals.xhx.module">
<level value="debug"/>
</logger>-->
</logger>
</configuration>
\ No newline at end of file
......@@ -26,8 +26,8 @@
<if test="condition.matterName != null and condition.matterName != ''">
and a.matterName like #{condition.matterName}
</if>
<if test="condition.source!=null and condition.source!=''">
and a.source = #{condition.source,jdbcType=VARCHAR}
<if test="condition.source!=null">
and a.source = #{condition.source,jdbcType=INTEGER}
</if>
</trim>
</trim>
......@@ -58,8 +58,8 @@
<if test="condition.matterName != null and condition.matterName != ''">
and a.matterName like #{condition.matterName}
</if>
<if test="condition.source!=null and condition.source!=''">
and a.source = #{condition.source,jdbcType=VARCHAR}
<if test="condition.source!=null">
and a.source = #{condition.source,jdbcType=INTEGER}
</if>
</trim>
</trim>
......
......@@ -62,9 +62,10 @@ POST {{baseUrl}}/dept/getDeptListByBusiness
Content-Type: application/json
{
"siteBusinessIdList":[9]
"siteBusinessIdList":[12]
}
......@@ -43,8 +43,8 @@ Content-Type: application/json
{
"siteId": 54,
"matterName": "",
"siteId": 1,
"source": 0,
"page": 1,
"size": 10
}
......
......@@ -4,10 +4,10 @@ POST {{baseUrl}}/site/business/list
Content-Type: application/json
{
"idNotList": [11,12],
"siteId": 1,
"idNotList": [11,12,17,18,19,20],
"siteId": 1,
"page":1,
"size":10
"size":5
}
###站点业务列表
......
......@@ -71,6 +71,14 @@ Content-Type: application/json
}
###testre
POST {{baseUrl}}/test/reDepts
Content-Type: application/json
{}
###短信设置编辑
GET {{baseUrl}}/sms/set/edit?id={{SmsSet_id}}
Accept: application/json
......
......@@ -116,7 +116,7 @@
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<package.environment>yibin</package.environment>
<skipUi>false</skipUi>
<skipUi>true</skipUi>
</properties>
</profile>
......
......@@ -249,7 +249,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
String originalResponseContentType = exchange.getAttribute(ServerWebExchangeUtils.ORIGINAL_RESPONSE_CONTENT_TYPE_ATTR);
if (ObjectUtil.equal(this.getStatusCode(), HttpStatus.OK)
&& StringUtils.isNotBlank(originalResponseContentType)) {
accessLogPdu.setRequestData(JSON.toJSONString(Rest.ok()));
accessLogPdu.setResponseData(JSON.toJSONString(Rest.ok()));
/* Flux<? extends DataBuffer> fluxBody = Flux.from(body);
return super.writeWith(fluxBody.buffer().map(dataBuffers -> {
// 合并多个流集合,解决返回体分段传输
......@@ -265,7 +265,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
return bufferFactory.wrap(content);
}));*/
}else {
accessLogPdu.setRequestData(JSON.toJSONString(Rest.fail()));
accessLogPdu.setResponseData(JSON.toJSONString(Rest.fail()));
}
}
// if body is not a flux. never got there.
......
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