From de3590b244c8d2b9bec76f01d2f298f3fa670190 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 10 三月 2025 18:14:59 +0800
Subject: [PATCH] 优化员工详情功能
---
service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListPurchaseApplysCmd.java | 1
service-user/src/main/java/com/java110/user/cmd/user/ListStaffRolesCmd.java | 40 -
service-user/src/main/java/com/java110/user/cmd/org/QueryAdminOrgTreeCmd.java | 103 ++++
service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffAdminMonthScheduleClassesCmd.java | 105 ++++
service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffOrgsCmd.java | 109 ++++
java110-bean/src/main/java/com/java110/dto/org/OrgDto.java | 11
service-common/src/main/java/com/java110/common/cmd/attendanceClasses/QueryAdminAttendanceClassesTaskCmd.java | 65 ++
service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffMonthScheduleClassesCmd.java | 1
service-user/src/main/java/com/java110/user/cmd/org/ListOrgTreeCmd.java | 86 +--
service-community/src/main/java/com/java110/community/cmd/maintainanceTask/DeleteMaintainanceTaskDetailCmd.java | 1
service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminFinishRepairsByStaffCmd.java | 70 +++
service-user/src/main/java/com/java110/user/cmd/user/QueryAdminPropertyStaffCmd.java | 191 ++++++++
service-community/src/main/java/com/java110/community/cmd/maintainanceTask/ListAdminMaintainanceTaskDetailCmd.java | 107 ++++
service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffRolesCmd.java | 71 +++
service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListAdminPurchaseApplysCmd.java | 171 +++++++
java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml | 8
service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminUndoRepairsByStaffCmd.java | 61 ++
service-user/src/main/java/com/java110/user/cmd/user/QueryAdminStaffPrivilegeCmd.java | 79 +++
18 files changed, 1,196 insertions(+), 84 deletions(-)
diff --git a/java110-bean/src/main/java/com/java110/dto/org/OrgDto.java b/java110-bean/src/main/java/com/java110/dto/org/OrgDto.java
index 7c6e9ad..b3b62e0 100755
--- a/java110-bean/src/main/java/com/java110/dto/org/OrgDto.java
+++ b/java110-bean/src/main/java/com/java110/dto/org/OrgDto.java
@@ -25,6 +25,9 @@
private String description;
private String orgLevel;
private String storeId;
+
+ private String storeTypeCd;
+
private String orgId;
private String[] orgIds;
private String belongCommunityId;
@@ -172,4 +175,12 @@
public void setOrgIds(String[] orgIds) {
this.orgIds = orgIds;
}
+
+ public String getStoreTypeCd() {
+ return storeTypeCd;
+ }
+
+ public void setStoreTypeCd(String storeTypeCd) {
+ this.storeTypeCd = storeTypeCd;
+ }
}
diff --git a/java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml
index 8457746..73f34e6 100644
--- a/java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/user/OrgV1ServiceDaoImplMapper.xml
@@ -43,6 +43,10 @@
<if test="storeId !=null and storeId != ''">
and t.store_id= #{storeId}
</if>
+ <if test="storeTypeCd !=null and storeId = '800900000003'">
+ and t.store_id not in ('400000000000000001','400000000000000002')
+ </if>
+
<if test="orgId !=null and orgId != ''">
and t.org_id= #{orgId}
</if>
@@ -115,9 +119,13 @@
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
</if>
+
<if test="storeId !=null and storeId != ''">
and t.store_id= #{storeId}
</if>
+ <if test="storeTypeCd !=null and storeId = '800900000003'">
+ and t.store_id not in ('400000000000000001','400000000000000002')
+ </if>
<if test="orgId !=null and orgId != ''">
and t.org_id= #{orgId}
</if>
diff --git a/service-common/src/main/java/com/java110/common/cmd/attendanceClasses/QueryAdminAttendanceClassesTaskCmd.java b/service-common/src/main/java/com/java110/common/cmd/attendanceClasses/QueryAdminAttendanceClassesTaskCmd.java
new file mode 100644
index 0000000..c3508e1
--- /dev/null
+++ b/service-common/src/main/java/com/java110/common/cmd/attendanceClasses/QueryAdminAttendanceClassesTaskCmd.java
@@ -0,0 +1,65 @@
+package com.java110.common.cmd.attendanceClasses;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.attendance.AttendanceClassesTaskDto;
+import com.java110.intf.common.IAttendanceClassesTaskInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "attendanceClasses.queryAdminAttendanceClasses")
+public class QueryAdminAttendanceClassesTaskCmd extends Cmd {
+
+ @Autowired
+ private IAttendanceClassesTaskInnerServiceSMO attendanceClassesTaskInnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+ super.validateAdmin(context);
+ super.validatePageInfo(reqJson);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+ AttendanceClassesTaskDto attendanceClassesTaskDto = BeanConvertUtil.covertBean(reqJson, AttendanceClassesTaskDto.class);
+
+ attendanceClassesTaskDto.setStoreId("");
+ String date = reqJson.getString("date");
+ if (!StringUtil.isEmpty(date)) {
+ String[] dates = date.split("-");
+ attendanceClassesTaskDto.setTaskYear(dates[0] + "");
+ attendanceClassesTaskDto.setTaskMonth(dates[1] + "");
+ if (dates.length == 3) {
+ attendanceClassesTaskDto.setTaskDay(dates[2] + "");
+ }
+ }
+
+
+ int count = attendanceClassesTaskInnerServiceSMOImpl.queryAttendanceClassesTasksCount(attendanceClassesTaskDto);
+
+ List<AttendanceClassesTaskDto> attendanceClassesTaskDtos = null;
+ if (count > 0) {
+ attendanceClassesTaskDtos = attendanceClassesTaskInnerServiceSMOImpl.queryAttendanceClassesTasks(attendanceClassesTaskDto);
+ } else {
+ attendanceClassesTaskDtos = new ArrayList<>();
+ }
+
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) attendanceClassesTaskDto.getRow()), count, attendanceClassesTaskDtos);
+
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+ context.setResponseEntity(responseEntity);
+ }
+}
diff --git a/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/DeleteMaintainanceTaskDetailCmd.java b/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/DeleteMaintainanceTaskDetailCmd.java
index 1f7ba80..a68ca09 100644
--- a/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/DeleteMaintainanceTaskDetailCmd.java
+++ b/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/DeleteMaintainanceTaskDetailCmd.java
@@ -52,6 +52,7 @@
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
Assert.hasKeyAndValue(reqJson, "taskDetailId", "taskDetailId涓嶈兘涓虹┖");
Assert.hasKeyAndValue(reqJson, "communityId", "communityId涓嶈兘涓虹┖");
+ super.validateProperty(cmdDataFlowContext);
}
diff --git a/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/ListAdminMaintainanceTaskDetailCmd.java b/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/ListAdminMaintainanceTaskDetailCmd.java
new file mode 100644
index 0000000..0870dfd
--- /dev/null
+++ b/service-community/src/main/java/com/java110/community/cmd/maintainanceTask/ListAdminMaintainanceTaskDetailCmd.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2017-2020 鍚村鏂� and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.community.cmd.maintainanceTask;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.file.FileRelDto;
+import com.java110.dto.maintainance.MaintainanceTaskDetailDto;
+import com.java110.intf.common.IFileRelInnerServiceSMO;
+import com.java110.intf.community.IMaintainanceTaskDetailV1InnerServiceSMO;
+import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.MappingConstant;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import com.java110.vo.api.junkRequirement.PhotoVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 绫昏〃杩帮細鏌ヨ
+ * 鏈嶅姟缂栫爜锛歮aintainanceTaskDetail.listMaintainanceTaskDetail
+ * 璇锋眰璺姴锛�/app/maintainanceTaskDetail.ListMaintainanceTaskDetail
+ * add by 鍚村鏂� at 2022-11-08 16:02:23 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 瀹樼綉锛歨ttp://www.homecommunity.cn
+ * 娓╅Θ鎻愮ず锛氬鏋滄偍瀵规鏂囦欢杩涜淇敼 璇蜂笉瑕佸垹闄ゅ師鏈変綔鑰呭強娉ㄩ噴淇℃伅锛岃琛ュ厖鎮ㄧ殑 淇敼鐨勫師鍥犱互鍙婅仈绯婚偖绠卞涓�
+ * // modify by 寮犱笁 at 2021-09-12 绗�10琛屽湪鏌愮鍦烘櫙涓嬪瓨鍦ㄦ煇绉峛ug 闇�瑕佷慨澶嶏紝娉ㄩ噴10鑷�20琛� 鍔犲叆 20琛岃嚦30琛�
+ */
+@Java110Cmd(serviceCode = "maintainanceTask.listAdminMaintainanceTaskDetail")
+public class ListAdminMaintainanceTaskDetailCmd extends Cmd {
+
+ private static Logger logger = LoggerFactory.getLogger(ListAdminMaintainanceTaskDetailCmd.class);
+
+ @Autowired
+ private IMaintainanceTaskDetailV1InnerServiceSMO maintainanceTaskDetailV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+ super.validatePageInfo(reqJson);
+ super.validateAdmin(cmdDataFlowContext);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+ MaintainanceTaskDetailDto maintainanceTaskDetailDto = BeanConvertUtil.covertBean(reqJson, MaintainanceTaskDetailDto.class);
+
+ int count = maintainanceTaskDetailV1InnerServiceSMOImpl.queryMaintainanceTaskDetailsCount(maintainanceTaskDetailDto);
+ List<MaintainanceTaskDetailDto> maintainanceTaskDetailDtos = null;
+ if (count > 0) {
+ maintainanceTaskDetailDtos = maintainanceTaskDetailV1InnerServiceSMOImpl.queryMaintainanceTaskDetails(maintainanceTaskDetailDto);
+ refreshPhotos(maintainanceTaskDetailDtos);
+ } else {
+ maintainanceTaskDetailDtos = new ArrayList<>();
+ }
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, maintainanceTaskDetailDtos);
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+ cmdDataFlowContext.setResponseEntity(responseEntity);
+ }
+
+ private void refreshPhotos(List<MaintainanceTaskDetailDto> maintainanceTaskDetailDtos) {
+ List<PhotoVo> photoVos = null;
+ PhotoVo photoVo = null;
+ String imgUrl = MappingCache.getValue(MappingConstant.FILE_DOMAIN, "IMG_PATH");
+ for (MaintainanceTaskDetailDto inspectionTaskDetail : maintainanceTaskDetailDtos) {
+ if (!"20200407".equals(inspectionTaskDetail.getState())) {
+ continue;
+ }
+ FileRelDto fileRelDto = new FileRelDto();
+ fileRelDto.setObjId(inspectionTaskDetail.getTaskDetailId());
+ List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto);
+ photoVos = new ArrayList<>();
+ for (FileRelDto tmpFileRelDto : fileRelDtos) {
+ photoVo = new PhotoVo();
+ photoVo.setUrl(tmpFileRelDto.getFileRealName().startsWith("http") ? tmpFileRelDto.getFileRealName() : imgUrl + tmpFileRelDto.getFileRealName());
+ photoVos.add(photoVo);
+ }
+ inspectionTaskDetail.setPhotos(photoVos);
+ }
+ }
+}
diff --git a/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminFinishRepairsByStaffCmd.java b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminFinishRepairsByStaffCmd.java
new file mode 100644
index 0000000..72918f6
--- /dev/null
+++ b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminFinishRepairsByStaffCmd.java
@@ -0,0 +1,70 @@
+package com.java110.community.cmd.ownerRepair;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.doc.annotation.*;
+import com.java110.dto.repair.RepairDto;
+import com.java110.intf.community.IRepairInnerServiceSMO;
+import com.java110.intf.community.IRepairUserInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "ownerRepair.listAdminFinishRepairsByStaff")
+public class ListAdminFinishRepairsByStaffCmd extends Cmd {
+
+ @Autowired
+ private IRepairInnerServiceSMO repairInnerServiceSMOImpl;
+
+ @Autowired
+ private IRepairUserInnerServiceSMO repairUserInnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ super.validatePageInfo(reqJson);
+ super.validateAdmin(context);
+ Assert.hasKeyAndValue(reqJson, "staffId", "璇锋眰涓湭鍖呭惈鍛樺伐淇℃伅");
+ }
+
+ /**
+ * 鎶ヤ慨宸插姙
+ * @param event 浜嬩欢瀵硅薄
+ * @param context 鏁版嵁涓婃枃瀵硅薄
+ * @param reqJson 璇锋眰鎶ユ枃
+ * @throws CmdException
+ * @throws ParseException
+ */
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+ RepairDto ownerRepairDto = BeanConvertUtil.covertBean(reqJson, RepairDto.class);
+ if (reqJson.containsKey("repairStates")) {
+ String[] states = reqJson.getString("repairStates").split(",");
+ ownerRepairDto.setStates(Arrays.asList(states));
+ } else {
+ //Pc WEB缁翠慨宸插姙
+ String[] states={RepairDto.STATE_BACK, RepairDto.STATE_TRANSFER,RepairDto.STATE_PAY, RepairDto.STATE_PAY_ERROR, RepairDto.STATE_APPRAISE, RepairDto.STATE_RETURN_VISIT, RepairDto.STATE_COMPLATE};
+ ownerRepairDto.setStates(Arrays.asList(states));
+ }
+ int count = repairInnerServiceSMOImpl.queryStaffFinishRepairsCount(ownerRepairDto);
+ List<RepairDto> ownerRepairs = null;
+ if (count > 0) {
+ ownerRepairs = repairInnerServiceSMOImpl.queryStaffFinishRepairs(ownerRepairDto);
+ //refreshStaffName(ownerRepairs);
+ } else {
+ ownerRepairs = new ArrayList<>();
+ }
+ ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, ownerRepairs);
+ context.setResponseEntity(responseEntity);
+ }
+}
diff --git a/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminUndoRepairsByStaffCmd.java b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminUndoRepairsByStaffCmd.java
new file mode 100644
index 0000000..a1d6011
--- /dev/null
+++ b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/ListAdminUndoRepairsByStaffCmd.java
@@ -0,0 +1,61 @@
+package com.java110.community.cmd.ownerRepair;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.doc.annotation.*;
+import com.java110.dto.repair.RepairDto;
+import com.java110.intf.community.IRepairInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 鏌ヨ鍛樺伐寰呭姙 缁翠慨宸ュ崟
+ */
+@Java110Cmd(serviceCode = "ownerRepair.listAdminUndoRepairsByStaff")
+public class ListAdminUndoRepairsByStaffCmd extends Cmd {
+
+ @Autowired
+ private IRepairInnerServiceSMO repairInnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ super.validatePageInfo(reqJson);
+ super.validateAdmin(context);
+ Assert.hasKeyAndValue(reqJson, "staffId", "璇锋眰涓湭鍖呭惈鍛樺伐淇℃伅");
+ }
+
+ /**
+ * 鎶ヤ慨寰呭姙
+ *
+ * @param event 浜嬩欢瀵硅薄
+ * @param context 鏁版嵁涓婃枃瀵硅薄
+ * @param reqJson 璇锋眰鎶ユ枃
+ * @throws CmdException
+ * @throws ParseException
+ */
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+ RepairDto ownerRepairDto = BeanConvertUtil.covertBean(reqJson, RepairDto.class);
+ //鑾峰彇鐢ㄦ埛id
+ int count = repairInnerServiceSMOImpl.queryStaffRepairsCount(ownerRepairDto);
+ List<RepairDto> ownerRepairs = null;
+ if (count > 0) {
+ ownerRepairs = repairInnerServiceSMOImpl.queryStaffRepairs(ownerRepairDto);
+ } else {
+ ownerRepairs = new ArrayList<>();
+ }
+ ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, ownerRepairs);
+ context.setResponseEntity(responseEntity);
+ }
+}
diff --git a/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListAdminPurchaseApplysCmd.java b/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListAdminPurchaseApplysCmd.java
new file mode 100644
index 0000000..c7fe8fa
--- /dev/null
+++ b/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListAdminPurchaseApplysCmd.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright 2017-2020 鍚村鏂� and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.store.cmd.purchaseApply;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.privilege.BasePrivilegeDto;
+import com.java110.dto.purchase.PurchaseApplyDto;
+import com.java110.intf.common.IPurchaseApplyUserInnerServiceSMO;
+import com.java110.intf.community.IMenuInnerServiceSMO;
+import com.java110.intf.store.IPurchaseApplyInnerServiceSMO;
+import com.java110.intf.store.IResourceStoreInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.api.purchaseApply.ApiPurchaseApplyDataVo;
+import com.java110.vo.api.purchaseApply.ApiPurchaseApplyVo;
+import com.java110.vo.api.purchaseApply.PurchaseApplyDetailVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 绫昏〃杩帮細鏌ヨ
+ * 鏈嶅姟缂栫爜锛歱urchaseApply.listPurchaseApply
+ * 璇锋眰璺姴锛�/app/purchaseApply.ListPurchaseApply
+ * add by 鍚村鏂� at 2022-08-08 13:21:13 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 瀹樼綉锛歨ttp://www.homecommunity.cn
+ * 娓╅Θ鎻愮ず锛氬鏋滄偍瀵规鏂囦欢杩涜淇敼 璇蜂笉瑕佸垹闄ゅ師鏈変綔鑰呭強娉ㄩ噴淇℃伅锛岃琛ュ厖鎮ㄧ殑 淇敼鐨勫師鍥犱互鍙婅仈绯婚偖绠卞涓�
+ * // modify by 寮犱笁 at 2021-09-12 绗�10琛屽湪鏌愮鍦烘櫙涓嬪瓨鍦ㄦ煇绉峛ug 闇�瑕佷慨澶嶏紝娉ㄩ噴10鑷�20琛� 鍔犲叆 20琛岃嚦30琛�
+ */
+@Java110Cmd(serviceCode = "purchaseApply.listAdminPurchaseApplys")
+public class ListAdminPurchaseApplysCmd extends Cmd {
+
+ private static Logger logger = LoggerFactory.getLogger(ListAdminPurchaseApplysCmd.class);
+
+ @Autowired
+ private IPurchaseApplyInnerServiceSMO purchaseApplyInnerServiceSMOImpl;
+
+ @Autowired
+ private IPurchaseApplyUserInnerServiceSMO purchaseApplyUserInnerServiceSMOImpl;
+
+ @Autowired
+ private IMenuInnerServiceSMO menuInnerServiceSMOImpl;
+
+ @Autowired
+ private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+ Assert.hasKeyAndValue(reqJson, "resOrderType", "蹇呭~锛岃濉啓璁㈠崟绫诲瀷");
+ super.validatePageInfo(reqJson);
+ super.validateAdmin(cmdDataFlowContext);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ PurchaseApplyDto purchaseApplyDto = BeanConvertUtil.covertBean(reqJson, PurchaseApplyDto.class);
+ purchaseApplyDto.setStoreId("");
+ purchaseApplyDto.setUserName("");//瑙i櫎涓庣敤鎴峰悕鐩稿叧闂
+ //鑾峰彇鐢ㄦ埛id
+ purchaseApplyDto.setUserId("");
+ if (!StringUtil.isEmpty(reqJson.getString("applyUserName"))) {
+ purchaseApplyDto.setUserName(reqJson.getString("applyUserName"));
+ }
+ int count = purchaseApplyInnerServiceSMOImpl.queryPurchaseApplysCount(purchaseApplyDto);
+ List<ApiPurchaseApplyDataVo> purchaseApplys = new ArrayList<>();
+ if (count > 0) {
+ List<PurchaseApplyDto> purchaseApplyDtos = purchaseApplyInnerServiceSMOImpl.queryPurchaseApplyAndDetails(purchaseApplyDto);
+ purchaseApplyDtos = freshCurrentUser(purchaseApplyDtos);
+ purchaseApplys = BeanConvertUtil.covertBeanList(purchaseApplyDtos, ApiPurchaseApplyDataVo.class);
+ //todo 鏌ヨ缁撴灉鍒锋柊
+ purchaseApplys = refreshApplys(purchaseApplys, reqJson);
+ } else {
+ purchaseApplys = new ArrayList<>();
+ }
+ ApiPurchaseApplyVo apiPurchaseApplyVo = new ApiPurchaseApplyVo();
+ apiPurchaseApplyVo.setTotal(count);
+ apiPurchaseApplyVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
+ apiPurchaseApplyVo.setPurchaseApplys(purchaseApplys);
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiPurchaseApplyVo), HttpStatus.OK);
+ context.setResponseEntity(responseEntity);
+ }
+
+ /**
+ * 鏌ヨ缁撴灉 娲楃ぜ
+ *
+ * @param purchaseApplys
+ */
+ private List<ApiPurchaseApplyDataVo> refreshApplys(List<ApiPurchaseApplyDataVo> purchaseApplys, JSONObject reqJson) {
+ List<ApiPurchaseApplyDataVo> purchaseApplyDatas = new ArrayList<>();
+ for (ApiPurchaseApplyDataVo apiPurchaseApplyDataVo : purchaseApplys) {
+ List<PurchaseApplyDetailVo> applyDetailList = apiPurchaseApplyDataVo.getPurchaseApplyDetailVo();
+ //todo 濡傛灉娌℃湁鐗╁搧鐩存帴 璺宠繃
+ if (ListUtil.isNull(applyDetailList)) {
+ continue;
+ }
+ StringBuffer resNames = new StringBuffer();
+ BigDecimal totalPrice = new BigDecimal(0);
+ BigDecimal purchaseTotalPrice = new BigDecimal(0);
+ Integer cursor = 0;
+ for (PurchaseApplyDetailVo purchaseApplyDetailVo : applyDetailList) {
+ //todo 鏄惁鏄浐瀹氱墿鍝�
+ apiPurchaseApplyDataVo.setIsFixed(purchaseApplyDetailVo.getIsFixed());
+
+ cursor++;
+ if (!StringUtil.isEmpty(purchaseApplyDetailVo.getSpecName())) {
+ resNames.append(cursor + "锛�" + purchaseApplyDetailVo.getResName() + "(" + purchaseApplyDetailVo.getSpecName() + ") ");
+ } else {
+ resNames.append(cursor + ":" + purchaseApplyDetailVo.getResName());
+ }
+ BigDecimal price = new BigDecimal(purchaseApplyDetailVo.getPrice());
+ BigDecimal quantity = new BigDecimal(purchaseApplyDetailVo.getQuantity());
+ totalPrice = totalPrice.add(price.multiply(quantity));
+ if (!StringUtil.isEmpty(purchaseApplyDetailVo.getPurchasePrice()) && !StringUtil.isEmpty(purchaseApplyDetailVo.getPurchaseQuantity())) {
+ BigDecimal purchasePrice = new BigDecimal(purchaseApplyDetailVo.getPurchasePrice());
+ BigDecimal purchaseQuantity = new BigDecimal(purchaseApplyDetailVo.getPurchaseQuantity());
+ purchaseTotalPrice = purchaseTotalPrice.add(purchasePrice.multiply(purchaseQuantity));
+ }
+ }
+ apiPurchaseApplyDataVo.setResourceNames(resNames.toString());
+ apiPurchaseApplyDataVo.setTotalPrice(totalPrice.toString());
+ apiPurchaseApplyDataVo.setPurchaseTotalPrice(purchaseTotalPrice.toString());
+ if (reqJson.containsKey("resName") && !StringUtil.isEmpty(reqJson.getString("resName"))) {
+ if (resNames.toString().contains(reqJson.getString("resName"))) {
+ purchaseApplyDatas.add(apiPurchaseApplyDataVo);
+ } else {
+ continue;
+ }
+ } else {
+ purchaseApplyDatas.add(apiPurchaseApplyDataVo);
+ }
+ }
+ return purchaseApplyDatas;
+ }
+
+ private List<PurchaseApplyDto> freshCurrentUser(List<PurchaseApplyDto> purchaseApplyDtos) {
+ List<PurchaseApplyDto> tmpPurchaseApplyDtos = new ArrayList<>();
+ for (PurchaseApplyDto purchaseApplyDto : purchaseApplyDtos) {
+ purchaseApplyDto = purchaseApplyUserInnerServiceSMOImpl.getTaskCurrentUser(purchaseApplyDto);
+ tmpPurchaseApplyDtos.add(purchaseApplyDto);
+ }
+ return tmpPurchaseApplyDtos;
+ }
+}
diff --git a/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListPurchaseApplysCmd.java b/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListPurchaseApplysCmd.java
index b94c361..1702ae8 100644
--- a/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListPurchaseApplysCmd.java
+++ b/service-store/src/main/java/com/java110/store/cmd/purchaseApply/ListPurchaseApplysCmd.java
@@ -78,6 +78,7 @@
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
Assert.hasKeyAndValue(reqJson, "resOrderType", "蹇呭~锛岃濉啓璁㈠崟绫诲瀷");
super.validatePageInfo(reqJson);
+ super.validateProperty(cmdDataFlowContext);
}
@Override
diff --git a/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffAdminMonthScheduleClassesCmd.java b/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffAdminMonthScheduleClassesCmd.java
new file mode 100644
index 0000000..42a847a
--- /dev/null
+++ b/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffAdminMonthScheduleClassesCmd.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2017-2020 鍚村鏂� and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.store.cmd.scheduleClasses;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.classes.ScheduleClassesStaffDto;
+import com.java110.intf.store.IScheduleClassesDayV1InnerServiceSMO;
+import com.java110.intf.store.IScheduleClassesStaffV1InnerServiceSMO;
+import com.java110.intf.store.IScheduleClassesV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 绫昏〃杩帮細鏌ヨ 鍛樺伐 鏌愭湀 鎺掔彮鎯呭喌
+ * 鏈嶅姟缂栫爜锛歴cheduleClassesStaff.listScheduleClassesStaff
+ * 璇锋眰璺姴锛�/app/scheduleClassesStaff.ListScheduleClassesStaff
+ * add by 鍚村鏂� at 2022-10-29 16:16:44 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 瀹樼綉锛歨ttp://www.homecommunity.cn
+ * 娓╅Θ鎻愮ず锛氬鏋滄偍瀵规鏂囦欢杩涜淇敼 璇蜂笉瑕佸垹闄ゅ師鏈変綔鑰呭強娉ㄩ噴淇℃伅锛岃琛ュ厖鎮ㄧ殑 淇敼鐨勫師鍥犱互鍙婅仈绯婚偖绠卞涓�
+ * // modify by 寮犱笁 at 2021-09-12 绗�10琛屽湪鏌愮鍦烘櫙涓嬪瓨鍦ㄦ煇绉峛ug 闇�瑕佷慨澶嶏紝娉ㄩ噴10鑷�20琛� 鍔犲叆 20琛岃嚦30琛�
+ */
+@Java110Cmd(serviceCode = "scheduleClasses.staffAdminMonthScheduleClasses")
+public class StaffAdminMonthScheduleClassesCmd extends Cmd {
+
+ private static Logger logger = LoggerFactory.getLogger(StaffAdminMonthScheduleClassesCmd.class);
+ @Autowired
+ private IScheduleClassesStaffV1InnerServiceSMO scheduleClassesStaffV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IScheduleClassesV1InnerServiceSMO scheduleClassesV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IScheduleClassesDayV1InnerServiceSMO scheduleClassesDayV1InnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+ super.validatePageInfo(reqJson);
+ Assert.hasKeyAndValue(reqJson, "curDate", "鏈寘鍚湀 YYYY-MM");
+ super.validateAdmin(cmdDataFlowContext);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+ ScheduleClassesStaffDto scheduleClassesStaffDto = new ScheduleClassesStaffDto();
+ scheduleClassesStaffDto.setStaffId(reqJson.getString("staffId"));
+ scheduleClassesStaffDto.setStaffNameLike(reqJson.getString("staffNameLike"));
+ scheduleClassesStaffDto.setScheduleId(reqJson.getString("scheduleId"));
+
+ scheduleClassesStaffDto.setPage(reqJson.getIntValue("page"));
+ scheduleClassesStaffDto.setRow(reqJson.getIntValue("row"));
+ scheduleClassesStaffDto.setOrgId(reqJson.getString("orgId"));
+
+ int count = scheduleClassesStaffV1InnerServiceSMOImpl.queryScheduleClassesStaffsCount(scheduleClassesStaffDto);
+
+ List<ScheduleClassesStaffDto> scheduleClassesStaffDtos = null;
+ List<ScheduleClassesStaffDto> tmpScheduleClassesStaffDtos = new ArrayList<>();
+ ScheduleClassesStaffDto tmpScheduleClassesStaffDto = null;
+
+ if (count > 0) {
+ scheduleClassesStaffDtos = scheduleClassesStaffV1InnerServiceSMOImpl.queryScheduleClassesStaffs(scheduleClassesStaffDto);
+ for (ScheduleClassesStaffDto scheduleClassesStaffDto1 : scheduleClassesStaffDtos) {
+ scheduleClassesStaffDto1.setCurDate(reqJson.getString("curDate"));
+ tmpScheduleClassesStaffDto = scheduleClassesStaffV1InnerServiceSMOImpl.computeStaffCurMonthWorkday(scheduleClassesStaffDto1);
+ tmpScheduleClassesStaffDtos.add(tmpScheduleClassesStaffDto);
+ }
+ }
+
+ ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, tmpScheduleClassesStaffDtos);
+
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+ cmdDataFlowContext.setResponseEntity(responseEntity);
+ }
+
+
+}
diff --git a/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffMonthScheduleClassesCmd.java b/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffMonthScheduleClassesCmd.java
index 6908a8c..468ff1b 100644
--- a/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffMonthScheduleClassesCmd.java
+++ b/service-store/src/main/java/com/java110/store/cmd/scheduleClasses/StaffMonthScheduleClassesCmd.java
@@ -64,6 +64,7 @@
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
super.validatePageInfo(reqJson);
Assert.hasKeyAndValue(reqJson, "curDate", "鏈寘鍚湀 YYYY-MM");
+ super.validateProperty(cmdDataFlowContext);
}
@Override
diff --git a/service-user/src/main/java/com/java110/user/cmd/org/ListOrgTreeCmd.java b/service-user/src/main/java/com/java110/user/cmd/org/ListOrgTreeCmd.java
index 4533a69..285229c 100644
--- a/service-user/src/main/java/com/java110/user/cmd/org/ListOrgTreeCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/org/ListOrgTreeCmd.java
@@ -17,6 +17,7 @@
import com.java110.intf.user.IUserV1InnerServiceSMO;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,17 +46,17 @@
@Java110ParamDoc(name = "code", type = "int", length = 11, defaultValue = "0", remark = "杩斿洖缂栧彿锛�0 鎴愬姛 鍏朵粬澶辫触"),
@Java110ParamDoc(name = "msg", type = "String", length = 250, defaultValue = "鎴愬姛", remark = "鎻忚堪"),
@Java110ParamDoc(name = "data", type = "Object", remark = "鏈夋晥鏁版嵁"),
- @Java110ParamDoc(parentNodeName = "data",name = "allOrgName", type = "String", remark = "缁勭粐鍚嶇О"),
- @Java110ParamDoc(parentNodeName = "data",name = "id", type = "String", remark = "缁勭粐ID"),
- @Java110ParamDoc(parentNodeName = "data",name = "children", type = "Array", remark = "瀛愯妭鐐�"),
- @Java110ParamDoc(parentNodeName = "children",name = "allOrgName", type = "String", remark = "缁勭粐鍚嶇О"),
- @Java110ParamDoc(parentNodeName = "children",name = "id", type = "String", remark = "缁勭粐ID"),
+ @Java110ParamDoc(parentNodeName = "data", name = "allOrgName", type = "String", remark = "缁勭粐鍚嶇О"),
+ @Java110ParamDoc(parentNodeName = "data", name = "id", type = "String", remark = "缁勭粐ID"),
+ @Java110ParamDoc(parentNodeName = "data", name = "children", type = "Array", remark = "瀛愯妭鐐�"),
+ @Java110ParamDoc(parentNodeName = "children", name = "allOrgName", type = "String", remark = "缁勭粐鍚嶇О"),
+ @Java110ParamDoc(parentNodeName = "children", name = "id", type = "String", remark = "缁勭粐ID"),
}
)
@Java110ExampleDoc(
- reqBody="http://{ip}:{port}/app/org.listOrgTree",
- resBody="{\"code\":0,\"data\":{\"allOrgName\":\"婕旂ず鐗╀笟\",\"children\":[{\"allOrgName\":\"婕旂ず鐗╀笟 / 杞欢閮╘",\"icon\":\"/img/org.png\",\"id\":\"102022091988250052\",\"parentId\":\"842022081548770433\",\"text\":\"杞欢閮╘"}],\"icon\":\"/img/org.png\",\"id\":\"842022081548770433\",\"parentId\":\"-1\",\"text\":\"婕旂ず鐗╀笟\"},\"msg\":\"鎴愬姛\",\"page\":0,\"records\":1,\"rows\":0,\"total\":1}"
+ reqBody = "http://{ip}:{port}/app/org.listOrgTree",
+ resBody = "{\"code\":0,\"data\":{\"allOrgName\":\"婕旂ず鐗╀笟\",\"children\":[{\"allOrgName\":\"婕旂ず鐗╀笟 / 杞欢閮╘",\"icon\":\"/img/org.png\",\"id\":\"102022091988250052\",\"parentId\":\"842022081548770433\",\"text\":\"杞欢閮╘"}],\"icon\":\"/img/org.png\",\"id\":\"842022081548770433\",\"parentId\":\"-1\",\"text\":\"婕旂ず鐗╀笟\"},\"msg\":\"鎴愬姛\",\"page\":0,\"records\":1,\"rows\":0,\"total\":1}"
)
@Java110Cmd(serviceCode = "org.listOrgTree")
@@ -113,12 +114,12 @@
basePrivilegeDto.setResource("/viewAllOrganization");
basePrivilegeDto.setUserId(reqJson.getString("userId"));
List<Map> privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto);
- if (privileges.size() == 0) {
+ if (ListUtil.isNull(privileges)) {
//鏌ヨ鍛樺伐鎵�灞炰簩绾х粍缁囨灦鏋�
OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
orgStaffRelDto.setStaffId(reqJson.getString("userId"));
List<OrgStaffRelDto> orgStaffRelDtos = iOrgStaffRelInnerServiceSMO.queryOrgInfoByStaffIdsNew(orgStaffRelDto);
- if (orgStaffRelDtos.size() > 0) {
+ if (ListUtil.isNotNull(orgStaffRelDtos)) {
List<String> haveOrgList = new ArrayList<String>();
for (OrgStaffRelDto orgStaffRelDto1 : orgStaffRelDtos) {
OrgDto orgDto1 = new OrgDto();
@@ -163,7 +164,7 @@
}
}
- if (childs.size() < 1) {
+ if (ListUtil.isNull(childs)) {
return;
}
@@ -178,43 +179,40 @@
for (OrgDto orgDto : orgDtoList) {
haveOrgList.add(orgDto.getOrgId());
- if (!"1".equals(orgDto.getOrgLevel())) {
- if ("2".equals(orgDto.getOrgLevel())) {
- //涓婄骇鍒�
- OrgDto orgDto1 = new OrgDto();
- orgDto1.setOrgId(orgDto.getParentOrgId());
- List<OrgDto> orgDtoList1 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto1);
- for (OrgDto orgDto2 : orgDtoList1) {
- haveOrgList.add(orgDto2.getOrgId());
- }
- //鍚岀骇鍒�
- OrgDto orgDto2 = new OrgDto();
- orgDto2.setParentOrgId(orgDto.getOrgId());
- List<OrgDto> orgDtoList2 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto2);
- for (OrgDto orgDto3 : orgDtoList2) {
- haveOrgList.add(orgDto3.getOrgId());
- }
- } else {
- OrgDto orgDto1 = new OrgDto();
- orgDto1.setOrgId(orgDto.getParentOrgId());
- List<OrgDto> orgDtoList1 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto1);
- findCompany(haveOrgList, orgDtoList1);
-
- //涓嬩竴涓骇鍒�
- if (!"2".equals(orgDto.getOrgLevel())) {
- OrgDto orgDto3 = new OrgDto();
- orgDto3.setParentOrgId(orgDto.getOrgId());
- List<OrgDto> orgDtoList2 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto3);
- for (OrgDto orgDto4 : orgDtoList2) {
- haveOrgList.add(orgDto4.getOrgId());
- }
- }
-
+ if (OrgDto.ORG_LEVEL_STORE.equals(orgDto.getOrgLevel())) {
+ continue;
+ }
+ if (OrgDto.ORG_LEVEL_COMPANY.equals(orgDto.getOrgLevel())) {
+ //涓婄骇鍒�
+ OrgDto orgDto1 = new OrgDto();
+ orgDto1.setOrgId(orgDto.getParentOrgId());
+ List<OrgDto> orgDtoList1 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto1);
+ for (OrgDto orgDto2 : orgDtoList1) {
+ haveOrgList.add(orgDto2.getOrgId());
}
+ //鍚岀骇鍒�
+ OrgDto orgDto2 = new OrgDto();
+ orgDto2.setParentOrgId(orgDto.getOrgId());
+ List<OrgDto> orgDtoList2 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto2);
+ for (OrgDto orgDto3 : orgDtoList2) {
+ haveOrgList.add(orgDto3.getOrgId());
+ }
+ } else {
+ OrgDto orgDto1 = new OrgDto();
+ orgDto1.setOrgId(orgDto.getParentOrgId());
+ List<OrgDto> orgDtoList1 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto1);
+ findCompany(haveOrgList, orgDtoList1);
+ //涓嬩竴涓骇鍒�
+ if (!OrgDto.ORG_LEVEL_COMPANY.equals(orgDto.getOrgLevel())) {
+ OrgDto orgDto3 = new OrgDto();
+ orgDto3.setParentOrgId(orgDto.getOrgId());
+ List<OrgDto> orgDtoList2 = orgV1InnerServiceSMOImpl.queryOrgs(orgDto3);
+ for (OrgDto orgDto4 : orgDtoList2) {
+ haveOrgList.add(orgDto4.getOrgId());
+ }
+ }
}
}
-
-
}
}
diff --git a/service-user/src/main/java/com/java110/user/cmd/org/QueryAdminOrgTreeCmd.java b/service-user/src/main/java/com/java110/user/cmd/org/QueryAdminOrgTreeCmd.java
new file mode 100644
index 0000000..9ee0a5c
--- /dev/null
+++ b/service-user/src/main/java/com/java110/user/cmd/org/QueryAdminOrgTreeCmd.java
@@ -0,0 +1,103 @@
+package com.java110.user.cmd.org;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.org.OrgDto;
+import com.java110.dto.org.OrgTreeDto;
+import com.java110.dto.store.StoreDto;
+import com.java110.dto.unit.UnitDto;
+import com.java110.intf.user.IOrgV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.ListUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "org.queryAdminOrgTree")
+public class QueryAdminOrgTreeCmd extends Cmd {
+
+ @Autowired
+ private IOrgV1InnerServiceSMO orgV1InnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+ super.validateAdmin(context);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+ OrgDto orgDto = new OrgDto();
+ orgDto.setStoreTypeCd(StoreDto.STORE_TYPE_PROPERTY);
+ List<OrgDto> orgDtos = orgV1InnerServiceSMOImpl.queryOrgs(orgDto);
+ JSONArray orgs = new JSONArray();
+
+ if(ListUtil.isNull(orgDtos)){
+ context.setResponseEntity(ResultVo.createResponseEntity(orgs));
+ return;
+ }
+
+ JSONObject orgInfo = null;
+ for (OrgDto tmpOrgDto : orgDtos) {
+ if (OrgDto.ORG_LEVEL_STORE.equals(tmpOrgDto.getOrgLevel())) {
+ orgInfo = new JSONObject();
+ orgInfo.put("id", tmpOrgDto.getOrgId());
+ orgInfo.put("orgId", tmpOrgDto.getOrgId());
+ orgInfo.put("text", tmpOrgDto.getOrgName());
+ orgInfo.put("icon", "/img/org.png");
+ orgs.add(orgInfo);
+ }
+ }
+
+ if(ListUtil.isNull(orgs)){
+ context.setResponseEntity(ResultVo.createResponseEntity(orgs));
+ return;
+ }
+
+ for(int orgIndex = 0 ;orgIndex < orgs.size();orgIndex++){
+ orgInfo = orgs.getJSONObject(orgIndex);
+ findChilds(orgInfo, orgDtos);
+
+ }
+ context.setResponseEntity(ResultVo.createResponseEntity(orgs));
+
+ }
+
+ private void findChilds(JSONObject curOrg, List<OrgDto> orgDtos) {
+
+ JSONArray childs = new JSONArray();
+ JSONObject child = null;
+ for (OrgDto orgDto : orgDtos) {
+ if (curOrg.getString("id").equals(orgDto.getOrgId())) { // 浠栬嚜宸辫烦杩�
+ continue;
+ }
+ if (orgDto.getParentOrgId().equals(curOrg.getString("id"))) {//浜岀骇
+ child = new JSONObject();
+ child.put("id", orgDto.getOrgId());
+ child.put("orgId", orgDto.getOrgId());
+ child.put("text", orgDto.getOrgName());
+ child.put("icon", "/img/org.png");
+ childs.add(child);
+ }
+ }
+
+ if (ListUtil.isNull(childs)) {
+ return;
+ }
+
+ curOrg.put("children",childs);
+
+ for(int orgIndex = 0 ;orgIndex < childs.size();orgIndex++){
+ child = childs.getJSONObject(orgIndex);
+ findChilds(child, orgDtos);
+
+ }
+ }
+}
diff --git a/service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffOrgsCmd.java b/service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffOrgsCmd.java
new file mode 100644
index 0000000..6cfc7e9
--- /dev/null
+++ b/service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffOrgsCmd.java
@@ -0,0 +1,109 @@
+package com.java110.user.cmd.user;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.org.OrgDto;
+import com.java110.dto.org.OrgStaffRelDto;
+import com.java110.intf.store.IOrgStaffRelV1InnerServiceSMO;
+import com.java110.intf.user.IOrgV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.List;
+
+@Java110Cmd(serviceCode = "user.listAdminStaffOrgs")
+public class ListAdminStaffOrgsCmd extends Cmd {
+
+ @Autowired
+ private IOrgStaffRelV1InnerServiceSMO orgStaffRelV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IOrgV1InnerServiceSMO orgV1InnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ Assert.hasKeyAndValue(reqJson, "staffId", "鏈寘鍚� 鍛樺伐淇℃伅");
+ super.validateAdmin(context);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+
+ String storeId = context.getReqHeaders().get("store-id");
+ Assert.hasLength(storeId, "鏈寘鍚晢鎴蜂俊鎭�");
+
+ OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
+ orgStaffRelDto.setStaffId(reqJson.getString("staffId"));
+ List<OrgStaffRelDto> orgStaffRels = orgStaffRelV1InnerServiceSMOImpl.queryOrgStaffRels(orgStaffRelDto);
+
+ if (ListUtil.isNull(orgStaffRels)) {
+ return;
+ }
+
+ OrgDto orgDto = new OrgDto();
+ orgDto.setStoreId(orgStaffRels.get(0).getStoreId());
+ List<OrgDto> orgDtos = orgV1InnerServiceSMOImpl.queryOrgs(orgDto);
+ if (ListUtil.isNull(orgDtos)) {
+ return;
+ }
+
+
+ freshOrgName(orgDtos, orgStaffRels);
+ ResultVo resultVo = new ResultVo(1, orgStaffRels.size(), orgStaffRels);
+
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+ context.setResponseEntity(responseEntity);
+
+ }
+
+ private void freshOrgName(List<OrgDto> orgDtos, List<OrgStaffRelDto> orgStaffRels) {
+
+ for (OrgStaffRelDto orgStaffRelDto : orgStaffRels) {
+ orgStaffRelDto.setParentOrgId(orgStaffRelDto.getOrgId());
+ findParents(orgStaffRelDto, orgDtos, null, 0);
+ }
+ }
+
+ private void findParents(OrgStaffRelDto orgStaffRelDto, List<OrgDto> orgDtos, OrgDto curOrgDto, int orgDeep) {
+ for (OrgDto orgDto : orgDtos) {
+ if (!orgStaffRelDto.getParentOrgId().equals(orgDto.getOrgId())) { // 浠栬嚜宸辫烦杩�
+ continue;
+ }
+ orgStaffRelDto.setParentOrgId(orgDto.getParentOrgId());
+ curOrgDto = orgDto;
+ if (StringUtil.isEmpty(orgStaffRelDto.getOrgName())) {
+ orgStaffRelDto.setOrgName(orgDto.getOrgName());
+ continue;
+ }
+ orgStaffRelDto.setOrgName(orgDto.getOrgName() + " / " + orgStaffRelDto.getOrgName());
+ }
+
+ if (curOrgDto != null && OrgDto.ORG_LEVEL_STORE.equals(curOrgDto.getOrgLevel())) {
+ return;
+ }
+
+ if (curOrgDto != null && curOrgDto.getParentOrgId().equals(curOrgDto.getOrgId())) {
+ return;
+ }
+
+ if (curOrgDto != null && "-1".equals(curOrgDto.getParentOrgId())) {
+ return;
+ }
+ orgDeep += 1;
+ if (orgDeep > 20) {
+ return;
+ }
+
+ findParents(orgStaffRelDto, orgDtos, curOrgDto, orgDeep);
+ }
+}
diff --git a/service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffRolesCmd.java b/service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffRolesCmd.java
new file mode 100644
index 0000000..f69479e
--- /dev/null
+++ b/service-user/src/main/java/com/java110/user/cmd/user/ListAdminStaffRolesCmd.java
@@ -0,0 +1,71 @@
+package com.java110.user.cmd.user;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.privilege.PrivilegeUserDto;
+import com.java110.dto.privilege.RoleCommunityDto;
+import com.java110.intf.user.IOrgV1InnerServiceSMO;
+import com.java110.intf.user.IPrivilegeUserV1InnerServiceSMO;
+import com.java110.intf.user.IRoleCommunityV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Java110Cmd(serviceCode = "user.listAdminStaffRoles")
+public class ListAdminStaffRolesCmd extends Cmd {
+
+ @Autowired
+ private IPrivilegeUserV1InnerServiceSMO privilegeUserV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IOrgV1InnerServiceSMO orgV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IRoleCommunityV1InnerServiceSMO roleCommunityV1InnerServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ Assert.hasKeyAndValue(reqJson, "staffId", "鏈寘鍚� 鍛樺伐淇℃伅");
+ super.validateAdmin(context);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+
+
+ PrivilegeUserDto privilegeUserDto = BeanConvertUtil.covertBean(reqJson, PrivilegeUserDto.class);
+ privilegeUserDto.setStoreId("");
+ privilegeUserDto.setUserId(reqJson.getString("staffId"));
+ privilegeUserDto.setPrivilegeFlag(PrivilegeUserDto.PRIVILEGE_FLAG_GROUP);
+ int count = privilegeUserV1InnerServiceSMOImpl.queryPrivilegeUsersCount(privilegeUserDto);
+ List<PrivilegeUserDto> roles = null;
+ if (count > 0) {
+ roles = privilegeUserV1InnerServiceSMOImpl.queryPrivilegeUsers(privilegeUserDto);
+ for (PrivilegeUserDto privilegeUserDto1 : roles) {
+ RoleCommunityDto roleCommunityDto = new RoleCommunityDto();
+ roleCommunityDto.setRoleId(privilegeUserDto1.getpId());
+ roleCommunityDto.setRow(Integer.valueOf("999"));
+ List<RoleCommunityDto> roleCommunityDtos = roleCommunityV1InnerServiceSMOImpl.queryRoleCommunitys(roleCommunityDto);
+ privilegeUserDto1.setRoleCommunityDtoList(roleCommunityDtos);
+ }
+
+
+ } else {
+ roles = new ArrayList<>();
+ }
+ ResultVo resultVo = new ResultVo(1, roles.size(), roles);
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+ context.setResponseEntity(responseEntity);
+
+ }
+}
diff --git a/service-user/src/main/java/com/java110/user/cmd/user/ListStaffRolesCmd.java b/service-user/src/main/java/com/java110/user/cmd/user/ListStaffRolesCmd.java
index 5daffff..4857b26 100644
--- a/service-user/src/main/java/com/java110/user/cmd/user/ListStaffRolesCmd.java
+++ b/service-user/src/main/java/com/java110/user/cmd/user/ListStaffRolesCmd.java
@@ -67,48 +67,8 @@
roles = new ArrayList<>();
}
ResultVo resultVo = new ResultVo(1, roles.size(), roles);
-
ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
-
context.setResponseEntity(responseEntity);
-
- }
-
- private void freshOrgName(List<OrgDto> orgDtos, List<OrgStaffRelDto> orgStaffRels) {
-
- for (OrgStaffRelDto orgStaffRelDto : orgStaffRels) {
- orgStaffRelDto.setParentOrgId(orgStaffRelDto.getOrgId());
- findParents(orgStaffRelDto, orgDtos, null);
- }
- }
-
- private void findParents(OrgStaffRelDto orgStaffRelDto, List<OrgDto> orgDtos, OrgDto curOrgDto) {
- for (OrgDto orgDto : orgDtos) {
- if (!orgStaffRelDto.getParentOrgId().equals(orgDto.getOrgId())) { // 浠栬嚜宸辫烦杩�
- continue;
- }
- orgStaffRelDto.setParentOrgId(orgDto.getParentOrgId());
- curOrgDto = orgDto;
- if (StringUtil.isEmpty(orgStaffRelDto.getOrgName())) {
- orgStaffRelDto.setOrgName(orgDto.getOrgName() );
- continue;
- }
- orgStaffRelDto.setOrgName(orgDto.getOrgName() + " / " + orgStaffRelDto.getOrgName());
- }
-
- if (curOrgDto != null && OrgDto.ORG_LEVEL_STORE.equals(curOrgDto.getOrgLevel())) {
- return;
- }
-
- if (curOrgDto != null && curOrgDto.getParentOrgId().equals(curOrgDto.getOrgId())) {
- return;
- }
-
- if (curOrgDto != null && "-1".equals(curOrgDto.getParentOrgId())) {
- return;
- }
-
- findParents(orgStaffRelDto, orgDtos, curOrgDto);
}
}
diff --git a/service-user/src/main/java/com/java110/user/cmd/user/QueryAdminPropertyStaffCmd.java b/service-user/src/main/java/com/java110/user/cmd/user/QueryAdminPropertyStaffCmd.java
new file mode 100644
index 0000000..05d584a
--- /dev/null
+++ b/service-user/src/main/java/com/java110/user/cmd/user/QueryAdminPropertyStaffCmd.java
@@ -0,0 +1,191 @@
+package com.java110.user.cmd.user;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.doc.annotation.*;
+import com.java110.dto.file.FileRelDto;
+import com.java110.dto.org.OrgDto;
+import com.java110.dto.org.OrgStaffRelDto;
+import com.java110.dto.privilege.BasePrivilegeDto;
+import com.java110.dto.user.UserDto;
+import com.java110.intf.common.IFileRelInnerServiceSMO;
+import com.java110.intf.community.IMenuInnerServiceSMO;
+import com.java110.intf.store.IOrgStaffRelV1InnerServiceSMO;
+import com.java110.intf.user.IOrgStaffRelInnerServiceSMO;
+import com.java110.intf.user.IOrgV1InnerServiceSMO;
+import com.java110.intf.user.IUserInnerServiceSMO;
+import com.java110.intf.user.IUserV1InnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.*;
+import com.java110.vo.api.staff.ApiStaffDataVo;
+import com.java110.vo.api.staff.ApiStaffVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Java110Cmd(serviceCode = "user.queryAdminPropertyStaff")
+public class QueryAdminPropertyStaffCmd extends Cmd {
+
+ @Autowired
+ private IUserInnerServiceSMO userInnerServiceSMOImpl;
+
+ @Autowired
+ private IOrgV1InnerServiceSMO orgV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IOrgStaffRelV1InnerServiceSMO orgStaffRelV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IFileRelInnerServiceSMO fileRelInnerServiceSMOImpl;
+
+ @Autowired
+ private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IMenuInnerServiceSMO menuInnerServiceSMOImpl;
+
+ @Autowired
+ private IOrgStaffRelInnerServiceSMO iOrgStaffRelInnerServiceSMO;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ super.validateAdmin(context);
+ super.validatePageInfo(reqJson);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ UserDto userDto = BeanConvertUtil.covertBean(reqJson, UserDto.class);
+ userDto.setStoreId("");
+
+ int count = userInnerServiceSMOImpl.getStaffCount(userDto);
+ List<ApiStaffDataVo> staffs = new ArrayList<>();
+ if (count > 0) {
+ List<ApiStaffDataVo> staffList = BeanConvertUtil.covertBeanList(userInnerServiceSMOImpl.getStaffs(userDto), ApiStaffDataVo.class);
+ for (ApiStaffDataVo apiStaffDataVo : staffList) {
+ FileRelDto fileRelDto = new FileRelDto();
+ fileRelDto.setObjId(apiStaffDataVo.getUserId());
+ fileRelDto.setRelTypeCd("12000"); //鍛樺伐鍥剧墖
+ List<FileRelDto> fileRelDtos = fileRelInnerServiceSMOImpl.queryFileRels(fileRelDto);
+ if (ListUtil.isNotNull(fileRelDtos)) {
+ List<String> urls = new ArrayList<>();
+ for (FileRelDto fileRel : fileRelDtos) {
+ urls.add(fileRel.getFileRealName());
+ }
+ apiStaffDataVo.setUrls(urls);
+ }
+ staffs.add(apiStaffDataVo);
+ }
+ refreshInitials(staffs);
+ refreshOrgs(staffs);
+ } else {
+ staffs = new ArrayList<>();
+ }
+ ApiStaffVo apiStaffVo = new ApiStaffVo();
+ apiStaffVo.setTotal(count);
+ apiStaffVo.setRecords((int) Math.ceil((double) count / (double) reqJson.getInteger("row")));
+ apiStaffVo.setStaffs(staffs);
+ ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiStaffVo), HttpStatus.OK);
+ context.setResponseEntity(responseEntity);
+ }
+
+ private void refreshOrgs(List<ApiStaffDataVo> staffs) {
+ if (ListUtil.isNull(staffs)) {
+ return;
+ }
+ List<String> staffIds = new ArrayList<>();
+ for (ApiStaffDataVo apiStaffDataVo : staffs) {
+ staffIds.add(apiStaffDataVo.getUserId());
+ }
+ OrgDto orgDto = new OrgDto();
+ orgDto.setStoreId(staffs.get(0).getStoreId());
+ List<OrgDto> orgDtos = orgV1InnerServiceSMOImpl.queryOrgs(orgDto);
+ if (ListUtil.isNull(orgDtos)) {
+ return;
+ }
+ OrgStaffRelDto orgStaffRelDto = new OrgStaffRelDto();
+ orgStaffRelDto.setStaffIds(staffIds.toArray(new String[staffIds.size()]));
+ orgStaffRelDto.setStoreId(staffs.get(0).getStoreId());
+ List<OrgStaffRelDto> orgStaffRels = orgStaffRelV1InnerServiceSMOImpl.queryOrgStaffRels(orgStaffRelDto);
+ if (ListUtil.isNull(orgStaffRels)) {
+ return;
+ }
+ for (ApiStaffDataVo apiStaffDataVo : staffs) {
+ for (OrgStaffRelDto tmpOrgStaffRelDto : orgStaffRels) {
+ if (!apiStaffDataVo.getUserId().equals(tmpOrgStaffRelDto.getStaffId())) {
+ continue;
+ }
+ OrgDto org = new OrgDto();
+ org.setOrgId(tmpOrgStaffRelDto.getOrgId());
+ List<OrgDto> orgs = orgV1InnerServiceSMOImpl.queryOrgs(org);
+ if (ListUtil.isNull(orgs)) {
+ continue;
+ }
+ apiStaffDataVo.setOrgId(tmpOrgStaffRelDto.getOrgId());
+ apiStaffDataVo.setParentTwoOrgId(orgs.get(0).getParentOrgId());
+ }
+ }
+ for (ApiStaffDataVo apiStaffDataVo : staffs) {
+ if (StringUtil.isEmpty(apiStaffDataVo.getOrgId())) {
+ continue;
+ }
+ apiStaffDataVo.setParentOrgId(apiStaffDataVo.getOrgId());
+ findParents(apiStaffDataVo, orgDtos, null, 0);
+ }
+ }
+
+ private void findParents(ApiStaffDataVo apiStaffDataVo, List<OrgDto> orgDtos, OrgDto curOrgDto, int orgDeep) {
+ for (OrgDto orgDto : orgDtos) {
+ curOrgDto = orgDto;
+ if (!apiStaffDataVo.getParentOrgId().equals(orgDto.getOrgId())) { // 浠栬嚜宸辫烦杩�
+ continue;
+ }
+ //濡傛灉鍒颁竴绾� 灏辩粨鏉�
+ if (OrgDto.ORG_LEVEL_STORE.equals(apiStaffDataVo.getOrgLevel())) {
+ continue;
+ }
+ apiStaffDataVo.setParentOrgId(orgDto.getParentOrgId());
+ if (StringUtil.isEmpty(apiStaffDataVo.getOrgName())) {
+ apiStaffDataVo.setOrgName(orgDto.getOrgName());
+ continue;
+ }
+ apiStaffDataVo.setOrgName(orgDto.getOrgName() + " / " + apiStaffDataVo.getOrgName());
+ apiStaffDataVo.setOrgLevel(orgDto.getOrgLevel());
+ }
+ if (curOrgDto != null && OrgDto.ORG_LEVEL_STORE.equals(curOrgDto.getOrgLevel())) {
+ return;
+ }
+ if (curOrgDto != null && curOrgDto.getParentOrgId().equals(curOrgDto.getOrgId())) {
+ return;
+ }
+ if (curOrgDto != null && "-1".equals(curOrgDto.getParentOrgId())) {
+ return;
+ }
+ orgDeep += 1;
+ if (orgDeep > 20) {
+ return;
+ }
+ findParents(apiStaffDataVo, orgDtos, curOrgDto, orgDeep);
+ }
+
+ /**
+ * 鍒峰叆棣栧瓧姣�
+ *
+ * @param staffs
+ */
+ private void refreshInitials(List<ApiStaffDataVo> staffs) {
+ for (ApiStaffDataVo staffDataVo : staffs) {
+ if (StringUtil.isEmpty(staffDataVo.getName())) {
+ continue;
+ }
+ staffDataVo.setInitials(PinYinUtil.getFirstSpell(staffDataVo.getName()).toUpperCase().charAt(0) + "");
+ }
+ }
+}
diff --git a/service-user/src/main/java/com/java110/user/cmd/user/QueryAdminStaffPrivilegeCmd.java b/service-user/src/main/java/com/java110/user/cmd/user/QueryAdminStaffPrivilegeCmd.java
new file mode 100644
index 0000000..b7c61f7
--- /dev/null
+++ b/service-user/src/main/java/com/java110/user/cmd/user/QueryAdminStaffPrivilegeCmd.java
@@ -0,0 +1,79 @@
+package com.java110.user.cmd.user;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.store.StoreDto;
+import com.java110.intf.store.IStoreV1InnerServiceSMO;
+import com.java110.service.context.DataQuery;
+import com.java110.service.smo.IQueryServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+@Java110Cmd(serviceCode = "user.queryAdminStaffPrivilege")
+public class QueryAdminStaffPrivilegeCmd extends Cmd {
+
+ @Autowired
+ private IStoreV1InnerServiceSMO storeV1InnerServiceSMOImpl;
+
+ @Autowired
+ private IQueryServiceSMO queryServiceSMOImpl;
+
+ @Override
+ public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+ super.validateAdmin(context);
+ }
+
+ @Override
+ public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+
+ DataQuery dataQuery = new DataQuery();
+ dataQuery.setServiceCode("query.user.privilege");
+ JSONObject param = new JSONObject();
+ param.put("userId", reqJson.getString("staffId"));
+ param.put("domain", StoreDto.STORE_TYPE_PROPERTY);
+ dataQuery.setRequestParams(param);
+ queryServiceSMOImpl.commonQueryService(dataQuery);
+ ResponseEntity<String> privilegeGroup = dataQuery.getResponseEntity();
+ if (privilegeGroup.getStatusCode() != HttpStatus.OK) {
+ context.setResponseEntity(privilegeGroup);
+ return ;
+ }
+ JSONObject resultObj = JSONObject.parseObject(privilegeGroup.getBody().toString());
+
+ JSONArray privileges = resultObj.getJSONArray("privileges");
+
+ JSONArray tmpPrivilegeArrays = new JSONArray();
+
+ JSONObject privilegeObj = null;
+ for (int privilegeIndex = 0; privilegeIndex < privileges.size(); privilegeIndex++) {
+ privilegeObj = privileges.getJSONObject(privilegeIndex);
+ hasSameData(privilegeObj, tmpPrivilegeArrays);
+ }
+
+ JSONObject resObj = new JSONObject();
+ resObj.put("datas", privileges);
+ context.setResponseEntity(new ResponseEntity<String>(resObj.toJSONString(), HttpStatus.OK));
+ }
+
+ private void hasSameData(JSONObject privilegeObj, JSONArray tmpPrivilegeArrays) {
+ JSONObject tmpPrivilegeObj = null;
+ for (int tmpPrivilegeIndex = 0; tmpPrivilegeIndex < tmpPrivilegeArrays.size(); tmpPrivilegeIndex++) {
+ tmpPrivilegeObj = tmpPrivilegeArrays.getJSONObject(tmpPrivilegeIndex);
+ if (privilegeObj.getString("pId").equals(tmpPrivilegeObj.getString("pId"))) {
+ if (!StringUtil.isEmpty(privilegeObj.getString("pgId"))) {
+ tmpPrivilegeArrays.remove(tmpPrivilegeIndex);
+ tmpPrivilegeArrays.add(privilegeObj);
+ }
+ return;
+ }
+ }
+ tmpPrivilegeArrays.add(privilegeObj);
+ }
+}
--
Gitblit v1.8.0