| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.CmdContextUtils; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | |
| | | import com.java110.intf.store.IAllocationStorehouseApplyInnerServiceSMO; |
| | | 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; |
| | |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException { |
| | | AllocationStorehouseApplyDto allocationStorehouseApplyDto = BeanConvertUtil.covertBean(reqJson, AllocationStorehouseApplyDto.class); |
| | | //调拨记录(调拨记录所有权限查看所有数据) |
| | | String userId = reqJson.getString("userId"); |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/viewlistAllocationStorehouses"); |
| | | basePrivilegeDto.setUserId(userId); |
| | | List<Map> privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto); |
| | | if (privileges.size() == 0) { |
| | | allocationStorehouseApplyDto.setStartUserId(userId); |
| | | } |
| | | privilegeControl(context, allocationStorehouseApplyDto); |
| | | int count = allocationStorehouseApplyInnerServiceSMOImpl.queryAllocationStorehouseApplysCount(allocationStorehouseApplyDto); |
| | | |
| | | List<AllocationStorehouseApplyDto> allocationStorehouseApplyDtos = null; |
| | |
| | | |
| | | context.setResponseEntity(responseEntity); |
| | | } |
| | | |
| | | /** |
| | | * 权限控制 |
| | | * |
| | | * @param context |
| | | * @param allocationStorehouseApplyDto |
| | | */ |
| | | private void privilegeControl(ICmdDataFlowContext context, AllocationStorehouseApplyDto allocationStorehouseApplyDto) { |
| | | if (!StringUtil.isEmpty(allocationStorehouseApplyDto.getApplyId())) { //单个信息查询时不做控制 |
| | | return; |
| | | } |
| | | String userId = CmdContextUtils.getUserId(context); |
| | | BasePrivilegeDto basePrivilegeDto = new BasePrivilegeDto(); |
| | | basePrivilegeDto.setResource("/viewlistAllocationStorehouses"); |
| | | basePrivilegeDto.setUserId(userId); |
| | | List<Map> privileges = menuInnerServiceSMOImpl.checkUserHasResource(basePrivilegeDto); |
| | | if (privileges.size() == 0) { |
| | | allocationStorehouseApplyDto.setStartUserId(userId); |
| | | } |
| | | } |
| | | } |