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

添加查询当前人员负责的窗口列表

parent b34ad5e9
package com.mortals.xhx.module.window.service; package com.mortals.xhx.module.window.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.common.pdu.window.WindowPdu; import com.mortals.xhx.common.pdu.window.WindowPdu;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import com.mortals.xhx.module.window.model.WindowOwnerEntity; import com.mortals.xhx.module.window.model.WindowOwnerEntity;
import com.mortals.xhx.module.window.dao.WindowOwnerDao; import com.mortals.xhx.module.window.dao.WindowOwnerDao;
...@@ -24,4 +26,13 @@ public interface WindowOwnerService extends ICRUDService<WindowOwnerEntity,Long> ...@@ -24,4 +26,13 @@ public interface WindowOwnerService extends ICRUDService<WindowOwnerEntity,Long>
* @return * @return
*/ */
List<WindowPdu> subWindowPduList(WindowPdu pdu); List<WindowPdu> subWindowPduList(WindowPdu pdu);
/**
*
* 获取基础平台与考勤绩效系统已分配的窗口差集列表
* @param context
* @return
*/
List<WindowOwnerDetailEntity> ownerWindowList(Context context);
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.window.service.impl; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.window.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.window.WindowPdu; import com.mortals.xhx.common.pdu.window.WindowPdu;
...@@ -40,12 +41,11 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD ...@@ -40,12 +41,11 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
@Autowired @Autowired
private WindowOwnerDetailService windowOwnerDetailService; private WindowOwnerDetailService windowOwnerDetailService;
@Autowired @Autowired
private IWindowFeign windowFeign; private IWindowFeign windowFeign;
@Autowired
private UserService userService;
@Override @Override
...@@ -66,17 +66,17 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD ...@@ -66,17 +66,17 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
subList = respDataRest.getData().getData(); subList = respDataRest.getData().getData();
} }
if(!ObjectUtils.isEmpty(pdu.getStaffId())){ if (!ObjectUtils.isEmpty(pdu.getStaffId())) {
//查询当前负责人负责的窗口 //查询当前负责人负责的窗口
WindowOwnerDetailQuery detailQuery = new WindowOwnerDetailQuery(); WindowOwnerDetailQuery detailQuery = new WindowOwnerDetailQuery();
detailQuery.setOwnerId(pdu.getStaffId()); detailQuery.setOwnerId(pdu.getStaffId());
Long[] windowIds = windowOwnerDetailService.find(detailQuery).stream().map(WindowOwnerDetailEntity::getId).toArray(Long[]::new); Long[] windowIds = windowOwnerDetailService.find(detailQuery).stream().map(WindowOwnerDetailEntity::getId).toArray(Long[]::new);
if(!ObjectUtils.isEmpty(windowIds)){ if (!ObjectUtils.isEmpty(windowIds)) {
WindowPdu ownerWindowPdu = new WindowPdu(); WindowPdu ownerWindowPdu = new WindowPdu();
ownerWindowPdu.setIdList(Arrays.asList(windowIds)); ownerWindowPdu.setIdList(Arrays.asList(windowIds));
Rest<RespData<List<WindowPdu>>> ownerRest = windowFeign.list(ownerWindowPdu); Rest<RespData<List<WindowPdu>>> ownerRest = windowFeign.list(ownerWindowPdu);
if (ownerRest.getCode() == YesNoEnum.YES.getValue()) { if (ownerRest.getCode() == YesNoEnum.YES.getValue()) {
ownerList=ownerRest.getData().getData(); ownerList = ownerRest.getData().getData();
} }
} }
} }
...@@ -86,10 +86,18 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD ...@@ -86,10 +86,18 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
return ownerList; return ownerList;
} }
@Override
public List<WindowOwnerDetailEntity> ownerWindowList(Context context) {
Long customerId = context.getUser().getCustomerId();
if (ObjectUtils.isEmpty(customerId)) throw new AppException("系统用户关联客户ID为空!");
List<WindowOwnerDetailEntity> windowOwnerDetailEntities = windowOwnerDetailService.find(new WindowOwnerDetailQuery().ownerId(customerId));
return windowOwnerDetailEntities;
}
@Override @Override
protected void saveBefore(WindowOwnerEntity entity, Context context) throws AppException { protected void saveBefore(WindowOwnerEntity entity, Context context) throws AppException {
super.saveBefore(entity, context); super.saveBefore(entity, context);
if(!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())){ if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
entity.setWindowCount(entity.getWindowOwnerDetailList().size()); entity.setWindowCount(entity.getWindowOwnerDetailList().size());
} }
} }
...@@ -97,7 +105,7 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD ...@@ -97,7 +105,7 @@ public class WindowOwnerServiceImpl extends AbstractCRUDServiceImpl<WindowOwnerD
@Override @Override
protected void updateBefore(WindowOwnerEntity entity, Context context) throws AppException { protected void updateBefore(WindowOwnerEntity entity, Context context) throws AppException {
super.updateBefore(entity, context); super.updateBefore(entity, context);
if(!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())){ if (!ObjectUtils.isEmpty(entity.getWindowOwnerDetailList())) {
entity.setWindowCount(entity.getWindowOwnerDetailList().size()); entity.setWindowCount(entity.getWindowOwnerDetailList().size());
} }
} }
......
package com.mortals.xhx.module.window.web; package com.mortals.xhx.module.window.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.site.model.SiteQuery;
import com.mortals.xhx.base.system.user.model.UserQuery; import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
...@@ -13,7 +15,9 @@ import com.mortals.xhx.feign.site.ISiteHallFeign; ...@@ -13,7 +15,9 @@ import com.mortals.xhx.feign.site.ISiteHallFeign;
import com.mortals.xhx.feign.window.IWindowFeign; import com.mortals.xhx.feign.window.IWindowFeign;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.window.model.WindowOwnerDetailEntity;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -75,7 +79,7 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win ...@@ -75,7 +79,7 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
SiteHallPdu siteHallPdu = new SiteHallPdu(); SiteHallPdu siteHallPdu = new SiteHallPdu();
siteHallPdu.setSiteId(1L); siteHallPdu.setSiteId(1L);
Rest<RespData<List<SiteHallPdu>>> rest = siteHallFeign.list(siteHallPdu); Rest<RespData<List<SiteHallPdu>>> rest = siteHallFeign.list(siteHallPdu);
if(YesNoEnum.YES.getValue()==rest.getCode()){ if (YesNoEnum.YES.getValue() == rest.getCode()) {
Map<Long, String> hallMap = rest.getData().getData().stream().collect(Collectors.toMap(x -> x.getId(), y -> y.getHallName(), (o, n) -> n)); Map<Long, String> hallMap = rest.getData().getData().stream().collect(Collectors.toMap(x -> x.getId(), y -> y.getHallName(), (o, n) -> n));
this.addDict(model, "hallId", hallMap); this.addDict(model, "hallId", hallMap);
} }
...@@ -83,8 +87,8 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win ...@@ -83,8 +87,8 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
// Map<String, String> collect = userService.find(new UserQuery(), getContext()).stream() // Map<String, String> collect = userService.find(new UserQuery(), getContext()).stream()
// .collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getRealName(), (o, n) -> n)); // .collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getRealName(), (o, n) -> n));
// this.addDict(model, "updateUserId", collect); // this.addDict(model, "updateUserId", collect);
this.addDict(model, "deptId", deptService.getDeptBySalaId(-1l).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n))); this.addDict(model, "deptId", deptService.getDeptBySalaId(-1l).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName(), (o, n) -> n)));
this.addDict(model, "salaId", deptService.getAllSala().stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getDeptName(),(o, n)->n))); this.addDict(model, "salaId", deptService.getAllSala().stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeptName(), (o, n) -> n)));
super.init(model, context); super.init(model, context);
} }
...@@ -118,4 +122,26 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win ...@@ -118,4 +122,26 @@ public class WindowOwnerController extends BaseCRUDJsonBodyMappingController<Win
} }
/**
* 查询当前负责人负责的窗口列表
*/
@PostMapping(value = "windowList")
public String getOwnerList() {
JSONObject jsonObject = new JSONObject();
String busiDesc = "查询当前负责人负责的窗口列表" + this.getModuleDesc();
try {
List<WindowOwnerDetailEntity> windowOwnerDetailEntities = this.service.ownerWindowList(getContext());
jsonObject.put(KEY_RESULT_DATA, windowOwnerDetailEntities);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询当前负责人负责的窗口列表!");
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
} }
\ No newline at end of file
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