Commit 153cf177 authored by 赵啸非's avatar 赵啸非

添加站点更新日志

parent 31a2585b
......@@ -12,6 +12,7 @@ import com.mortals.xhx.common.code.IsBusinessEnum;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.business.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -21,31 +22,30 @@ import java.util.HashMap;
import java.util.Map;
/**
*
* 站点业务
*
* @author zxfei
* @date 2022-01-13
*/
* 站点业务
*
* @author zxfei
* @date 2022-01-13
*/
@RestController
@RequestMapping("business")
public class BusinessController extends BaseCRUDJsonBodyMappingController<BusinessService,BusinessEntity,Long> {
public class BusinessController extends BaseCRUDJsonBodyMappingController<BusinessService, BusinessEntity, Long> {
@Autowired
private ParamService paramService;
public BusinessController(){
super.setModuleDesc( "站点业务");
public BusinessController() {
super.setModuleDesc("站点业务");
}
@Override
protected void init( Map<String, Object> model, Context context) {
this.addDict(model, "isBusiness", paramService.getParamBySecondOrganize("Business","isBusiness"));
this.addDict(model, "canorder", paramService.getParamBySecondOrganize("Business","canorder"));
this.addDict(model, "cantake", paramService.getParamBySecondOrganize("Business","cantake"));
this.addDict(model, "datashow", paramService.getParamBySecondOrganize("Business","datashow"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Business","status"));
this.addDict(model, "businessType", paramService.getParamBySecondOrganize("Business","businessType"));
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "isBusiness", paramService.getParamBySecondOrganize("Business", "isBusiness"));
this.addDict(model, "canorder", paramService.getParamBySecondOrganize("Business", "canorder"));
this.addDict(model, "cantake", paramService.getParamBySecondOrganize("Business", "cantake"));
this.addDict(model, "datashow", paramService.getParamBySecondOrganize("Business", "datashow"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Business", "status"));
this.addDict(model, "businessType", paramService.getParamBySecondOrganize("Business", "businessType"));
super.init(model, context);
}
......@@ -63,10 +63,10 @@ public class BusinessController extends BaseCRUDJsonBodyMappingController<Busine
public String addBusinessToSite(@RequestBody Map<String, Object> map) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String businessIds=(String)map.get("businessIds");
Long siteId= DataUtil.converObj2Long(map.get("siteId"));
String businessIds = (String) map.get("businessIds");
Long siteId = DataUtil.converObj2Long(map.get("siteId"));
try {
this.service.addBusinessToSite(businessIds,siteId,getContext());
this.service.addBusinessToSite(businessIds, siteId, getContext());
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "添加业务到站点成功!");
......@@ -79,7 +79,6 @@ public class BusinessController extends BaseCRUDJsonBodyMappingController<Busine
}
/**
* 查询业务扁平结构
*/
......@@ -93,7 +92,9 @@ public class BusinessController extends BaseCRUDJsonBodyMappingController<Busine
Result<BusinessEntity> result = this.service.flatList(query, pageInfo, getContext());
model.put(KEY_RESULT_DATA, result.getList());
parsePageInfo(model, result.getPageInfo());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点列表成功!");
......
......@@ -55,17 +55,17 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
@Override
protected void doListBefore(DeptEntity query, Map<String, Object> model, Context context) throws AppException {
if(ObjectUtils.isEmpty(query.getOrderColList())){
if (ObjectUtils.isEmpty(query.getOrderColList())) {
query.setOrderColList(new ArrayList<OrderCol>() {
{
add(new OrderCol("a.sort", OrderCol.ASCENDING));
add(new OrderCol("a.createTime", OrderCol.DESCENDING));
}
});
}else {
} else {
query.getOrderColList().add(new OrderCol("a.createTime", OrderCol.DESCENDING));
}
if(!ObjectUtils.isEmpty(query.getFilter())&& YesNoEnum.YES.getValue()==query.getFilter()){
if (!ObjectUtils.isEmpty(query.getFilter()) && YesNoEnum.YES.getValue() == query.getFilter()) {
//过滤部门事项数据为0的部门
query.setTotalStart(1);
}
......@@ -121,7 +121,9 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
throw new AppException("参数部门ids不能为空!");
}
Rest<Map<String, List<DeptVo>>> rest = this.service.getBusinessByDept(deptQuery, getContext());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, rest.getData());
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
......@@ -147,7 +149,9 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
throw new AppException("业务id不能为空!");
}
Rest<Map<String, List<DeptVo>>> rest = this.service.getDeptListByBusiness(deptQuery, getContext());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, rest.getData());
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
......@@ -173,7 +177,7 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
// throw new AppException("部门编码已存在!");
// }
if(entity.newEntity()){
if (entity.newEntity()) {
entity.setSource(SourceEnum.自定义.getValue());
}
......
......@@ -63,7 +63,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
*/
@Override
protected void doListBefore(MatterEntity query, Map<String, Object> model, Context context) throws AppException {
if(ObjectUtils.isEmpty(query.getEventTypeShowNotList())){
if (ObjectUtils.isEmpty(query.getEventTypeShowNotList())) {
ArrayList<String> notList = new ArrayList<>();
notList.add("行政处罚");
query.setEventTypeShowNotList(notList);
......@@ -148,7 +148,9 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
jsonObject.put(KEY_RESULT_MSG, rest.getMsg());
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
this.recordSysLog(this.request, rest.getMsg());
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
this.recordSysLog(this.request, rest.getMsg());
}
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
......@@ -165,7 +167,7 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "查询差集" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
int code = VALUE_RESULT_SUCCESS;
try {
PageInfo pageInfo = buildPageInfo(query);
Result<MatterEntity> result = this.getService().findSubList(query, pageInfo, context);
......@@ -173,7 +175,9 @@ public class MatterController extends BaseCRUDJsonBodyMappingController<MatterSe
model.put(PAGEINFO_KEY, result.getPageInfo());
parsePageInfo(model, result.getPageInfo());
model.put(MESSAGE_INFO, busiDesc + "成功");
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
......
......@@ -15,6 +15,7 @@ import com.mortals.xhx.module.site.model.SiteBusinessTreeSelect;
import com.mortals.xhx.module.site.service.SiteBusinessService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -119,7 +120,9 @@ public class SiteBusinessController extends BaseCRUDJsonBodyMappingController<Si
Result<SiteBusinessEntity> result = this.service.flatList(query, pageInfo, getContext());
model.put(KEY_RESULT_DATA, result.getList());
parsePageInfo(model, result.getPageInfo());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点业务列表成功!");
......
......@@ -105,7 +105,9 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
}
model.put("siteTree", siteTree);
this.init(model, getContext());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) {
......@@ -134,7 +136,9 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
List<SiteTreeSelect> siteTree = this.service.getSiteTree(context);
model.put("siteTree", siteTree);
this.init(model, getContext());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) {
......@@ -155,11 +159,11 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
String busiDesc = "根据区域编码查询站点列表" + this.getModuleDesc();
try {
if (!ObjectUtils.isEmpty(site.getSiteName())) {
// SiteEntity siteEntity = this.service.selectOne(new SiteQuery().siteName(site.getSiteName()));
// SiteEntity siteEntity = this.service.selectOne(new SiteQuery().siteName(site.getSiteName()));
List<SiteEntity> siteEntities = this.service.find(new SiteQuery().siteName(site.getSiteName()));
if (!ObjectUtils.isEmpty(siteEntities)) {
site.setAreaCodeList(siteEntities.stream().map(i->i.getAreaCode()).collect(Collectors.toList()));
site.setAreaCodeList(siteEntities.stream().map(i -> i.getAreaCode()).collect(Collectors.toList()));
}
/* if (!ObjectUtils.isEmpty(siteEntity)) {
......@@ -170,25 +174,26 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
//AreaEntity areaEntity = areaService.selectOne(new AreaQuery().name(site.getAreaName()));
List<AreaEntity> areaEntities = areaService.find(new AreaQuery().name(site.getAreaName()));
if (!ObjectUtils.isEmpty(areaEntities)) {
// site.setAreaCode(areaEntity.getAreaCode());
site.setAreaCodeList(areaEntities.stream().map(i->i.getAreaCode()).collect(Collectors.toList()));
// site.setAreaCode(areaEntity.getAreaCode());
site.setAreaCodeList(areaEntities.stream().map(i -> i.getAreaCode()).collect(Collectors.toList()));
}
}
if(ObjectUtils.isEmpty(site.getAreaCodeList())){
if (ObjectUtils.isEmpty(site.getAreaCodeList())) {
site.setAreaCodeList(Arrays.asList(site.getAreaCode()));
}
List<SiteEntity> siteEntityList =site.getAreaCodeList().stream().flatMap(areaCode->{
return this.service.getFlatSitesByAreaCode(areaCode, getContext()).stream();
List<SiteEntity> siteEntityList = site.getAreaCodeList().stream().flatMap(areaCode -> {
return this.service.getFlatSitesByAreaCode(areaCode, getContext()).stream();
}).distinct().collect(Collectors.toList());
//List<SiteEntity> siteEntityList = this.service.getFlatSitesByAreaCode(site.getAreaCode(), getContext());
if (!ObjectUtils.isEmpty(site.getSiteName())) {
siteEntityList = siteEntityList.stream().filter(item -> site.getSiteName().equals(item.getSiteName())).collect(Collectors.toList());
}
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, siteEntityList);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点列表成功!");
......@@ -213,8 +218,9 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
String siteIds = site.getAreaCodeList().stream().flatMap(areaId ->
this.service.getFlatSitesByAreaCode(areaId, getContext()).stream()
).map(item -> item.getId().toString()).distinct().collect(Collectors.joining(","));
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
jsonObject.put(KEY_RESULT_DATA, siteIds);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点列表成功!");
......
......@@ -7,6 +7,7 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.site.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -71,7 +72,10 @@ public class SiteHallController extends BaseCRUDJsonBodyMappingController<SiteHa
int code = VALUE_RESULT_SUCCESS;
try {
Rest<List<BusinessEntity>> rest = this.service.getBusinessByHall(siteHall, getContext());
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
model.put(KEY_RESULT_DATA, rest.getData());
model.put("message_info", busiDesc + "成功");
} catch (Exception e) {
......
......@@ -16,6 +16,7 @@ import com.mortals.xhx.module.window.model.WindowEntity;
import com.mortals.xhx.module.window.service.WindowBusinessService;
import com.mortals.xhx.module.window.service.WindowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -66,10 +67,10 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
public String addBusinessToSite(@RequestBody Map<String, Object> map) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String businessIds=(String)map.get("businessIds");
Long windowId= DataUtil.converObj2Long(map.get("windowId"));
String businessIds = (String) map.get("businessIds");
Long windowId = DataUtil.converObj2Long(map.get("windowId"));
try {
this.service.addBusinessToWindow(businessIds,windowId,getContext());
this.service.addBusinessToWindow(businessIds, windowId, getContext());
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "添加业务到窗口成功!");
......@@ -82,7 +83,6 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
}
@PostMapping(value = "subHalllist")
@UnAuth
public Rest<Object> subHalllist(@RequestBody WindowEntity query) {
......@@ -90,7 +90,7 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "查询差集" + this.getModuleDesc();
int code=VALUE_RESULT_SUCCESS;
int code = VALUE_RESULT_SUCCESS;
try {
PageInfo pageInfo = buildPageInfo(query);
Result<WindowEntity> result = this.getService().findSubHallList(query, pageInfo, context);
......@@ -98,7 +98,9 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
model.put(PAGEINFO_KEY, result.getPageInfo());
parsePageInfo(model, result.getPageInfo());
model.put(MESSAGE_INFO, busiDesc + "成功");
recordSysLog(request, busiDesc + " 【成功】");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
......
......@@ -3,17 +3,7 @@
POST {{baseUrl}}/dept/list
Content-Type: application/json
{
"siteId":1,
"page":1,
"size":1,
"orderColList":[
{
"colName":"sort",
"sortKind":"desc"
}
]
}
{"isBkb":1,"siteId":1,"page":"1","size":"10","orderColList":[{"colName":"sort","sortKind":"desc"}]}
###部门更新与保存
......
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