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