提交 c3954803 authored 作者: 133's avatar 133

feat(用户模块): 单位列表左侧列表接口修改

单位列表左侧列表接口需要把省的存放位置放在省的单位下面 Closes #2
上级 d12ff0c5
......@@ -3,6 +3,7 @@ package com.tykj.dev.config.controller;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.repository.SystemConfigDao;
import com.tykj.dev.config.service.SystemConfigService;
import com.tykj.dev.config.service.TerminalInformationService;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.config.vo.ConfigUpdateVo;
import com.tykj.dev.config.vo.ConfigVo;
......@@ -36,6 +37,9 @@ public class ConfigController {
@Autowired
private SystemConfigDao systemConfigDao;
@Autowired
TerminalInformationService terminalInformationService;
@ApiOperation(value = "添加系统配置变量值", notes = "添加系统配置变量值")
@PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class)
......@@ -65,10 +69,12 @@ public class ConfigController {
@Transactional(rollbackFor = Exception.class)
public ResponseEntity select() {
Map<String, List<SystemConfig>> map = systemConfigDao.findAllByDeleteTag(0).stream().sorted(Comparator.comparing(SystemConfig::getValue)).collect(groupingBy(SystemConfig::getChineseName));
// Map<String,List<String>> resultMap = new HashMap<>();
// for (String s:map.keySet()) {
// resultMap.put(s,map.get(s).stream().map(SystemConfig::getLabel).collect(Collectors.toList()));
// }
return ResponseEntity.ok(map);
}
@ApiOperation(value = "终端信息根据序号查询接口", notes = "终端信息根据序号查询接口")
@GetMapping(value = "/terminalInformation/{code}")
public ResponseEntity select(@PathVariable String code) {
return ResponseEntity.ok(terminalInformationService.findCode(code));
}
}
package com.tykj.dev.config.domin;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformation.java
* @Description TODO
* @createTime 2021年08月16日 17:03:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@EntityListeners(AuditingEntityListener.class)
@Entity
@ApiModel(value = "终端信息", description = "终端信息实体")
public class TerminalInformation extends BaseEntity {
private String code;
private String name;
}
package com.tykj.dev.config.repository;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.domin.TerminalInformation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformationDao.java
* @Description TODO
* @createTime 2021年08月16日 17:05:00
*/
public interface TerminalInformationDao extends JpaRepository<TerminalInformation,Integer>, JpaSpecificationExecutor<TerminalInformation> {
TerminalInformation findByCode(String code);
}
package com.tykj.dev.config.service;
import com.tykj.dev.config.domin.TerminalInformation;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformationService.java
* @Description TODO
* @createTime 2021年08月16日 17:07:00
*/
public interface TerminalInformationService {
TerminalInformation findCode(String code);
TerminalInformation saveTerminalInformation(TerminalInformation terminalInformation);
}
package com.tykj.dev.config.service.impl;
import com.tykj.dev.config.domin.TerminalInformation;
import com.tykj.dev.config.repository.TerminalInformationDao;
import com.tykj.dev.config.service.TerminalInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zjm
* @version 1.0.0
* @ClassName TerminalInformationServiceImpl.java
* @Description TODO
* @createTime 2021年08月16日 17:09:00
*/
@Service
public class TerminalInformationServiceImpl implements TerminalInformationService {
@Autowired
TerminalInformationDao terminalInformationDao;
@Override
public TerminalInformation findCode(String code) {
return terminalInformationDao.findByCode(code);
}
@Override
public TerminalInformation saveTerminalInformation(TerminalInformation terminalInformation) {
return terminalInformationDao.save(terminalInformation);
}
}
......@@ -112,7 +112,6 @@ public class TrainTask {
if (trainTheme.getTrainType()==1) {
}else {
List<Integer> userIds= trainUserDao.findAllByIsSignUpAndTrainId(1,trainId).stream().map(TrainUser::getUserId).collect(Collectors.toList());
userIds.forEach(
userId-> onlineLearningTask(trainId,taskBto.getId(),trainTheme.getName(),userId,taskBto.getOwnUnit())
......
......@@ -59,6 +59,11 @@ public class UnitsController {
return ResponseEntity.ok(unitsService.findLeftNavigation(securityUser));
}
@GetMapping(value = "/areaDevice")
@ApiOperation(value = "查询装备库区域单位列表", notes = "查询装备库区域单位列表")
public ResponseEntity selectOrganizationUnits1(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
return ResponseEntity.ok(unitsService.findLeftNavigation1(securityUser));
}
@GetMapping(value = "/findAll/GreaterThanEqual/{level}")
......
......@@ -237,4 +237,10 @@ public class UserController {
return ResponseEntity.ok("ok");
}
@GetMapping("/switch/{unitId}")
@ApiOperation(value = "切换用户")
public ResponseEntity switchUser( @PathVariable Integer unitId){
userService.deleteById(unitId);
return ResponseEntity.ok("ok");
}
}
......@@ -135,6 +135,11 @@ public interface UnitsService extends PublicService<Units> {
*/
LeftNavigation findLeftNavigation(SecurityUser securityUser);
/**
* 装备库左边侧面导航栏接口
*/
LeftNavigation findLeftNavigation1(SecurityUser securityUser);
/**
* 左边侧面导航栏接口 不包括直属单位
*/
......
package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.config.domin.SystemConfig;
import com.tykj.dev.config.service.SystemConfigService;
import com.tykj.dev.device.user.base.req.UnitNameVo;
import com.tykj.dev.device.user.base.ret.*;
import com.tykj.dev.device.user.cache.UnitsCache;
......@@ -39,6 +41,9 @@ public class UnitsServiceImpl implements UnitsService {
AreaDao areaDao;
@Autowired
UnitsCache unitsCache;
@Autowired
SystemConfigService systemConfigService;
@Override
public Units findById(Integer unitId) {
Optional<Units> unit = unitsDao.findById(unitId);
......@@ -284,6 +289,47 @@ public class UnitsServiceImpl implements UnitsService {
return leftNavigation;
}
@Override
public LeftNavigation findLeftNavigation1(SecurityUser securityUser) {
LeftNavigation leftNavigation=new LeftNavigation();
List<LeftNavigation> leftNavigationList=new ArrayList<>();
Integer areaId=securityUser.getCurrentUserInfo().getUnits().getAreaId();
Area belongsArea= areaDao.findById(areaId).get();
if (belongsArea.getType()==1){
leftNavigation = belongsArea.toLeftNavigation();
LeftNavigation units=securityUser.getCurrentUserInfo().getUnits().toLeftNavigation();
List<LeftNavigation> leftNavigationList1=new ArrayList<>();
systemConfigService.getStorageLocationMap().forEach(
(k,v)->{
leftNavigationList1.add(new LeftNavigation(0,v,null,v,3,k,units.getId()));
}
);
units.setLeftNavigations( leftNavigationList1.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
leftNavigationList.add(units);
//把省直属组合一下 直属单位(type=2) 处室单位(type=4)
// leftNavigationList.addAll(unitsDao.findAllByType(4).stream().map(Units::toLeftNavigation).collect(Collectors.toList()));
List<LeftNavigation> leftNavigationList2=unitsDao.findAllByType(2).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
LeftNavigation leftNavigation2=new LeftNavigation(0,"省直属",leftNavigationList2, UUID.randomUUID().toString(),1,22,null);
leftNavigationList.add(leftNavigation2);
}
if ( belongsArea.getType()==2){
leftNavigation = belongsArea.toLeftNavigation();
leftNavigationList = unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
}
List<Area> areas= areaDao.findAllByFatherId(areaId).stream().filter(area -> area.getType() <= 3).collect(Collectors.toList());
if (areas.size()!=0) {
provinceAndCity(belongsArea,areas,leftNavigationList);
}else {
leftNavigation= belongsArea.toLeftNavigation();
leftNavigationList= unitsDao.findAllByAreaId(belongsArea.getId()).stream().map(Units::toLeftNavigation).collect(Collectors.toList());
}
leftNavigation.setLeftNavigations(leftNavigationList.stream().sorted(Comparator.comparing(LeftNavigation::getOrder,Comparator.nullsLast(Integer::compareTo))).collect(Collectors.toList()));
return leftNavigation;
}
@Override
public LeftNavigation findLeftNavigationNotDirectlyUnit(SecurityUser securityUser) {
LeftNavigation leftNavigation=new LeftNavigation();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论