| | |
| | | Double totalMoney = 0D; |
| | | for(Map<String, Object> m : order){ |
| | | String phone = String.valueOf(m.get("phone")); |
| | | String s = phone.substring(0, 3) + "xxxx" + phone.substring(7 ); |
| | | String s = phone.substring(0, 3) + "****" + phone.substring(7 ); |
| | | m.put("realPhone", s); |
| | | if(m.get("telX")!=null){ |
| | | System.out.println(111); |
| | |
| | | List<Map<String, Object>> order = this.baseMapper.queryOrderInfo(orderId,4,null,null); |
| | | for (Map<String, Object> map : order) { |
| | | String phone = map.get("phone").toString(); |
| | | String s = phone.substring(0, 3) + "xxxx" + phone.substring(7 ); |
| | | String s = phone.substring(0, 3) + "****" + phone.substring(7 ); |
| | | map.put("realPhone", s); |
| | | } |
| | | if(order!=null){ |
| | |
| | | map.put("canOperation",canOperation); |
| | | System.out.println(map); |
| | | String phone = map.get("phone").toString(); |
| | | String s = phone.substring(0, 3) + "xxxx" + phone.substring(7 ); |
| | | String s = phone.substring(0, 3) + "****" + phone.substring(7 ); |
| | | map.put("realPhone", s); |
| | | return map; |
| | | } |
| | |
| | | * 获取订单详情页(服务中的页面) |
| | | * @param orderId |
| | | * @param orderType |
| | | * @param orderType |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | |
| | | map = orderTaxiService.queryOrderInfo(orderTaxi.getId()); |
| | | } |
| | | String phone = map.get("phone").toString(); |
| | | String s = phone.substring(0, 3) + "xxxx" + phone.substring(7 ); |
| | | String s = phone.substring(0, 3) + "****" + phone.substring(7 ); |
| | | map.put("realPhone", s); |
| | | break; |
| | | case 3://城际 |
| | |
| | | return info; |
| | | } |
| | | |
| | | public void clearAuthCache(PrincipalCollection principals) { |
| | | super.clearCachedAuthorizationInfo(principals); |
| | | } |
| | | |
| | | /** |
| | | * 设置认证加密方式 |
| | | */ |
| | |
| | | public List<String> roleNames; // 角色名称集 |
| | | public Integer roleType; // 角色类型 1=平台 2=分公司 3=加盟商 |
| | | public Integer objectId; // 对象ID |
| | | public Integer activeCompanyId; // 当前切换的分公司ID |
| | | public List<Integer> companyIds; // 可管理分公司ID集合 |
| | | public List<String> menuIds; //菜单 |
| | | |
| | | public boolean isAdmin; //是否是超管 |
| | |
| | | public void setObjectId(Integer objectId) { |
| | | this.objectId = objectId; |
| | | } |
| | | |
| | | public Integer getActiveCompanyId() { |
| | | return activeCompanyId; |
| | | } |
| | | |
| | | public void setActiveCompanyId(Integer activeCompanyId) { |
| | | this.activeCompanyId = activeCompanyId; |
| | | } |
| | | |
| | | public List<Integer> getCompanyIds() { |
| | | return companyIds; |
| | | } |
| | | |
| | | public void setCompanyIds(List<Integer> companyIds) { |
| | | this.companyIds = companyIds; |
| | | } |
| | | |
| | | public List<String> getMenuIds() { |
| | | return menuIds; |
| | |
| | | import com.stylefeng.guns.modular.system.dao.RoleMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.Role; |
| | | import com.stylefeng.guns.modular.system.model.SysUserCompanyScope; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.ISysUserCompanyScopeService; |
| | | import org.apache.shiro.authc.CredentialsException; |
| | | import org.apache.shiro.authc.LockedAccountException; |
| | | import org.apache.shiro.authc.SimpleAuthenticationInfo; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @DependsOn("springContextHolder") |
| | |
| | | |
| | | @Autowired |
| | | private RoleMapper roleMapper; |
| | | |
| | | @Autowired |
| | | private ISysUserCompanyScopeService userCompanyScopeService; |
| | | |
| | | public static IShiro me() { |
| | | return SpringContextHolder.getBean(IShiro.class); |
| | |
| | | shiroUser.setDeptName(ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | shiroUser.setName(user.getName()); |
| | | shiroUser.setObjectId(user.getObjectId()); |
| | | shiroUser.setActiveCompanyId(user.getObjectId()); |
| | | shiroUser.setRoleType(user.getRoleType()); |
| | | |
| | | Integer[] roleArray = Convert.toIntArray(user.getRoleid()); |
| | | List<Integer> roleList = new ArrayList<Integer>(); |
| | | List<String> roleNameList = new ArrayList<String>(); |
| | | for (int roleId : roleArray) { |
| | | roleList.add(roleId); |
| | | roleNameList.add(ConstantFactory.me().getSingleRoleName(roleId)); |
| | | |
| | | userCompanyScopeService.ensureDefaultScope(user); |
| | | List<Map<String, Object>> scopes = userCompanyScopeService.selectScopesByUserId(user.getId()); |
| | | if (scopes != null && !scopes.isEmpty()) { |
| | | shiroUser.setCompanyIds(scopes.stream() |
| | | .map(scope -> (Integer) scope.get("companyId")) |
| | | .collect(Collectors.toList())); |
| | | SysUserCompanyScope activeScope = userCompanyScopeService.selectActiveScope(user.getId(), null); |
| | | userCompanyScopeService.applyScopeToShiroUser(shiroUser, activeScope); |
| | | } else { |
| | | Integer[] roleArray = Convert.toIntArray(user.getRoleid()); |
| | | List<Integer> roleList = new ArrayList<Integer>(); |
| | | List<String> roleNameList = new ArrayList<String>(); |
| | | for (int roleId : roleArray) { |
| | | roleList.add(roleId); |
| | | roleNameList.add(ConstantFactory.me().getSingleRoleName(roleId)); |
| | | } |
| | | shiroUser.setRoleList(roleList); |
| | | shiroUser.setRoleNames(roleNameList); |
| | | List<Role> roles = roleMapper.selectBatchIds(roleList); |
| | | shiroUser.setAdmin(roles.stream().filter(s -> s.getTips().equals("administrator")).findAny().isPresent()); |
| | | } |
| | | shiroUser.setRoleList(roleList); |
| | | shiroUser.setRoleNames(roleNameList); |
| | | List<Role> roles = roleMapper.selectBatchIds(roleList); |
| | | shiroUser.setAdmin(roles.stream().filter(s -> s.getTips().equals("administrator")).findAny().isPresent()); |
| | | return shiroUser; |
| | | } |
| | | |
| | |
| | | private ITDriverServiceService tDriverServiceService; |
| | | |
| | | @Autowired |
| | | private IDriverWorkService driverWorkService; |
| | | private ITOrderPrivateCarService orderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private ITOrderTaxiService orderTaxiService; |
| | | |
| | | @Autowired |
| | | private ITOrderCrossCityService orderCrossCityService; |
| | | |
| | | @Autowired |
| | | private ITCarService tCarService; |
| | |
| | | return false; |
| | | } |
| | | |
| | | private String validateCancelledServiceDriverUsage(TCompany oldCompany, TCompany newCompany, boolean includeFranchisee) { |
| | | private String validateCancelledServiceDriverUsage(TCompany oldCompany, TCompany newCompany, boolean includeSubCompanies) { |
| | | if (oldCompany == null || newCompany == null) { |
| | | return null; |
| | | } |
| | |
| | | if (cancelledTypes.isEmpty()) { |
| | | return null; |
| | | } |
| | | List<Integer> driverIds = getCompanyDriverIds(oldCompany.getId(), includeFranchisee); |
| | | List<Integer> driverIds = getCompanyDriverIds(oldCompany.getId(), includeSubCompanies); |
| | | if (driverIds.isEmpty()) { |
| | | return null; |
| | | } |
| | | for (Integer cancelledType : cancelledTypes) { |
| | | if (hasDriverWorkingService(driverIds, cancelledType)) { |
| | | if (hasDriverUnfinishedOrder(driverIds, cancelledType)) { |
| | | return "当前公司内存在司机正在使用" + getServiceName(cancelledType) + "业务,无法变动"; |
| | | } |
| | | } |
| | |
| | | return cancelledTypes; |
| | | } |
| | | |
| | | private List<Integer> getCompanyDriverIds(Integer companyId, boolean includeFranchisee) { |
| | | private List<Integer> getCompanyDriverIds(Integer companyId, boolean includeSubCompanies) { |
| | | List<Integer> driverIds = new ArrayList<>(); |
| | | List<TDriver> companyDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().ne("flag", "3").eq("companyId", companyId)); |
| | | addDriverIds(driverIds, companyDrivers); |
| | | if (!includeFranchisee) { |
| | | List<TDriver> franchiseeDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().ne("flag", "3").eq("franchiseeId", companyId)); |
| | | addDriverIds(driverIds, franchiseeDrivers); |
| | | } |
| | | if (includeFranchisee) { |
| | | List<TCompany> franchiseeList = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("superiorId", companyId).eq("type", 3).ne("flag", "3")); |
| | | for (TCompany franchisee : franchiseeList) { |
| | | List<TDriver> franchiseeDrivers = tDriverService.selectList(new EntityWrapper<TDriver>().ne("flag", "3").eq("franchiseeId", franchisee.getId())); |
| | | addDriverIds(driverIds, franchiseeDrivers); |
| | | } |
| | | List<Integer> companyIds = new ArrayList<>(); |
| | | addCompanyAndSubCompanyIds(companyIds, companyId, includeSubCompanies); |
| | | for (Integer id : companyIds) { |
| | | addDriverIds(driverIds, tDriverService.selectList(new EntityWrapper<TDriver>().ne("flag", "3").eq("companyId", id))); |
| | | addDriverIds(driverIds, tDriverService.selectList(new EntityWrapper<TDriver>().ne("flag", "3").eq("franchiseeId", id))); |
| | | } |
| | | return driverIds; |
| | | } |
| | | |
| | | private void addCompanyAndSubCompanyIds(List<Integer> companyIds, Integer companyId, boolean includeSubCompanies) { |
| | | if (companyId == null || companyIds.contains(companyId)) { |
| | | return; |
| | | } |
| | | companyIds.add(companyId); |
| | | if (!includeSubCompanies) { |
| | | return; |
| | | } |
| | | List<TCompany> childCompanies = tCompanyService.selectList(new EntityWrapper<TCompany>().eq("superiorId", companyId).ne("flag", "3")); |
| | | for (TCompany childCompany : childCompanies) { |
| | | if (childCompany != null) { |
| | | addCompanyAndSubCompanyIds(companyIds, childCompany.getId(), true); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void addDriverIds(List<Integer> driverIds, List<TDriver> drivers) { |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean hasDriverWorkingService(List<Integer> driverIds, Integer serviceType) { |
| | | private boolean hasDriverUnfinishedOrder(List<Integer> driverIds, Integer serviceType) { |
| | | if (driverIds == null || driverIds.isEmpty() || serviceType == null) { |
| | | return false; |
| | | } |
| | | return driverWorkService.selectCount(new EntityWrapper<DriverWork>() |
| | | .in("driverId", driverIds) |
| | | .eq("state", 1) |
| | | .like("type", String.valueOf(serviceType))) > 0; |
| | | if (Integer.valueOf(1).equals(serviceType)) { |
| | | return orderPrivateCarService.selectCount(new EntityWrapper<TOrderPrivateCar>() |
| | | .eq("isDelete", 1) |
| | | .in("driverId", driverIds) |
| | | .notIn("state", 8, 9, 10, 12)) > 0; |
| | | } |
| | | if (Integer.valueOf(2).equals(serviceType)) { |
| | | return orderTaxiService.selectCount(new EntityWrapper<TOrderTaxi>() |
| | | .eq("isDelete", 1) |
| | | .in("driverId", driverIds) |
| | | .notIn("state", 8, 9, 10, 12)) > 0; |
| | | } |
| | | if (Integer.valueOf(3).equals(serviceType)) { |
| | | return orderCrossCityService.selectCount(new EntityWrapper<TOrderCrossCity>() |
| | | .eq("isDelete", 1) |
| | | .in("driverId", driverIds) |
| | | .notIn("state", 8, 9, 10, 12)) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private String getServiceName(Integer serviceType) { |
| | |
| | | tDispatch.setInsertUserRole(roleType); |
| | | tDispatch.setState(1); |
| | | if (tDispatch.getCompanyId() == null) { |
| | | Integer objectId1 = userService.selectById(ShiroKit.getUser().getId()).getObjectId(); |
| | | tDispatch.setCompanyId(objectId1); |
| | | tDispatch.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | } |
| | | tDispatch.setPassword(ShiroKit.md5(tDispatch.getPassword(), "WL:x9#")); |
| | | tDispatchService.insert(tDispatch); |
| | |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | | import com.stylefeng.guns.core.log.factory.LogTaskFactory; |
| | | import com.stylefeng.guns.core.node.MenuNode; |
| | | import com.stylefeng.guns.core.shiro.ShiroDbRealm; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.shiro.factory.IShiro; |
| | |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.dao.TCompanyMapper; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.model.SysUserCompanyScope; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.IMenuService; |
| | | import com.stylefeng.guns.modular.system.service.IRelationService; |
| | | import com.stylefeng.guns.modular.system.service.ISysUserCompanyScopeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | |
| | | |
| | | @Autowired |
| | | private IRelationService relationService; |
| | | |
| | | @Autowired |
| | | private ISysUserCompanyScopeService userCompanyScopeService; |
| | | |
| | | @Autowired |
| | | private ShiroDbRealm shiroDbRealm; |
| | | |
| | | |
| | | /** |
| | |
| | | model.addAttribute("tips", "请重新登录"); |
| | | return "/login.html"; |
| | | } |
| | | //设置上级ID |
| | | if (SinataUtil.isNotEmpty(user.getObjectId())){ |
| | | shiroUser.setObjectId(user.getObjectId()); |
| | | } |
| | | //设置角色 |
| | | shiroUser.setRoleType(user.getRoleType()); |
| | | |
| | | model.addAttribute("titles", titles); |
| | | model.addAttribute("companyScopes", userCompanyScopeService.selectScopesByUserId(shiroUser.getId())); |
| | | model.addAttribute("currentCompanyId", shiroUser.getObjectId()); |
| | | model.addAttribute("currentCompanyName", tCompany == null ? "" : tCompany.getName()); |
| | | |
| | | //获取用户头像 |
| | | String avatar = user.getAvatar(); |
| | |
| | | |
| | | return REDIRECT + "/"; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mgr/companyScopes", method = RequestMethod.GET) |
| | | public ResultUtil companyScopes() { |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | if (shiroUser == null) { |
| | | return ResultUtil.error("请重新登录"); |
| | | } |
| | | return ResultUtil.success(userCompanyScopeService.selectScopesByUserId(shiroUser.getId())); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "/mgr/switchCompany", method = RequestMethod.POST) |
| | | public ResultUtil switchCompany(Integer companyId) { |
| | | ShiroUser shiroUser = ShiroKit.getUser(); |
| | | if (shiroUser == null || companyId == null) { |
| | | return ResultUtil.error("参数异常"); |
| | | } |
| | | SysUserCompanyScope scope = userCompanyScopeService.selectActiveScope(shiroUser.getId(), companyId); |
| | | if (scope == null) { |
| | | return ResultUtil.error("当前账号未绑定该分公司"); |
| | | } |
| | | userCompanyScopeService.applyScopeToShiroUser(shiroUser, scope); |
| | | ShiroKit.setSessionAttr("shiroUser", shiroUser); |
| | | shiroDbRealm.clearAuthCache(ShiroKit.getSubject().getPrincipals()); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | import com.stylefeng.guns.core.util.Convert; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.Role; |
| | | import com.stylefeng.guns.modular.system.model.SysUserCompanyScope; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.service.IRoleService; |
| | | import com.stylefeng.guns.modular.system.service.ISysUserCompanyScopeService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | | import com.stylefeng.guns.modular.system.warpper.RoleWarpper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private IRoleService roleService; |
| | | |
| | | @Autowired |
| | | private ISysUserCompanyScopeService userCompanyScopeService; |
| | | |
| | | |
| | | /** |
| | |
| | | public List<ZTreeNode> roleTreeListByUserId(@PathVariable Integer userId) { |
| | | User theUser = this.userService.selectById(userId); |
| | | ShiroUser user1 = ShiroKit.getUser(); |
| | | String roleid = theUser.getRoleid(); |
| | | SysUserCompanyScope scope = userCompanyScopeService.selectActiveScope(userId, user1.getObjectId()); |
| | | String roleid = scope == null ? theUser.getRoleid() : scope.getRoleid(); |
| | | if (ToolUtil.isEmpty(roleid)) { |
| | | List<ZTreeNode> roleTreeList = this.roleService.roleTreeList(user1.getObjectId()); |
| | | return roleTreeList; |
| | |
| | | package com.stylefeng.guns.modular.system.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.config.properties.GunsProperties; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | |
| | | import com.stylefeng.guns.modular.system.factory.UserFactory; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | import com.stylefeng.guns.modular.system.model.SysUserCompanyScope; |
| | | import com.stylefeng.guns.modular.system.service.ISysUserCompanyScopeService; |
| | | import com.stylefeng.guns.modular.system.service.ITCompanyService; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import com.stylefeng.guns.modular.system.service.IUserService; |
| | |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ISysUserCompanyScopeService userCompanyScopeService; |
| | | |
| | | |
| | | /** |
| | | * 跳转到查看管理员列表的页面 |
| | |
| | | * 跳转到查看管理员列表的页面 |
| | | */ |
| | | @RequestMapping("/user_add") |
| | | public String addView() { |
| | | public String addView(Model model) { |
| | | model.addAttribute("roleType", ShiroKit.getUser().getRoleType()); |
| | | model.addAttribute("companyList", getAvailableCompanies()); |
| | | return PREFIX + "user_add.html"; |
| | | } |
| | | |
| | |
| | | model.addAttribute(user); |
| | | model.addAttribute("roleName", ConstantFactory.me().getRoleName(user.getRoleid())); |
| | | model.addAttribute("deptName", ConstantFactory.me().getDeptName(user.getDeptid())); |
| | | model.addAttribute("roleType", ShiroKit.getUser().getRoleType()); |
| | | model.addAttribute("companyList", getAvailableCompanies()); |
| | | model.addAttribute("companyScopes", userCompanyScopeService.selectScopesByUserId(userId)); |
| | | LogObjectHolder.me().set(user); |
| | | return PREFIX + "user_edit.html"; |
| | | } |
| | |
| | | throw new GunsException(BizExceptionEnum.USER_ALREADY_REG); |
| | | } |
| | | ShiroUser user1 = ShiroKit.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | TCompany tCompany = companyService.selectById(user1.getObjectId()); |
| | | |
| | | // 完善账号信息 |
| | | user.setSalt(ShiroKit.getRandomSalt(5)); |
| | |
| | | |
| | | User objectUser = UserFactory.createUser(user); |
| | | objectUser.setObjectId(user1.getObjectId()); |
| | | objectUser.setRoleType(2); |
| | | objectUser.setEntercode(tCompany.getEnterCode()); |
| | | objectUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | this.userService.insert(objectUser); |
| | | if (SinataUtil.isNotEmpty(user.getCompanyScopes())) { |
| | | userCompanyScopeService.saveScopes(objectUser.getId(), user.getCompanyScopes(), objectUser.getObjectId(), objectUser.getRoleid(), objectUser.getDeptid()); |
| | | } else { |
| | | userCompanyScopeService.ensureDefaultScope(objectUser); |
| | | } |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | } |
| | | User oldUser = userService.selectById(user.getId()); |
| | | ShiroUser user1 = ShiroKit.getUser(); |
| | | User user2 = userService.selectById(user1.getId()); |
| | | TCompany tCompany = companyService.selectById(user2.getObjectId()); |
| | | TCompany tCompany = companyService.selectById(user1.getObjectId()); |
| | | |
| | | oldUser.setEntercode(tCompany.getEnterCode()); |
| | | oldUser.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | user.setEntercode(tCompany.getEnterCode()); |
| | | user.setEnterId(Long.valueOf(tCompany.getEnterCode())); |
| | | this.userService.updateById(UserFactory.editUser(user, oldUser)); |
| | | if (SinataUtil.isNotEmpty(user.getCompanyScopes())) { |
| | | userCompanyScopeService.saveScopes(oldUser.getId(), user.getCompanyScopes(), oldUser.getObjectId(), oldUser.getRoleid(), oldUser.getDeptid()); |
| | | } else { |
| | | userCompanyScopeService.ensureDefaultScope(oldUser); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | |
| | | throw new GunsException(BizExceptionEnum.CANT_CHANGE_ADMIN); |
| | | } |
| | | this.userService.setRoles(userId, roleIds); |
| | | SysUserCompanyScope scope = userCompanyScopeService.selectActiveScope(userId, ShiroKit.getUser().getObjectId()); |
| | | if (scope != null) { |
| | | scope.setRoleid(roleIds); |
| | | scope.setUpdateTime(new Date()); |
| | | userCompanyScopeService.updateById(scope); |
| | | } else { |
| | | User user = userService.selectById(userId); |
| | | SysUserCompanyScope newScope = new SysUserCompanyScope(); |
| | | newScope.setUserId(userId); |
| | | newScope.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | newScope.setRoleid(roleIds); |
| | | newScope.setDeptid(user.getDeptid()); |
| | | newScope.setIsDefault(2); |
| | | newScope.setStatus(1); |
| | | newScope.setCreateTime(new Date()); |
| | | newScope.setUpdateTime(new Date()); |
| | | userCompanyScopeService.insert(newScope); |
| | | } |
| | | |
| | | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @RequestMapping("/companyScopeOptions") |
| | | @ResponseBody |
| | | public Object companyScopeOptions() { |
| | | return getAvailableCompanies(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | return pictureName; |
| | | } |
| | | |
| | | private List<TCompany> getAvailableCompanies() { |
| | | ShiroUser user = ShiroKit.getUser(); |
| | | EntityWrapper<TCompany> wrapper = new EntityWrapper<TCompany>(); |
| | | wrapper.eq("type", 2); |
| | | wrapper.ne("flag", 3); |
| | | wrapper.orderBy("id", false); |
| | | if (user != null && user.getRoleType() != null && user.getRoleType() == 2) { |
| | | wrapper.eq("id", user.getObjectId()); |
| | | } |
| | | return companyService.selectList(wrapper); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | SELECT * FROM (select CASE when d2.simplename is null then d1.simplename else d2.simplename end as parentName, |
| | | case when uu.sex = 1 then '男' when uu.sex = 2 then '女' else '' end as sexName, |
| | | d1.simplename as deptName,case when uu.status = 1 then '启用' when uu.status = 2 then '冻结' when uu.status = 3 then '删除' else '' end as statusName, |
| | | rr.roleName, |
| | | IFNULL(srr.roleName, rr.roleName) as roleName, |
| | | ucs.companyId as scopeCompanyId, |
| | | uu.* from sys_user as uu |
| | | LEFT JOIN sys_user_company_scope ucs on ucs.userId = uu.id and ucs.status = 1 and ucs.companyId = #{objectId} |
| | | LEFT JOIN sys_dept as d1 on d1.id = uu.deptid |
| | | LEFT JOIN sys_dept as d2 on d2.id = d1.pid |
| | | LEFT JOIN (select s.id,s.name,GROUP_CONCAT(r.name) as roleName from sys_user s |
| | | left join sys_role r on find_in_set(r.id,s.roleid) group by s.id) as rr on rr.id = uu.id |
| | | LEFT JOIN (select s.userId,s.companyId,GROUP_CONCAT(r.name) as roleName from sys_user_company_scope s |
| | | left join sys_role r on find_in_set(r.id,s.roleid) where s.status = 1 group by s.userId,s.companyId) as srr on srr.userId = uu.id and srr.companyId = ucs.companyId |
| | | ) as o |
| | | <where> |
| | | o.status != 3 |
| | |
| | | and (o.createTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59')) |
| | | </if> |
| | | <if test="null != objectId"> |
| | | and o.objectId = #{objectId} |
| | | and (o.objectId = #{objectId} or o.scopeCompanyId = #{objectId}) |
| | | </if> |
| | | </where> |
| | | order by o.id desc |
| | |
| | | @Override |
| | | public Map<String, Object> queryUserActivityList(Integer uid, Date start, Date end, String name, Integer status, Integer offset, Integer limit) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Integer objectId = userService.selectById(uid).getObjectId(); |
| | | Integer objectId = ShiroKit.getUser() == null ? userService.selectById(uid).getObjectId() : ShiroKit.getUser().getObjectId(); |
| | | List<Map<String, Object>> list = userActivityMapper.queryUserActivityList(objectId, start, end, name, status, offset, limit); |
| | | int i = userActivityMapper.queryUserActivityListCount(objectId, start, end, name, status); |
| | | map.put("rows", list); |
| | |
| | | private Date createtime; |
| | | private Integer version; |
| | | private String avatar; |
| | | private String companyScopes; |
| | | /** |
| | | * 中台员工ID |
| | | */ |
| | |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getCompanyScopes() { |
| | | return companyScopes; |
| | | } |
| | | |
| | | public void setCompanyScopes(String companyScopes) { |
| | | this.companyScopes = companyScopes; |
| | | } |
| | | |
| | | public Long getEmpId() { |
| | | return empId; |
| | |
| | | </form> |
| | | </div> |
| | | <ul class="nav navbar-top-links navbar-right"> |
| | | @if(isNotEmpty(companyScopes) && companyScopes.~size > 1){ |
| | | <li class="dropdown"> |
| | | <a class="dropdown-toggle" data-toggle="dropdown" href="#"> |
| | | <i class="fa fa-building"></i> |
| | | <span id="currentCompanyName">${currentCompanyName}</span> |
| | | <span class="caret"></span> |
| | | </a> |
| | | <ul class="dropdown-menu dropdown-alerts"> |
| | | @for(scope in companyScopes){ |
| | | <li> |
| | | <a href="javascript:void(0);" onclick="switchCurrentCompany(${scope.companyId})"> |
| | | <div> |
| | | ${scope.companyName} |
| | | @if(scope.companyId == currentCompanyId){ |
| | | <span class="pull-right text-muted small">当前</span> |
| | | @} |
| | | </div> |
| | | </a> |
| | | </li> |
| | | @} |
| | | </ul> |
| | | </li> |
| | | @} |
| | | <li class="dropdown hidden-xs"> |
| | | <a class="right-sidebar-toggle" aria-expanded="false"> |
| | | <i class="fa fa-tasks"></i> 主题 |
| | |
| | | <div class="pull-right">© 2019-2021 <a href="#" onclick="return false" target="_blank">约客多出行</a> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <!-- 第三方插件 --> |
| | | <script src="${ctxPath}/static/js/plugins/pace/pace.min.js"></script> |
| | | <script> |
| | | function switchCurrentCompany(companyId) { |
| | | $.post("${ctxPath}/mgr/switchCompany", {companyId: companyId}, function (res) { |
| | | if (res && res.code === 200) { |
| | | window.location.reload(); |
| | | } else { |
| | | layer.alert((res && (res.msg || res.message)) || "切换分公司失败"); |
| | | } |
| | | }).fail(function () { |
| | | layer.alert("切换分公司失败"); |
| | | }); |
| | | } |
| | | </script> |
| | | |
| | | </body> |
| | | |
| | |
| | | <div class="form-horizontal" id="userInfoForm"> |
| | | |
| | | <input type="hidden" id="id" value=""> |
| | | <input type="hidden" id="companyScopes" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">可管理分公司</label> |
| | | <div class="col-sm-10"> |
| | | <select id="companyScopeIds" class="form-control" multiple="multiple" style="height: 120px;"> |
| | | @for(company in companyList){ |
| | | <option value="${company.id}">${company.name}</option> |
| | | @} |
| | | </select> |
| | | <span class="help-block m-b-none">不选择时默认绑定当前分公司;多选后可切换到对应分公司再分配该分公司角色。</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 这是部门选择的下拉框 --> |
| | | <div id="menuContent" class="menuContent" |
| | |
| | | |
| | | <input type="hidden" id="id" value="${user.id}"> |
| | | <input type="hidden" id="sexValue" value="${user.sex}"> |
| | | <input type="hidden" id="companyScopes" value=""> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-6 b-r"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">可管理分公司</label> |
| | | <div class="col-sm-10"> |
| | | <select id="companyScopeIds" class="form-control" multiple="multiple" style="height: 120px;"> |
| | | @for(company in companyList){ |
| | | <option value="${company.id}">${company.name}</option> |
| | | @} |
| | | </select> |
| | | <span class="help-block m-b-none">多选后保存绑定关系;角色可切换到对应分公司后使用角色分配设置。</span> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 这是部门选择的下拉框 --> |
| | | <div id="menuContent" class="menuContent" |
| | |
| | | laydate.render({ |
| | | elem: '#birthday' |
| | | }); |
| | | var userCompanyScopes = [ |
| | | @for(scope in companyScopes){ |
| | | { |
| | | companyId: "${scope.companyId}", |
| | | roleid: "${scope.roleid!}", |
| | | deptid: "${scope.deptid!}", |
| | | isDefault: "${scope.isDefault!2}" |
| | | }, |
| | | @} |
| | | ]; |
| | | $(function () { |
| | | var ids = []; |
| | | for (var i = 0; i < userCompanyScopes.length; i++) { |
| | | ids.push(userCompanyScopes[i].companyId); |
| | | } |
| | | $("#companyScopeIds").val(ids); |
| | | }); |
| | | </script> |
| | | @} |
| | |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加管理员', |
| | | area: ['800px', '560px'], //宽高 |
| | | area: ['800px', '660px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/mgr/user_add' |
| | |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '编辑管理员', |
| | | area: ['800px', '450px'], //宽高 |
| | | area: ['800px', '600px'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/mgr/user_edit/' + this.seItem.id |
| | |
| | | UserInfoDlg.collectData = function () { |
| | | this.set('id').set('account').set('sex').set('password').set('avatar') |
| | | .set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone'); |
| | | this.userInfoData['companyScopes'] = UserInfoDlg.buildCompanyScopes(); |
| | | }; |
| | | |
| | | UserInfoDlg.buildCompanyScopes = function () { |
| | | var companyIds = $("#companyScopeIds").val(); |
| | | var deptid = $("#deptid").val(); |
| | | if (!companyIds || companyIds.length === 0 || !deptid) { |
| | | return ""; |
| | | } |
| | | var oldScopes = {}; |
| | | if (typeof userCompanyScopes !== "undefined") { |
| | | for (var i = 0; i < userCompanyScopes.length; i++) { |
| | | oldScopes[userCompanyScopes[i].companyId] = userCompanyScopes[i]; |
| | | } |
| | | } |
| | | var defaultCompanyId = companyIds[0]; |
| | | for (var k = 0; k < companyIds.length; k++) { |
| | | var candidate = oldScopes[companyIds[k]]; |
| | | if (candidate && candidate.isDefault == 1) { |
| | | defaultCompanyId = companyIds[k]; |
| | | break; |
| | | } |
| | | } |
| | | var scopes = []; |
| | | for (var j = 0; j < companyIds.length; j++) { |
| | | var oldScope = oldScopes[companyIds[j]] || {}; |
| | | scopes.push({ |
| | | companyId: parseInt(companyIds[j]), |
| | | roleid: oldScope.roleid || "", |
| | | deptid: parseInt(oldScope.deptid || deptid), |
| | | isDefault: companyIds[j] == defaultCompanyId ? 1 : 2 |
| | | }); |
| | | } |
| | | return JSON.stringify(scopes); |
| | | }; |
| | | |
| | | /** |
| | |
| | | and ls.state = 1 |
| | | and l.state = 1 |
| | | and str_to_date(concat(date_format(lsd.`day`, '%Y-%m-%d'), ' ', ls.endTime), '%Y-%m-%d %H:%i') >= now() |
| | | and not ( |
| | | exists ( |
| | | select 1 from t_order_cross_city occ |
| | | where occ.lineShiftDriverId = lsd.id |
| | | and occ.isDelete = 1 |
| | | and occ.state != 10 |
| | | ) |
| | | and not exists ( |
| | | select 1 from t_order_cross_city occ |
| | | where occ.lineShiftDriverId = lsd.id |
| | | and occ.isDelete = 1 |
| | | and occ.state not in (6, 8, 9, 10) |
| | | ) |
| | | ) |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | and lsd.`day` is not null |
| | | and lsd.lineShiftId = -1 |
| | | and str_to_date(concat(date_format(lsd.`day`, '%Y-%m-%d'), ' ', st.startTime), '%Y-%m-%d %H:%i') >= now() |
| | | and not ( |
| | | exists ( |
| | | select 1 from t_order_cross_city occ |
| | | where occ.lineShiftDriverId = lsd.id |
| | | and occ.isDelete = 1 |
| | | and occ.state != 10 |
| | | ) |
| | | and not exists ( |
| | | select 1 from t_order_cross_city occ |
| | | where occ.lineShiftDriverId = lsd.id |
| | | and occ.isDelete = 1 |
| | | and occ.state not in (6, 8, 9, 10) |
| | | ) |
| | | ) |
| | | ) t |
| | | order by t.`day` asc, t.startTime asc, t.lineShiftDriverId asc |
| | | </select> |
| | |
| | | */ |
| | | @Override |
| | | public ResultUtil<ScanOrderDetailWarpper> queryScanOrderDetail(Integer lineShiftDriverId) throws Exception { |
| | | if (isScanShiftFinished(lineShiftDriverId)) { |
| | | return ResultUtil.error("该行程已结束"); |
| | | } |
| | | // 1. 查询基础数据 |
| | | Map<String, Object> data = lineShiftDriverMapper.queryScanOrderDetail(lineShiftDriverId); |
| | | if (data == null || data.isEmpty()) { |
| | |
| | | // 1. 参数校验 |
| | | if (warpper.getLineShiftDriverId() == null) { |
| | | return ResultUtil.error("班次ID不能为空"); |
| | | } |
| | | if (isScanShiftFinished(warpper.getLineShiftDriverId())) { |
| | | return ResultUtil.error("该行程已结束"); |
| | | } |
| | | if (warpper.getPeopleNumber() == null || warpper.getPeopleNumber() < 1 || warpper.getPeopleNumber() > 7) { |
| | | return ResultUtil.error("乘车人数必须在1-7之间"); |
| | |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | private boolean isScanShiftFinished(Integer lineShiftDriverId) throws Exception { |
| | | if (lineShiftDriverId == null) { |
| | | return false; |
| | | } |
| | | LineShiftDriver lineShiftDriver = lineShiftDriverMapper.selectById(lineShiftDriverId); |
| | | if (lineShiftDriver == null) { |
| | | return false; |
| | | } |
| | | if (isLineShiftTimeFinished(lineShiftDriver)) { |
| | | return true; |
| | | } |
| | | return isAllValidOrdersFinished(lineShiftDriverId); |
| | | } |
| | | |
| | | private boolean isLineShiftTimeFinished(LineShiftDriver lineShiftDriver) throws Exception { |
| | | if (lineShiftDriver == null || lineShiftDriver.getDay() == null) { |
| | | return false; |
| | | } |
| | | String endTime = null; |
| | | if (lineShiftDriver.getLineShiftId() != null && lineShiftDriver.getLineShiftId() == -1) { |
| | | Integer customerId = lineShiftDriverMapper.queryCustomerIdByLineShiftDriverId(lineShiftDriver.getId()); |
| | | if (customerId != null) { |
| | | DriverSelfTrip selfTrip = driverSelfTripMapper.selectById(customerId); |
| | | if (selfTrip != null) { |
| | | endTime = selfTrip.getStartTime(); |
| | | } |
| | | } |
| | | } else if (lineShiftDriver.getLineShiftId() != null) { |
| | | LineSite lineSite = lineSiteService.selectById(lineShiftDriver.getLineShiftId()); |
| | | if (lineSite != null) { |
| | | endTime = lineSite.getEndTime(); |
| | | } |
| | | } |
| | | if (ToolUtil.isEmpty(endTime)) { |
| | | return false; |
| | | } |
| | | if (endTime.contains("-")) { |
| | | String[] timeRange = endTime.split("-"); |
| | | endTime = timeRange[timeRange.length - 1]; |
| | | } |
| | | String[] split = endTime.split(":"); |
| | | if (split.length < 2) { |
| | | return false; |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(lineShiftDriver.getDay()); |
| | | calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(split[0])); |
| | | calendar.set(Calendar.MINUTE, Integer.parseInt(split[1])); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | return calendar.getTimeInMillis() < System.currentTimeMillis(); |
| | | } |
| | | |
| | | private boolean isAllValidOrdersFinished(Integer lineShiftDriverId) { |
| | | int orderCount = this.selectCount(new EntityWrapper<OrderCrossCity>() |
| | | .eq("lineShiftDriverId", lineShiftDriverId) |
| | | .eq("isDelete", 1) |
| | | .ne("state", 10)); |
| | | if (orderCount <= 0) { |
| | | return false; |
| | | } |
| | | int finishCount = this.selectCount(new EntityWrapper<OrderCrossCity>() |
| | | .eq("lineShiftDriverId", lineShiftDriverId) |
| | | .eq("isDelete", 1) |
| | | .in("state", Arrays.asList(6, 8, 9))); |
| | | return orderCount == finishCount; |
| | | } |
| | | |
| | | public ResultUtil<Map<String, Object>> getPriceV2(Integer lineId, LineShiftDriver lineShiftDriver, OrderCrossCityScanWarpper warpper) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("distance", 0); |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | |
| | | public void setEvaluate(Double evaluate) { |
| | | this.evaluate = evaluate; |
| | | this.evaluate = roundOneDecimal(evaluate); |
| | | } |
| | | |
| | | public Double getPrice() { |
| | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | private static Double roundOneDecimal(Double value) { |
| | | if (value == null) { |
| | | return 0D; |
| | | } |
| | | return new BigDecimal(String.valueOf(value)).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | /** |
| | | * 【202601】扫码下单详情包装类 |
| | | */ |
| | |
| | | @ApiModelProperty("终点默认点纬度") |
| | | private Double endDefaultPointLat; |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = roundOneDecimal(score); |
| | | } |
| | | |
| | | private static Double roundOneDecimal(Double value) { |
| | | if (value == null) { |
| | | return 0D; |
| | | } |
| | | return new BigDecimal(String.valueOf(value)).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | |
| | | public void setFraction(Double fraction) { |
| | | this.fraction = fraction; |
| | | this.fraction = roundOneDecimal(fraction); |
| | | } |
| | | |
| | | public List<JSONObject> getList() { |
| | |
| | | } |
| | | return driverInfoWarpper; |
| | | } |
| | | |
| | | private static Double roundOneDecimal(Double value) { |
| | | if (value == null) { |
| | | return 0D; |
| | | } |
| | | return new BigDecimal(String.valueOf(value)).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.Map; |
| | | |
| | | @ApiModel("订单中的司机") |
| | |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | this.score = roundOneDecimal(score); |
| | | } |
| | | |
| | | public Integer getNum() { |
| | |
| | | } |
| | | return orderDriverWarpper; |
| | | } |
| | | |
| | | private static Double roundOneDecimal(Double value) { |
| | | if (value == null) { |
| | | return 0D; |
| | | } |
| | | return new BigDecimal(String.valueOf(value)).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | this.score = roundOneDecimal(score); |
| | | } |
| | | |
| | | public Integer getOrderNum() { |
| | |
| | | } |
| | | return orderInfoWarpper; |
| | | } |
| | | |
| | | private static Double roundOneDecimal(Double value) { |
| | | if (value == null) { |
| | | return 0D; |
| | | } |
| | | return new BigDecimal(String.valueOf(value)).setScale(1, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | } |