Commit 30a7e61ca35d4c1bde7b6c2ce7e8c12853f76515

Authored by 徐烜
1 parent a6b6afd6

人员停用在home.html做弹出框,后台获取当前用户权限下的线路人员配置停用信息

src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
@@ -53,6 +53,24 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo @@ -53,6 +53,24 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo
53 return rtn; 53 return rtn;
54 } 54 }
55 55
  56 + @RequestMapping(value = "/validate_get_destroy_info", method = RequestMethod.GET)
  57 + public Map<String, Object> validate_get_destroy_info(HttpServletRequest request) {
  58 + HttpSession session = request.getSession();
  59 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  60 +
  61 + Map<String, Object> rtn = new HashMap<>();
  62 + try {
  63 + rtn.put("data", this.employeeConfigInfoService.validate_get_destroy_info(cmyAuths));
  64 + rtn.put("status", ResponseCode.SUCCESS);
  65 + } catch (Exception exp) {
  66 + rtn.put("status", ResponseCode.ERROR);
  67 + rtn.put("msg", exp.getMessage());
  68 + }
  69 +
  70 + return rtn;
  71 +
  72 + }
  73 +
56 @RequestMapping(value = "/validate_jsy_destroy", method = RequestMethod.GET) 74 @RequestMapping(value = "/validate_jsy_destroy", method = RequestMethod.GET)
57 public Map<String, Object> validate_jsy_destroy(@RequestParam Map<String, Object> param) { 75 public Map<String, Object> validate_jsy_destroy(@RequestParam Map<String, Object> param) {
58 Map<String, Object> rtn = new HashMap<>(); 76 Map<String, Object> rtn = new HashMap<>();
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
@@ -30,6 +30,8 @@ public interface EmployeeConfigInfoService extends BService&lt;EmployeeConfigInfo, @@ -30,6 +30,8 @@ public interface EmployeeConfigInfoService extends BService&lt;EmployeeConfigInfo,
30 void validate_jsy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 30 void validate_jsy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
31 // 验证售票员是否停用 31 // 验证售票员是否停用
32 void validate_spy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 32 void validate_spy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  33 + // 获取线路人员配置停用信息描述
  34 + List<String> validate_get_destroy_info(List<CompanyAuthority> companyAuthorityList);
33 35
34 void toggleCancel(Long id) throws ScheduleException; 36 void toggleCancel(Long id) throws ScheduleException;
35 Long getMaxDbbm(Integer xlId); 37 Long getMaxDbbm(Integer xlId);
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
@@ -279,6 +279,53 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn @@ -279,6 +279,53 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
279 279
280 @Transactional 280 @Transactional
281 @Override 281 @Override
  282 + public List<String> validate_get_destroy_info(List<CompanyAuthority> companyAuthorityList) {
  283 + // 获取公司分公司权限代码
  284 + List<String> gs_fgs_dms = new ArrayList<>();
  285 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  286 + gs_fgs_dms.add(companyAuthority.getCompanyCode() + "_" + companyAuthority.getSubCompanyCode());
  287 + }
  288 +
  289 + // 查询所有人员配置,不用in操作符,n+1查询慢,程序过滤
  290 + Map<String, Object> params = new HashMap<>();
  291 + List<EmployeeConfigInfo> employeeConfigInfoList_all = (List<EmployeeConfigInfo>) this.list(params);
  292 + List<EmployeeConfigInfo> employeeConfigInfoList = new ArrayList<>();
  293 + for (EmployeeConfigInfo employeeConfigInfo : employeeConfigInfoList_all) {
  294 + if (gs_fgs_dms.contains(employeeConfigInfo.getXl().getCgsbm())) {
  295 + employeeConfigInfoList.add(employeeConfigInfo);
  296 + }
  297 + }
  298 +
  299 + // 停用信息
  300 + List<String> destroy_infos = new ArrayList<>();
  301 + String info_format = "线路[%s]中人员配置有停用人员,请处理!";
  302 + String info = "";
  303 + Integer xlId = null;
  304 + for (EmployeeConfigInfo employeeConfigInfo : employeeConfigInfoList) {
  305 + if (employeeConfigInfo.getJsy() != null &&
  306 + employeeConfigInfo.getJsy().getDestroy() != null &&
  307 + employeeConfigInfo.getJsy().getDestroy() == 1) { // 驾驶员判定是否停用
  308 + info = String.format(info_format, employeeConfigInfo.getXl().getName());
  309 + if (!destroy_infos.contains(info)) {
  310 + destroy_infos.add(info);
  311 + }
  312 + }
  313 +
  314 + if (employeeConfigInfo.getSpy() != null &&
  315 + employeeConfigInfo.getSpy().getDestroy() != null &&
  316 + employeeConfigInfo.getSpy().getDestroy() == 1) {
  317 + info = String.format(info_format, employeeConfigInfo.getXl().getName());
  318 + if (!destroy_infos.contains(info)) {
  319 + destroy_infos.add(info);
  320 + }
  321 + }
  322 + }
  323 +
  324 + return destroy_infos;
  325 + }
  326 +
  327 + @Transactional
  328 + @Override
282 public void delete(Long aLong) throws ScheduleException { 329 public void delete(Long aLong) throws ScheduleException {
283 toggleCancel(aLong); 330 toggleCancel(aLong);
284 } 331 }
src/main/resources/static/pages/home.html
@@ -95,4 +95,29 @@ @@ -95,4 +95,29 @@
95 <li class="sub_title"><h6>用油管理</h6></li> 95 <li class="sub_title"><h6>用油管理</h6></li>
96 <li><span class="label s_c_change">修复</span>1、修正加油人员不符保存后不在显示。</li> 96 <li><span class="label s_c_change">修复</span>1、修正加油人员不符保存后不在显示。</li>
97 </ul> 97 </ul>
  98 +
98 </div> 99 </div>
  100 +
  101 +<script type="text/javascript">
  102 + $.ajax({
  103 + url: '/eci/validate_get_destroy_info',
  104 + dataType: "json",
  105 + success: function(rs) {
  106 + if (rs && rs.status === "SUCCESS") {
  107 + if (rs.data && rs.data.length && rs.data.length > 0) {
  108 + swal({
  109 + title: "人员配置停用信息",
  110 + text: rs.data.join("</br>"),
  111 + html: true,
  112 + type: "warning",
  113 + showCancelButton: true,
  114 + confirmButtonColor: "RED",
  115 + confirmButtonText: "是",
  116 + cancelButtonText: "取消"
  117 + });
  118 + }
  119 + }
  120 + }
  121 + });
  122 +
  123 +</script>