Commit 39722ddfeaf073b01f08e965d449d57bca338bcf

Authored by guzijian
1 parent 512f0495

feat: 用户指南,查询角色

trash-admin/src/main/resources/static/user-guide.png 0 → 100644

1.73 MB

trash-framework/src/main/java/com/trash/framework/config/SecurityConfig.java
@@ -104,6 +104,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter @@ -104,6 +104,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
104 "/*.html", 104 "/*.html",
105 "/**/*.html", 105 "/**/*.html",
106 "/**/*.css", 106 "/**/*.css",
  107 + "/**/*.png",
107 "/**/*.js" 108 "/**/*.js"
108 ).permitAll() 109 ).permitAll()
109 .antMatchers("/processDefinition/**").permitAll() 110 .antMatchers("/processDefinition/**").permitAll()
trash-garbage/src/main/java/com/trash/garbage/controller/GarbageUserController.java
@@ -127,6 +127,15 @@ public class GarbageUserController { @@ -127,6 +127,15 @@ public class GarbageUserController {
127 } 127 }
128 128
129 /** 129 /**
  130 + * 查询用户角色
  131 + */
  132 + @PreAuthorize("@ss.hasPermi('GarUser:GarUser:query')")
  133 + @GetMapping(value = "/queryRole")
  134 + public Result<?> queryRole() {
  135 + return Result.OK(garUserService.queryRole());
  136 + }
  137 +
  138 + /**
130 * 获取建筑垃圾-用户详细信息 139 * 获取建筑垃圾-用户详细信息
131 */ 140 */
132 @PreAuthorize("@ss.hasPermi('GarUser:GarUser:query')") 141 @PreAuthorize("@ss.hasPermi('GarUser:GarUser:query')")
@@ -136,7 +145,7 @@ public class GarbageUserController { @@ -136,7 +145,7 @@ public class GarbageUserController {
136 } 145 }
137 146
138 @PostMapping 147 @PostMapping
139 - public AjaxResult addGarUser(GarUser garUser) { 148 + public AjaxResult exportUser(GarUser garUser) {
140 List<GarUser> list = garUserService.queryListByUser(garUser); 149 List<GarUser> list = garUserService.queryListByUser(garUser);
141 ExcelUtil<GarUser> util = new ExcelUtil<GarUser>(GarUser.class); 150 ExcelUtil<GarUser> util = new ExcelUtil<GarUser>(GarUser.class);
142 return util.exportExcel(list, "GarUser"); 151 return util.exportExcel(list, "GarUser");
trash-garbage/src/main/java/com/trash/garbage/service/GarUserService.java
@@ -38,4 +38,6 @@ public interface GarUserService extends IService&lt;GarUser&gt; { @@ -38,4 +38,6 @@ public interface GarUserService extends IService&lt;GarUser&gt; {
38 PageInfo queryListByUserPages(GarUser garUser); 38 PageInfo queryListByUserPages(GarUser garUser);
39 39
40 List<GarUser> queryListByUser(GarUser garUser); 40 List<GarUser> queryListByUser(GarUser garUser);
  41 +
  42 + LoginVo queryRole();
41 } 43 }
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
@@ -313,6 +313,53 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt; @@ -313,6 +313,53 @@ public class GarUserServiceImpl extends ServiceImpl&lt;GarUserMapper, GarUser&gt;
313 return list(qw); 313 return list(qw);
314 } 314 }
315 315
  316 + @Override
  317 + public LoginVo queryRole() {
  318 + LoginVo vo = new LoginVo();
  319 + String tel = SecurityUtils.getLoginUser().getUser().getPhonenumber();
  320 + DriverVo driver = new DriverVo();
  321 + driver.setPhoneNo(tel);
  322 + List<DriverVo> driverList = driverService.selectDriverList(driver);
  323 + LoginVo.RuleVo ruleVo = new LoginVo.RuleVo();
  324 + ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription());
  325 + vo.setRuleVos(new ArrayList<>(Arrays.asList(ruleVo)));
  326 + // 运输驾驶员
  327 + if (CollectionUtil.isNotEmpty(driverList)) {
  328 + DriverVo driverVo = driverList.get(0);
  329 + TransportationEnterprise enterprise = enterpriseService.selectTransportationEnterpriseById(driverVo.getCompanyId());
  330 + ruleVo = new LoginVo.RuleVo();
  331 + ruleVo.setTransportCompanyName(enterprise.getName());
  332 + ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.DRIVER_USER.getDescription());
  333 + vo.getRuleVos().add(ruleVo);
  334 + }
  335 +
  336 + // 企业负责人 TODO
  337 + TransportationEnterprise transportationEnterprise = new TransportationEnterprise();
  338 + transportationEnterprise.setServicePhone(tel);
  339 + List<TransportationEnterprise> enterpriseList = enterpriseService.selectTransportationEnterpriseList(transportationEnterprise);
  340 + if (CollectionUtil.isNotEmpty(enterpriseList)) {
  341 + TransportationEnterprise enterprise = enterpriseList.get(0);
  342 + ruleVo = new LoginVo.RuleVo();
  343 + ruleVo.setTransportCompanyName(enterprise.getName());
  344 + ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.RESPONSIBLE_USER.getDescription());
  345 + vo.getRuleVos().add(ruleVo);
  346 + }
  347 +
  348 + // 处理场所 TODO
  349 + // 查询条件
  350 + DisposalSite site = new DisposalSite();
  351 + site.setConstructionUnitPersonPhone(tel);
  352 + List<DisposalSite> disposalSites = disposalSiteService.selectDisposalSiteList(site);
  353 + if (CollectionUtil.isNotEmpty(disposalSites)) {
  354 + DisposalSite disposalSite = disposalSites.get(0);
  355 + ruleVo = new LoginVo.RuleVo();
  356 + ruleVo.setTransportCompanyName(disposalSite.getName());
  357 + ruleVo.setUserType(GlobalStatus.GarUserStatusEnum.DISPOSAL_SITE_USER.getDescription());
  358 + vo.getRuleVos().add(ruleVo);
  359 + }
  360 + return vo;
  361 + }
  362 +
316 private LambdaQueryWrapper<GarUser> createQueryWrapperByUser(GarUser garUser) { 363 private LambdaQueryWrapper<GarUser> createQueryWrapperByUser(GarUser garUser) {
317 return new LambdaQueryWrapper<GarUser>() 364 return new LambdaQueryWrapper<GarUser>()
318 .eq(StringUtils.isNotEmpty(garUser.getGarUserId()), GarUser::getGarUserId, garUser.getGarUserId()) 365 .eq(StringUtils.isNotEmpty(garUser.getGarUserId()), GarUser::getGarUserId, garUser.getGarUserId())