| | |
| | | private String description; |
| | | private String orgLevel; |
| | | private String storeId; |
| | | |
| | | private String storeTypeCd; |
| | | |
| | | private String orgId; |
| | | private String[] orgIds; |
| | | private String belongCommunityId; |
| | |
| | | public void setOrgIds(String[] orgIds) { |
| | | this.orgIds = orgIds; |
| | | } |
| | | |
| | | public String getStoreTypeCd() { |
| | | return storeTypeCd; |
| | | } |
| | | |
| | | public void setStoreTypeCd(String storeTypeCd) { |
| | | this.storeTypeCd = storeTypeCd; |
| | | } |
| | | } |
| | |
| | | <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> |
| | |
| | | <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> |
| New file |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "taskDetailId", "taskDetailId不能为空"); |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空"); |
| | | super.validateProperty(cmdDataFlowContext); |
| | | |
| | | } |
| | | |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | /** |
| | | * 类表述:查询 |
| | | * 服务编码:maintainanceTaskDetail.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 |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释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); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | 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); |
| | | } |
| | | } |
| New file |
| | |
| | | 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); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | /** |
| | | * 类表述:查询 |
| | | * 服务编码:purchaseApply.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 |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释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("");//解除与用户名相关问题 |
| | | //获取用户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; |
| | | } |
| | | } |
| | |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "resOrderType", "必填,请填写订单类型"); |
| | | super.validatePageInfo(reqJson); |
| | | super.validateProperty(cmdDataFlowContext); |
| | | } |
| | | |
| | | @Override |
| New file |
| | |
| | | /* |
| | | * 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; |
| | | |
| | | |
| | | /** |
| | | * 类表述:查询 员工 某月 排班情况 |
| | | * 服务编码:scheduleClassesStaff.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 |
| | | * 官网:http://www.homecommunity.cn |
| | | * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下 |
| | | * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释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); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | super.validatePageInfo(reqJson); |
| | | Assert.hasKeyAndValue(reqJson, "curDate", "未包含月 YYYY-MM"); |
| | | super.validateProperty(cmdDataFlowContext); |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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; |
| | |
| | | @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") |
| | |
| | | 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(); |
| | |
| | | } |
| | | } |
| | | |
| | | if (childs.size() < 1) { |
| | | if (ListUtil.isNull(childs)) { |
| | | return; |
| | | } |
| | | |
| | |
| | | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | 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); |
| | | |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | 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); |
| | | } |
| | | } |
| New file |
| | |
| | | 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); |
| | | |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| New file |
| | |
| | | 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) + ""); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | 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); |
| | | } |
| | | } |