| | |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.ObsUploadUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.UUIDUtil; |
| | | import com.stylefeng.guns.modular.system.dao.UserMapper; |
| | | import com.stylefeng.guns.modular.system.factory.UserFactory; |
| | | import com.stylefeng.guns.modular.system.model.TAgent; |
| | | import com.stylefeng.guns.modular.system.model.TBranchOffice; |
| | | import com.stylefeng.guns.modular.system.model.TCompany; |
| | | import com.stylefeng.guns.modular.system.model.User; |
| | | 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 com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.transfer.UserDto; |
| | | import com.stylefeng.guns.modular.system.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.system.util.huawei.OBSUtil; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.naming.NoPermissionException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.validation.Valid; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.io.InputStream; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 系统管理员控制器 |
| | |
| | | |
| | | @Autowired |
| | | private ITDriverService itDriverService; |
| | | @Autowired |
| | | private ITAgentService agentService; |
| | | @Autowired |
| | | private ITBranchOfficeService branchOfficeService; |
| | | |
| | | |
| | | /** |
| | |
| | | page.setRecords(userService.getUserListPage(page,null, name, beginTime, endTime, deptid)); |
| | | return super.packForBT(page); |
| | | } else { |
| | | DataScope dataScope = new DataScope(ShiroKit.getDeptDataScope()); |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(userService.getUserListPage(page,dataScope, name, beginTime, endTime, deptid)); |
| | | return super.packForBT(page); |
| | | Integer objectId = Objects.requireNonNull(ShiroKit.getUser()).getObjectId(); |
| | | Integer roleType = Objects.requireNonNull(ShiroKit.getUser()).getRoleType(); |
| | | |
| | | if(roleType == 3){ |
| | | // 查询下级分公司账号 |
| | | TAgent tAgent = agentService.selectById(objectId); |
| | | List<TBranchOffice> branchOffices = branchOfficeService.selectList(new EntityWrapper<TBranchOffice>() |
| | | .eq("agentId", tAgent.getId())); |
| | | |
| | | List<Integer> officeIds = branchOffices.stream().map(TBranchOffice::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(officeIds)){ |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(new ArrayList<>()); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | // List<User> userList = userService.selectList(new EntityWrapper<User>() |
| | | // .in("object_id", officeIds)); |
| | | // List<Integer> userIds = userList.stream().map(User::getId).collect(Collectors.toList()); |
| | | |
| | | DataScope dataScope = new DataScope(ShiroKit.getDeptDataScope()); |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | List<Map<String, Object>> userListPage = userService.getUserListPageAgent(page, null, name, beginTime, endTime, deptid,officeIds); |
| | | page.setRecords(userListPage); |
| | | return super.packForBT(page); |
| | | }else { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(new ArrayList<>()); |
| | | return super.packForBT(page); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | itCompanyService.updateById(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | itDriverService.updateCompanyDriverState(3,company.getId()); |
| | | // itDriverService.updateCompanyDriverState(3,company.getId()); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | |
| | | itCompanyService.updateById(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | itDriverService.updateFranchiseeDriverState(3,franchisee.getId()); |
| | | // itDriverService.updateFranchiseeDriverState(3,franchisee.getId()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | itCompanyService.updateById(company); |
| | | |
| | | //设置该分公司下的所有司机状态 |
| | | itDriverService.updateCompanyDriverState(2,company.getId()); |
| | | // itDriverService.updateCompanyDriverState(2,company.getId()); |
| | | |
| | | }else if (user.getRoleType() == 3){ |
| | | //查询加盟商 |
| | |
| | | itCompanyService.updateById(franchisee); |
| | | |
| | | //设置该加盟商下的所有司机状态 |
| | | itDriverService.updateFranchiseeDriverState(2,franchisee.getId()); |
| | | // itDriverService.updateFranchiseeDriverState(2,franchisee.getId()); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | |
| | | return pictureName; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("/saveApk") |
| | | public String saveApk(@RequestPart("myfile") MultipartFile file, HttpServletRequest request){ |
| | | Map<String, Object> m = new HashMap<>(); |
| | | try { |
| | | String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(file.getOriginalFilename()); |
| | | try { |
| | | String fileSavePath = gunsProperties.getFileUploadPath()+"apk\\"; |
| | | InputStream inputStream = file.getInputStream(); |
| | | String name1 = file.getOriginalFilename(); |
| | | name1 = UUIDUtil.getRandomCode() + name1.substring(name1.lastIndexOf(".")); |
| | | String s = OBSUtil.putObjectToBucket(inputStream, name1); |
| | | // String s = OssUploadUtil.ossUpload(request, file); |
| | | // file.transferTo(new File(fileSavePath + pictureName)); |
| | | return s; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | m.put("imgUrl", gunsProperties.getFileUploadPath()+"apk/"+pictureName); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 判断当前登录的用户是否有操作这个用户的权限 |
| | | */ |