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

[清退][user][统计] 修改了清退、用户以及添加了统计模拟接口

上级 4b7af7d5
...@@ -27,6 +27,7 @@ import com.tykj.dev.device.user.subject.entity.Units; ...@@ -27,6 +27,7 @@ import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -41,12 +42,12 @@ import java.util.stream.Collectors; ...@@ -41,12 +42,12 @@ import java.util.stream.Collectors;
/** /**
* <h4>Description : 装备清退</h4> * <h4>Description : 装备清退</h4>
*
* @Author zjm * @Author zjm
* @Date 2020-08-15 18:15 * @Date 2020-08-15 18:15
* @Version 1.0 * @Version 1.0
*/ */
@Service @Service
@Slf4j
public class SendBackServiceImpl implements SendBackService { public class SendBackServiceImpl implements SendBackService {
@Autowired @Autowired
...@@ -141,12 +142,12 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -141,12 +142,12 @@ public class SendBackServiceImpl implements SendBackService {
/* /*
获取账单信息 获取账单信息
*/ */
SendBackBill billEntity = sendBackBillEntityDao.getOne(taskBto.getBillId()); SendBackBill billEntity = sendBackBillEntityDao.findById(taskBto.getBillId()).get();
List<Integer> idList = stringToList(billEntity.getInvoleDevice()); List<Integer> idList = stringToList(billEntity.getInvoleDevice());
String send = billEntity.getSendBackStatistical(); String send = billEntity.getSendBackStatistical();
if(billStatus == 1200 || billStatus.equals(StatusEnum.SEND_BACK_1201.id)){ if(billStatus == 1200 || billStatus.equals(StatusEnum.SEND_BACK_1201.id)){
Units unit = unitsDao.getOne(taskBto.getOwnUnit()); Units unit = unitsDao.findById(taskBto.getOwnUnit()).get();
HashMap<String,Integer> areaToTaskId = areaToTask(unit,taskBto); HashMap<String,Integer> areaToTaskId = areaToTask(unit,taskBto);
/* /*
...@@ -156,7 +157,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -156,7 +157,7 @@ public class SendBackServiceImpl implements SendBackService {
if(unit.getLevel() == 2){ if(unit.getLevel() == 2){
SendBackVo sendBackVo = newStatistical(idList, 1, null, true); SendBackVo sendBackVo = newStatistical(idList, 1, null, true);
TaskBto parentTask = taskService.get(taskBto.getParentTaskId()); TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
SendBackBill parentBill = sendBackBillEntityDao.getOne(parentTask.getBillId()); SendBackBill parentBill = sendBackBillEntityDao.findById(parentTask.getBillId()).get();
SendBackVo parentVo = JSONObject.parseObject(parentBill.getSendBackStatistical(),SendBackVo.class); SendBackVo parentVo = JSONObject.parseObject(parentBill.getSendBackStatistical(),SendBackVo.class);
sendBackVo.setName(parentVo.getName()); sendBackVo.setName(parentVo.getName());
sendBackVo.setTime(parentVo.getTime()); sendBackVo.setTime(parentVo.getTime());
...@@ -276,7 +277,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -276,7 +277,7 @@ public class SendBackServiceImpl implements SendBackService {
} }
TaskBto parentTask = taskService.get(parentTaskId); TaskBto parentTask = taskService.get(parentTaskId);
SendBackBill parentBillEntity = sendBackBillEntityDao.getOne(parentTask.getBillId()); SendBackBill parentBillEntity = sendBackBillEntityDao.findById(parentTask.getBillId()).get();
parentBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes)); parentBillEntity.setExceptionDes(JSON.toJSONString(unDeviceDes));
sendBackBillEntityDao.save(parentBillEntity); sendBackBillEntityDao.save(parentBillEntity);
...@@ -343,14 +344,14 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -343,14 +344,14 @@ public class SendBackServiceImpl implements SendBackService {
@Override @Override
public ResponseEntity endException(Integer taskId,Integer userId,Integer type) { public ResponseEntity endException(Integer taskId,Integer userId,Integer type) {
User user = userDao.getOne(userId); User user = userDao.findById(userId).get();
Units units = unitsDao.getOne(user.getUnitsId()); Units units = unitsDao.findById(user.getUnitsId()).get();
TaskBto taskBto=taskService.get(taskId); TaskBto taskBto=taskService.get(taskId);
/* /*
获取该Task的账单 获取该Task的账单
*/ */
Integer billId = taskBto.getBillId(); Integer billId = taskBto.getBillId();
SendBackBill sendBackBill = sendBackBillEntityDao.getOne(billId); SendBackBill sendBackBill = sendBackBillEntityDao.findById(billId).get();
/* /*
获取关联的设备id 获取关联的设备id
*/ */
...@@ -373,7 +374,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -373,7 +374,7 @@ public class SendBackServiceImpl implements SendBackService {
*/ */
TaskBto parentTask = taskService.get(taskBto.getParentTaskId()); TaskBto parentTask = taskService.get(taskBto.getParentTaskId());
Integer parentTaskBillId = parentTask.getBillId(); Integer parentTaskBillId = parentTask.getBillId();
SendBackBill parentTaskBill = sendBackBillEntityDao.getOne(parentTaskBillId); SendBackBill parentTaskBill = sendBackBillEntityDao.findById(parentTaskBillId).get();
parentTaskBill.setInvoleDevice(parentTaskBill.getInvoleDevice().replaceAll(involeDevice,"")); parentTaskBill.setInvoleDevice(parentTaskBill.getInvoleDevice().replaceAll(involeDevice,""));
if (parentTaskBill.getInvoleDevice().equals("")){ if (parentTaskBill.getInvoleDevice().equals("")){
...@@ -388,7 +389,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -388,7 +389,7 @@ public class SendBackServiceImpl implements SendBackService {
if (units.getLevel()==2){ if (units.getLevel()==2){
TaskBto cityTask = taskService.get(parentTask.getParentTaskId()); TaskBto cityTask = taskService.get(parentTask.getParentTaskId());
Integer cityTaskBillId = cityTask.getBillId(); Integer cityTaskBillId = cityTask.getBillId();
SendBackBill cityTaskBill = sendBackBillEntityDao.getOne(cityTaskBillId); SendBackBill cityTaskBill = sendBackBillEntityDao.findById(cityTaskBillId).get();
parentTaskBill.setInvoleDevice(cityTaskBill.getInvoleDevice()+involeDevice); parentTaskBill.setInvoleDevice(cityTaskBill.getInvoleDevice()+involeDevice);
sendBackBillEntityDao.save(parentTaskBill); sendBackBillEntityDao.save(parentTaskBill);
} }
...@@ -410,7 +411,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -410,7 +411,7 @@ public class SendBackServiceImpl implements SendBackService {
/* /*
获取账单信息,根据账单的id,出库装备 获取账单信息,根据账单的id,出库装备
*/ */
SendBackBill billEntity = sendBackBillEntityDao.getOne(taskEntity.getBillId()); SendBackBill billEntity = sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
List<String> idStringList = Arrays.asList(billEntity.getInvoleDevice().split("x")); List<String> idStringList = Arrays.asList(billEntity.getInvoleDevice().split("x"));
List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList()); List<String> idListString = idStringList.stream().filter(list2->!list2.equals("")).collect(Collectors.toList());
System.out.println(idListString); System.out.println(idListString);
...@@ -459,13 +460,13 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -459,13 +460,13 @@ public class SendBackServiceImpl implements SendBackService {
保存出库清单 保存出库清单
*/ */
TaskBto taskEntity = taskService.get(taskId); TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit()); Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
Area area = areaDao.getOne(unit.getAreaId()); Area area = areaDao.findById(unit.getAreaId()).get();
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId()); List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
SendBackBill bill = sendBackBillEntityDao.getOne(taskEntity.getBillId()); SendBackBill bill = sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
bill.setSendBackOut(JSON.toJSONString(sendBackOut)); bill.setSendBackOut(JSON.toJSONString(sendBackOut));
taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,sendBackOut.getReviewerNameId()); taskService.moveToSpecial(taskEntity,StatusEnum.SEND_BACK_1202,sendBackOut.getReviewerNameId());
...@@ -514,14 +515,14 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -514,14 +515,14 @@ public class SendBackServiceImpl implements SendBackService {
public ResponseEntity sendBackOutExamine(Integer taskId,Integer userId,Integer type) { public ResponseEntity sendBackOutExamine(Integer taskId,Integer userId,Integer type) {
TaskBto taskEntity = taskService.get(taskId); TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit()); Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
Area area = areaDao.getOne(unit.getAreaId()); Area area = areaDao.findById(unit.getAreaId()).get();
List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId()); List<Units> fatherUnit = unitsDao.findByAreaId(area.getFatherId());
Units father=fatherUnit.get(0); Units father=fatherUnit.get(0);
taskEntity.setOwnUnit(father.getUnitId()); taskEntity.setOwnUnit(father.getUnitId());
SendBackBill sendBackBill= sendBackBillEntityDao.getOne(taskEntity.getBillId()); SendBackBill sendBackBill= sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
List<Integer> idList=stringToList(sendBackBill.getInvoleDevice()); List<Integer> idList=stringToList(sendBackBill.getInvoleDevice());
deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach( deviceLibraryDao.getDeviceLibraryEntitiesByIdIn(idList).forEach(
deviceLibrary -> { deviceLibrary -> {
...@@ -547,7 +548,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -547,7 +548,7 @@ public class SendBackServiceImpl implements SendBackService {
public ResponseEntity sendBackIn(Integer taskId,Integer userId,Integer type) { public ResponseEntity sendBackIn(Integer taskId,Integer userId,Integer type) {
TaskBto taskEntity = taskService.get(taskId); TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit()); Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
/* /*
已完结 已完结
...@@ -557,7 +558,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -557,7 +558,7 @@ public class SendBackServiceImpl implements SendBackService {
修改装备是所属单位 修改装备是所属单位
*/ */
Integer billId = taskEntity.getBillId(); Integer billId = taskEntity.getBillId();
SendBackBill bill = sendBackBillEntityDao.getOne(billId); SendBackBill bill = sendBackBillEntityDao.findById(billId).get();
bill.setIsComplete(1); bill.setIsComplete(1);
sendBackBillEntityDao.save(bill); sendBackBillEntityDao.save(bill);
List<Integer> idList = stringToList(bill.getInvoleDevice()); List<Integer> idList = stringToList(bill.getInvoleDevice());
...@@ -584,7 +585,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -584,7 +585,8 @@ public class SendBackServiceImpl implements SendBackService {
//父类task //父类task
TaskBto fatherTaskBto = taskService.get(taskEntity.getParentTaskId());; TaskBto fatherTaskBto = taskService.get(taskEntity.getParentTaskId());;
SendBackBill fatherBill = sendBackBillEntityDao.getOne(fatherTaskBto.getBillId()); SendBackBill fatherBill = sendBackBillEntityDao.findById(fatherTaskBto.getBillId()).get()
;
String send=fatherBill.getSendBackStatistical(); String send=fatherBill.getSendBackStatistical();
SendBackVo sendBackVo= JSONObject.parseObject(send,SendBackVo.class); SendBackVo sendBackVo= JSONObject.parseObject(send,SendBackVo.class);
...@@ -608,7 +610,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -608,7 +610,7 @@ public class SendBackServiceImpl implements SendBackService {
if (flag){ if (flag){
if (fatherTaskBto.getParentTaskId()!=null) { if (fatherTaskBto.getParentTaskId()!=null) {
taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1203, 0); taskService.moveToSpecial(fatherTaskBto, StatusEnum.SEND_BACK_1203, 0);
SendBackBill billEntity = sendBackBillEntityDao.getOne(fatherTaskBto.getBillId()); SendBackBill billEntity = sendBackBillEntityDao.findById(fatherTaskBto.getBillId()).get();
List<Integer> integerList= findInvoleDevice(billEntity.getInvoleDevice()).stream().map(DeviceLibrary::getId).collect(Collectors.toList()); List<Integer> integerList= findInvoleDevice(billEntity.getInvoleDevice()).stream().map(DeviceLibrary::getId).collect(Collectors.toList());
addExceptionTask(fatherTaskBto.getId(),integerList,fatherTaskBto.getOwnUnit(),0,fatherBill.getDeadLine()); addExceptionTask(fatherTaskBto.getId(),integerList,fatherTaskBto.getOwnUnit(),0,fatherBill.getDeadLine());
}else { }else {
...@@ -641,7 +643,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -641,7 +643,7 @@ public class SendBackServiceImpl implements SendBackService {
TaskBto taskEntity = taskService.get(taskId); TaskBto taskEntity = taskService.get(taskId);
Units unit = unitsDao.getOne(taskEntity.getOwnUnit()); Units unit = unitsDao.findById(taskEntity.getOwnUnit()).get();
/* /*
区域对应的Task,方便点击进入下一级 区域对应的Task,方便点击进入下一级
*/ */
...@@ -649,7 +651,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -649,7 +651,8 @@ public class SendBackServiceImpl implements SendBackService {
/* /*
获取账单信息 获取账单信息
*/ */
SendBackBill billEntity = sendBackBillEntityDao.getOne(taskEntity.getBillId()); SendBackBill billEntity = sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
log.info("sssssssss,{}",taskEntity.getBillId());
List<Integer> idList = stringToList(billEntity.getInvoleDevice()); List<Integer> idList = stringToList(billEntity.getInvoleDevice());
/* /*
统计单 统计单
...@@ -758,11 +761,11 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -758,11 +761,11 @@ public class SendBackServiceImpl implements SendBackService {
*/ */
TaskBto taskEntity = taskService.get(taskId); TaskBto taskEntity = taskService.get(taskId);
// taskEntity.setBillStatus(19); // taskEntity.setBillStatus(19);
SendBackBill bill = sendBackBillEntityDao.getOne(taskEntity.getBillId()); SendBackBill bill = sendBackBillEntityDao.findById(taskEntity.getBillId()).get();
bill.setSendBackOut(JSON.toJSONString(sendBackOut)); bill.setSendBackOut(JSON.toJSONString(sendBackOut));
User user = userDao.getOne(userId); User user = userDao.findById(userId).get();
SendBackBillDetail form = sendBackBillDetailEntityDao.getOne(bill.getFormId()); SendBackBillDetail form = sendBackBillDetailEntityDao.findById(bill.getFormId()).get();
form.setReceiveUserAId(userId); form.setReceiveUserAId(userId);
form.setReceiveUserAName(user.getName()); form.setReceiveUserAName(user.getName());
form.setBillFileUrl(sendBackOut.getUrl()); form.setBillFileUrl(sendBackOut.getUrl());
...@@ -807,7 +810,7 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -807,7 +810,7 @@ public class SendBackServiceImpl implements SendBackService {
public ResponseEntity exceptionSelect(Integer task) { public ResponseEntity exceptionSelect(Integer task) {
UnDeviceDesVo unDeviceDesVo =null; UnDeviceDesVo unDeviceDesVo =null;
TaskBto taskBto = taskService.get(task); TaskBto taskBto = taskService.get(task);
SendBackBill sendBackBill= sendBackBillEntityDao.getOne(taskBto.getBillId()); SendBackBill sendBackBill= sendBackBillEntityDao.findById(taskBto.getBillId()).get();
if (sendBackBill.getExceptionDes()!=null) { if (sendBackBill.getExceptionDes()!=null) {
unDeviceDesVo = JSONObject.parseObject(sendBackBill.getExceptionDes(), UnDeviceDesVo.class); unDeviceDesVo = JSONObject.parseObject(sendBackBill.getExceptionDes(), UnDeviceDesVo.class);
} }
...@@ -1368,8 +1371,8 @@ public class SendBackServiceImpl implements SendBackService { ...@@ -1368,8 +1371,8 @@ public class SendBackServiceImpl implements SendBackService {
*/ */
for (TaskBto t:kidTask) { for (TaskBto t:kidTask) {
Integer ownUnit = t.getOwnUnit(); Integer ownUnit = t.getOwnUnit();
Units units = unitsDao.getOne(ownUnit); Units units = unitsDao.findById(ownUnit).get();
Area area = areaDao.getOne(units.getAreaId()); Area area = areaDao.findById(units.getAreaId()).get();
areaToTaskId.put(area.getName(),t.getId()); areaToTaskId.put(area.getName(),t.getId());
} }
return areaToTaskId; return areaToTaskId;
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>equip</artifactId>
<groupId>com.tykj</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dev-statistical</artifactId>
<dependencies>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-user</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>misc</artifactId>
</dependency>
<dependency>
<groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.tykj.dev.statistical.controller;
/**
* @author zjm
* @version 1.0.0
* @ClassName StatisticalController.java
* @Description TODO
* @createTime 2020年10月16日 14:53:00
*/
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.statistical.vo.*;
import io.swagger.annotations.Api;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
@Api(tags = "统计业务模块", description = "统计相关接口")
@AutoDocument
@RequestMapping("/statistical")
public class StatisticalController {
/**
* 查询各市的装备数量
* @return 各市装备对象集合
*/
@GetMapping("/devNum")
public ResponseEntity selectDevNum(){
List<DevNum> nums=new ArrayList<>();
return ResponseEntity.ok(nums);
}
/**
* 查询各市装备生命状态数量
* @return 各市装备生命状态对象集合
*/
@GetMapping("/StateofLife")
public ResponseEntity selectStateofLife(){
List<DevLifeSector> nums=new ArrayList<>();
return ResponseEntity.ok(nums);
}
/**
* 查询各市自查情况数量
* @return 各市装备生命状态对象集合
*/
@GetMapping("/selfInspection/{type}")
public ResponseEntity selectSelfInspection(@PathVariable Integer type){
List<SelfInspection> nums=new ArrayList<>();
return ResponseEntity.ok(nums);
}
/**
* 查询各市核查情况数量
* @return 各市装备生命状态对象集合
*/
@GetMapping("/selfInspection/{type}")
public ResponseEntity selectVerification(@PathVariable Integer type){
List<Verification> nums=new ArrayList<>();
return ResponseEntity.ok(nums);
}
/**
* 查询专管员概述
* @return 各市装备生命状态对象集合
*/
@GetMapping("/generalSituation")
public ResponseEntity selectGeneralSituation(){
return ResponseEntity.ok(new UserGeneralSituation());
}
/**
* 查询告警情况
* @return 各市装备生命状态对象集合
*/
@GetMapping("/alarmSituation")
public ResponseEntity selectAlarmSituation(){
return ResponseEntity.ok(new AlarmSituation());
}
/**
* 查询业务情况
* @return 各市装备生命状态对象集合
*/
@GetMapping("/businessSituation/{type}")
public ResponseEntity selectBusinessSituation(@PathVariable Integer type){
return ResponseEntity.ok(new BusinessSituation());
}
}
package com.tykj.dev.statistical;
\ No newline at end of file
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName Alarm.java
* @Description 告警详情统计
* @createTime 2020年10月16日 10:38:00
*/
public class Alarm {
/**
* 市 名称
*/
private String areaName;
/**
* 进出记录
*/
private Integer accessCount;
/**
* 盘点记录
*/
private Integer inventoryCount;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName AlarmSituation.java
* @Description 告警概况
* @createTime 2020年10月16日 13:50:00
*/
public class AlarmSituation {
/**
* 总数
*/
private Integer alarmCount;
/**
* 出入
*/
private Integer inOutConut;
/**
*盘库
*/
private Integer inventoryCount;
/**
* 未处理
*/
private Integer untreatedCount;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName BusinessSituation.java
* @Description TODO
* @createTime 2020年10月16日 13:21:00
*/
public class BusinessSituation {
/**
* 配发
*/
private Integer withCount;
/**
* 清退
*/
private Integer sendRepelCount;
/**
* 自查
*/
private Integer selfInspection;
/**
* 核查
*/
private Integer verification;
/**
* 培训
*/
private Integer train;
/**
* 决算
*/
private Integer finalAccounts;
/**
* 入库
*/
private Integer putStorage;
/**
* 申请
*/
private Integer apply;
/**
* 列装
*/
private Integer fielding;
/**
* 退装
*/
private Integer backPack;
/**
* 销毁
*/
private Integer destruction;
/**
* 维修
*/
private Integer maintenance;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName DevLifeSector.java
* @Description 各市扇形生命状态统计
* @createTime 2020年10月16日 09:55:00
*/
public class DevLifeSector {
/**
* 市名称
*/
private String areaName;
/**
*在库数量
*/
private Integer inStock;
/**
* 维修数量
*/
private Integer maintenanceConut;
/**
* 报废数量
*/
private Integer scrapCount;
/**
* 退役
*/
private Integer retiredCount;
/**
* 销毁
*/
private Integer destructionCount;
/**
* 使用
*/
private Integer useCount;
/**
* 运输、锁定
*/
private Integer lockCount;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName DevNum.java
* @Description 统计分析 市级 本市装备数量
* @createTime 2020年10月15日 10:35:00
*/
public class DevNum {
/**
* 区域名称
*/
private String areaName;
/**
* 区域装备总数
*/
private Integer conut;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName DevLifeSector.java
* @Description 省扇形生命状态统计
* @createTime 2020年10月16日 09:55:00
*/
public class DevProvinceSector {
/**
* 市名称
*/
private String areaName;
/**
*在库数量
*/
private Integer inStock;
/**
* 维修数量
*/
private Integer maintenanceConut;
/**
* 报废数量
*/
private Integer scrapCount;
/**
* 退役
*/
private Integer retiredCount;
/**
* 销毁
*/
private Integer destructionCount;
/**
* 使用
*/
private Integer useCount;
/**
* 运输、锁定
*/
private Integer lockCount;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName SelfInspection.java
* @Description 自查各市完成情况
* @createTime 2020年10月16日 10:30:00
*/
public class SelfInspection {
/**
* 市 名称
*/
private String areaName;
/**
* 完成数量
*/
private Integer completeCount;
/**
* 未完成数量
*/
private Integer noCompleteCount;
}
package com.tykj.dev.statistical.vo;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName UserGeneralSituation.java
* @Description 用户概况
* @createTime 2020年10月16日 13:40:00
*/
public class UserGeneralSituation {
/**
* 专管员数量
*/
private Integer userCount;
/**
* 已培训数量
*/
private Integer hadBeenTrainingCount;
/**
* 未培训数量
*/
private Integer noHadBeenTrainingCount;
/**
* 未培训人员id
*/
private List<Integer> noUserIds;
}
package com.tykj.dev.statistical.vo;
/**
* @author zjm
* @version 1.0.0
* @ClassName SelfInspection.java
* @Description 核查各市完成情况
* @createTime 2020年10月16日 10:30:00
*/
public class Verification {
/**
* 市 名称
*/
private String areaName;
/**
* 完成数量
*/
private Integer completeCount;
/**
* 未完成数量
*/
private Integer noCompleteCount;
}
...@@ -12,6 +12,7 @@ import com.tykj.dev.device.task.subject.vo.TaskTopVo; ...@@ -12,6 +12,7 @@ import com.tykj.dev.device.task.subject.vo.TaskTopVo;
import com.tykj.dev.device.task.subject.vo.TaskUserVo; import com.tykj.dev.device.task.subject.vo.TaskUserVo;
import com.tykj.dev.device.task.utils.TaskUtils; import com.tykj.dev.device.task.utils.TaskUtils;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.utils.PageUtil; import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -125,4 +126,52 @@ public class TaskController { ...@@ -125,4 +126,52 @@ public class TaskController {
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultUtil.success(taskLogUserVoList); return ResultUtil.success(taskLogUserVoList);
} }
@ApiOperation(value = "根据bill查询业务日志", notes = "可以通过这个接口查询查询业务日志")
@GetMapping("/manage/detail/log/bill/{id}")
public ResponseEntity selectBillLog(@PathVariable("id") int bill) {
Task taskEn= taskDao.findByBillIdAndBusinessType(bill, BusinessEnum.CONFIRM_CHECK_STAT.id).get();
//添加当前业务日志
List<TaskLogUserVo> taskLogUserVos = taskLogService.getByTaskId(taskEn.getId());
//查询所有子业务
List<TaskBto> taskBtos = taskDao.findAll().stream()
.filter(task -> task.getNodeIdDetail() != null && task.getNodeIdDetail().contains("." + taskEn.getId() + "."))
.map(Task::parse2Bto)
.collect(Collectors.toList());
//添加子业务日志
if (taskBtos.size() > 0) {
taskBtos.forEach(taskBto -> taskLogUserVos.addAll(taskLogService.getByTaskId(taskBto.getId())));
}
//按日志时间排序
List<TaskLogUserVo> taskLogUserVoList = taskLogUserVos.stream()
.sorted(Comparator.comparing(TaskLogUserVo::getCreateTime).reversed())
.collect(Collectors.toList());
return ResultUtil.success(taskLogUserVoList);
}
@ApiOperation(value = "核查详情查询业务日志", notes = "可以通过这个接口查询查询业务日志")
@GetMapping("/manage/detail/log/bill/details/{id}")
public ResponseEntity selectBillLog7(@PathVariable("id") int bill) {
Task taskEn= taskDao.findByBillIdAndBusinessType(bill, BusinessEnum.CONFIRM_CHECK_DETAIL.id).get();
//添加当前业务日志
List<TaskLogUserVo> taskLogUserVos = taskLogService.getByTaskId(taskEn.getId());
//查询所有子业务
List<TaskBto> taskBtos = taskDao.findAll().stream()
.filter(task -> task.getNodeIdDetail() != null && task.getNodeIdDetail().contains("." + taskEn.getId() + "."))
.map(Task::parse2Bto)
.collect(Collectors.toList());
//添加子业务日志
if (taskBtos.size() > 0) {
taskBtos.forEach(taskBto -> taskLogUserVos.addAll(taskLogService.getByTaskId(taskBto.getId())));
}
//按日志时间排序
List<TaskLogUserVo> taskLogUserVoList = taskLogUserVos.stream()
.sorted(Comparator.comparing(TaskLogUserVo::getCreateTime).reversed())
.collect(Collectors.toList());
return ResultUtil.success(taskLogUserVoList);
}
} }
...@@ -29,6 +29,15 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE ...@@ -29,6 +29,15 @@ public interface TaskDao extends JpaRepository<Task, Integer>, JpaSpecificationE
*/ */
List<Task> findAllByBillIdAndBusinessTypeAndBillStatus(Integer billId, Integer businessType, Integer billStatus); List<Task> findAllByBillIdAndBusinessTypeAndBillStatus(Integer billId, Integer businessType, Integer billStatus);
/**
* 根据账单id、业务类型、任务状态查询task
*
* @param billId 账单id
* @param businessType 业务类型
*/
List<Task> findAllByBillIdAndBusinessType(Integer billId, Integer businessType);
/** /**
* 根据账单id、业务类型、以及父id为null * 根据账单id、业务类型、以及父id为null
......
...@@ -13,11 +13,13 @@ import com.tykj.dev.device.train.entity.vo.WorkHandoverVo; ...@@ -13,11 +13,13 @@ import com.tykj.dev.device.train.entity.vo.WorkHandoverVo;
import com.tykj.dev.device.train.service.TrainTaskService; import com.tykj.dev.device.train.service.TrainTaskService;
import com.tykj.dev.device.train.service.WorkHandoverService; import com.tykj.dev.device.train.service.WorkHandoverService;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.UserService;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil; import com.tykj.dev.misc.utils.JacksonUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,6 +47,9 @@ public class WorkHandoverServiceImpl implements WorkHandoverService { ...@@ -45,6 +47,9 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
@Autowired @Autowired
TrainTaskService trainTaskService; TrainTaskService trainTaskService;
@Autowired
UserService userService;
@Override @Override
public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser) { public WorkHandover createWorkHandover(WorkHandoverAddVo workHandoverAddVo, SecurityUser securityUser) {
log.info("[workHandover] 新建工作交接"); log.info("[workHandover] 新建工作交接");
...@@ -52,7 +57,7 @@ public class WorkHandoverServiceImpl implements WorkHandoverService { ...@@ -52,7 +57,7 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
WorkHandover workHandover = workHandoverDao.save(workHandoverAddVo.toWorkHandover()); WorkHandover workHandover = workHandoverDao.save(workHandoverAddVo.toWorkHandover());
List<Integer> integers = new ArrayList<>(); List<Integer> integers = new ArrayList<>();
integers.add(securityUser.getCurrentUserInfo().getUserId()); integers.add(securityUser.getCurrentUserInfo().getUserId());
TaskBto task = taskService.start(new TaskBto(StatusEnum.WORKHANDOVER1011.id, "工作交接", null, null, workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, integers)); taskService.start(new TaskBto(StatusEnum.WORKHANDOVER1011.id, "工作交接", null, null, workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id, securityUser.getCurrentUserInfo().getUnitsId(), 0, null, integers));
return workHandover; return workHandover;
} }
...@@ -76,6 +81,8 @@ public class WorkHandoverServiceImpl implements WorkHandoverService { ...@@ -76,6 +81,8 @@ public class WorkHandoverServiceImpl implements WorkHandoverService {
//推入完结状态 //推入完结状态
TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id); TaskBto taskBto = trainTaskService.selectFatherIsNullAndBillidAndBillType(workHandover.getWorkHandoverId(), BusinessEnum.WORK_HANDOVER.id);
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
//把交接人账号状态改为冻结
return workHandover; return workHandover;
} }
......
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
......
...@@ -52,28 +52,10 @@ public class MyFilter extends UsernamePasswordAuthenticationFilter { ...@@ -52,28 +52,10 @@ public class MyFilter extends UsernamePasswordAuthenticationFilter {
SecurityUser principal = new SecurityUser(); SecurityUser principal = new SecurityUser();
principal.setUsername(username); principal.setUsername(username);
sessionRegistry.registerNewSession(request.getSession(true).getId(), principal); sessionRegistry.registerNewSession(request.getSession(true).getId(), principal);
System.out.println("___" + request.getSession(true).getId());
return this.getAuthenticationManager().authenticate(authRequest); return this.getAuthenticationManager().authenticate(authRequest);
// if (request.getContentType().equals(MediaType.APPLICATION_JSON_UTF8_VALUE) || request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE)) {
// ObjectMapper mapper = new ObjectMapper();
// UsernamePasswordAuthenticationToken authRequest = null;
// try (InputStream is = request.getInputStream()) {
// Map<String, String> authenticationBean = mapper.readValue(is, Map.class);
// authRequest = new UsernamePasswordAuthenticationToken(authenticationBean.get("username"), authenticationBean.get("password"));
// } catch (IOException e) {
// e.printStackTrace();
// authRequest = new UsernamePasswordAuthenticationToken("", "");
// } finally {
// setDetails(request, authRequest);
// SecurityUser principal = new SecurityUser();
// principal.setUsername(username);
// sessionRegistry.registerNewSession(request.getSession(true).getId(), principal);
// return this.getAuthenticationManager().authenticate(authRequest);
// }
} else { } else {
SecurityUser principal = new SecurityUser(); SecurityUser principal = new SecurityUser();
principal.setUsername(request.getParameter("username")); principal.setUsername(request.getParameter("username"));
System.out.println("___" + request.getSession(true).getId());
sessionRegistry.registerNewSession(request.getSession(true).getId(), principal); sessionRegistry.registerNewSession(request.getSession(true).getId(), principal);
return super.attemptAuthentication(request, response); return super.attemptAuthentication(request, response);
} }
......
...@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser; ...@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.User; import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.entity.UserRole; import com.tykj.dev.device.user.subject.entity.UserRole;
import com.tykj.dev.device.user.subject.service.*; import com.tykj.dev.device.user.subject.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
...@@ -18,6 +19,7 @@ import java.util.List; ...@@ -18,6 +19,7 @@ import java.util.List;
* @author zjm * @author zjm
*/ */
@Service @Service
@Slf4j
public class MyUserDetailsServiceImpl implements UserDetailsService { public class MyUserDetailsServiceImpl implements UserDetailsService {
@Autowired @Autowired
PermissionsService permissionsService; PermissionsService permissionsService;
...@@ -34,7 +36,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService { ...@@ -34,7 +36,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
@Override @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
System.out.println("userService验证:" + username);
SecurityUser securityUser = new SecurityUser(); SecurityUser securityUser = new SecurityUser();
User user = userService.findByUserName(username); User user = userService.findByUserName(username);
if (user == null) { if (user == null) {
...@@ -72,6 +74,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService { ...@@ -72,6 +74,7 @@ public class MyUserDetailsServiceImpl implements UserDetailsService {
securityUser.setCurrentUserInfo(user); securityUser.setCurrentUserInfo(user);
securityUser.setRoleList(roles); securityUser.setRoleList(roles);
securityUser.setUsername(username); securityUser.setUsername(username);
log.info("登入成功:{}",username);
return securityUser; return securityUser;
} }
......
...@@ -94,14 +94,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -94,14 +94,15 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
configuration.setAllowedHeaders(Arrays.asList("Origin", "X-Requested-With", "Content-Type", "Accept")); configuration.setAllowedHeaders(Arrays.asList("Origin", "X-Requested-With", "Content-Type", "Accept"));
configuration.setMaxAge(3600L); configuration.setMaxAge(3600L);
configuration.setAllowCredentials(true); configuration.setAllowCredentials(true);
// configuration.addExposedHeader("Location");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration); source.registerCorsConfiguration("/**", configuration);
return source; return source;
} }
@Override @Override
public void configure(HttpSecurity httpSecurity) throws Exception { public void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity httpSecurity
.cors() .cors()
.and() .and()
......
...@@ -51,7 +51,7 @@ public class UrlFilterInvocationSecurityMetadataSource implements FilterInvocati ...@@ -51,7 +51,7 @@ public class UrlFilterInvocationSecurityMetadataSource implements FilterInvocati
String requestUrl = ((FilterInvocation) object).getRequestUrl(); String requestUrl = ((FilterInvocation) object).getRequestUrl();
// TODO 忽略url请放在此处进行过滤放行 // TODO 忽略url请放在此处进行过滤放行
AntPathMatcher antPathMatcher = new AntPathMatcher(); AntPathMatcher antPathMatcher = new AntPathMatcher();
if ("/userLogin".equals(requestUrl)) { if ("/userLogin".equals(requestUrl) || "/swagger-ui.html".equals(requestUrl)) {
return null; return null;
} }
......
...@@ -61,6 +61,14 @@ public class RoleController { ...@@ -61,6 +61,14 @@ public class RoleController {
} }
@GetMapping(value = "/delete/{roleId}")
@ApiOperation(value = "删除角色", notes = "成功返回ok")
public ResponseEntity deleteRoleId(@PathVariable Integer roleId) {
return ResponseEntity.ok(roleService.delete(roleId));
}
@GetMapping(value = "/summary/page/{page}/{size}") @GetMapping(value = "/summary/page/{page}/{size}")
@ApiOperation(value = "查询角色列表", notes = "成功返回角色对象") @ApiOperation(value = "查询角色列表", notes = "成功返回角色对象")
public ResponseEntity selectPage(@PathVariable Integer page, @PathVariable Integer size) { public ResponseEntity selectPage(@PathVariable Integer page, @PathVariable Integer size) {
......
...@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser; ...@@ -5,6 +5,7 @@ import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
...@@ -25,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -25,6 +26,7 @@ import springfox.documentation.annotations.ApiIgnore;
@AutoDocument @AutoDocument
@Api(tags = "用户模块", description = "提供用户相关的接口") @Api(tags = "用户模块", description = "提供用户相关的接口")
@RequestMapping("/units") @RequestMapping("/units")
@Slf4j
public class UnitsController { public class UnitsController {
@Autowired @Autowired
UnitsService unitsService; UnitsService unitsService;
...@@ -50,6 +52,7 @@ public class UnitsController { ...@@ -50,6 +52,7 @@ public class UnitsController {
@GetMapping(value = "/area") @GetMapping(value = "/area")
@ApiOperation(value = "根据等级查询对应等级的单位集合", notes = "单位集合") @ApiOperation(value = "根据等级查询对应等级的单位集合", notes = "单位集合")
public ResponseEntity selectOrganizationUnits(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) { public ResponseEntity selectOrganizationUnits(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser) {
log.info("数据星系:{}",securityUser);
return ResponseEntity.ok(unitsService.findListAreaUnitsVo(securityUser)); return ResponseEntity.ok(unitsService.findListAreaUnitsVo(securityUser));
} }
......
...@@ -10,4 +10,6 @@ import java.util.List; ...@@ -10,4 +10,6 @@ import java.util.List;
@Repository @Repository
public interface UserRoleDao extends JpaRepository<UserRole, Integer>, JpaSpecificationExecutor<UserRole> { public interface UserRoleDao extends JpaRepository<UserRole, Integer>, JpaSpecificationExecutor<UserRole> {
List<UserRole> findAllByUserId(Integer userId); List<UserRole> findAllByUserId(Integer userId);
void deleteAllByRoleId(Integer roleId);
} }
...@@ -2,11 +2,14 @@ package com.tykj.dev.device.user.subject.service.impl; ...@@ -2,11 +2,14 @@ package com.tykj.dev.device.user.subject.service.impl;
import com.tykj.dev.device.user.base.ret.RolePage; import com.tykj.dev.device.user.base.ret.RolePage;
import com.tykj.dev.device.user.subject.dao.RoleDao; import com.tykj.dev.device.user.subject.dao.RoleDao;
import com.tykj.dev.device.user.subject.dao.RolePermissionsDao;
import com.tykj.dev.device.user.subject.dao.UserRoleDao;
import com.tykj.dev.device.user.subject.entity.Role; import com.tykj.dev.device.user.subject.entity.Role;
import com.tykj.dev.device.user.subject.entity.RolePermissions; import com.tykj.dev.device.user.subject.entity.RolePermissions;
import com.tykj.dev.device.user.subject.service.PermissionsService; import com.tykj.dev.device.user.subject.service.PermissionsService;
import com.tykj.dev.device.user.subject.service.RolePermissionsService; import com.tykj.dev.device.user.subject.service.RolePermissionsService;
import com.tykj.dev.device.user.subject.service.RoleService; import com.tykj.dev.device.user.subject.service.RoleService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
...@@ -36,6 +39,12 @@ public class RoleServiceImpl implements RoleService { ...@@ -36,6 +39,12 @@ public class RoleServiceImpl implements RoleService {
@Autowired @Autowired
PermissionsService permissionsService; PermissionsService permissionsService;
@Autowired
UserRoleDao userRoleDao;
@Autowired
RolePermissionsDao rolePermissionsDao;
@Override @Override
public Role save(Role role) { public Role save(Role role) {
return roleDao.save(role); return roleDao.save(role);
...@@ -44,6 +53,8 @@ public class RoleServiceImpl implements RoleService { ...@@ -44,6 +53,8 @@ public class RoleServiceImpl implements RoleService {
@Override @Override
public boolean delete(Integer id) { public boolean delete(Integer id) {
roleDao.deleteById(id); roleDao.deleteById(id);
rolePermissionsDao.deleteAllByRoleId(id);
userRoleDao.deleteAllByRoleId(id);
return true; return true;
} }
......
...@@ -9,6 +9,7 @@ import com.tykj.dev.device.user.subject.entity.Area; ...@@ -9,6 +9,7 @@ import com.tykj.dev.device.user.subject.entity.Area;
import com.tykj.dev.device.user.subject.entity.SecurityUser; import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.device.user.subject.entity.Units; import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UnitsService; import com.tykj.dev.device.user.subject.service.UnitsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -25,6 +26,7 @@ import java.util.stream.Collectors; ...@@ -25,6 +26,7 @@ import java.util.stream.Collectors;
* @createTime 2020年07月28日 10:14:00 * @createTime 2020年07月28日 10:14:00
*/ */
@Service @Service
@Slf4j
public class UnitsServiceImpl implements UnitsService { public class UnitsServiceImpl implements UnitsService {
@Autowired @Autowired
UnitsDao unitsDao; UnitsDao unitsDao;
...@@ -45,7 +47,9 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -45,7 +47,9 @@ public class UnitsServiceImpl implements UnitsService {
public List<AreaVo> findListAreaUnitsVo(SecurityUser securityUser) { public List<AreaVo> findListAreaUnitsVo(SecurityUser securityUser) {
List<AreaVo> areaVos=new ArrayList<>(); List<AreaVo> areaVos=new ArrayList<>();
//查询当前登入用户所属单位 的区域 //查询当前登入用户所属单位 的区域
log.info("数据:"+securityUser.getUsername());
Integer areaId=securityUser.getCurrentUserInfo().getUnits().getAreaId(); Integer areaId=securityUser.getCurrentUserInfo().getUnits().getAreaId();
Area belongsArea= areaDao.findById(areaId).get(); Area belongsArea= areaDao.findById(areaId).get();
if (belongsArea.getType()==1){ if (belongsArea.getType()==1){
int i=10000; int i=10000;
...@@ -136,7 +140,11 @@ public class UnitsServiceImpl implements UnitsService { ...@@ -136,7 +140,11 @@ public class UnitsServiceImpl implements UnitsService {
@Override @Override
public Units findByAreaId(Integer unitsId) { public Units findByAreaId(Integer unitsId) {
return unitsDao.findAllByAreaId(areaDao.findById(findById(unitsId).getAreaId()).get().getFatherId()).get(0); return unitsDao.findAllByAreaId(
areaDao.findById(
findById(unitsId).getAreaId()
).get().getFatherId()
).get(0);
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.14.RELEASE</version> <version>2.1.4.RELEASE</version>
</parent> </parent>
<modules> <modules>
<module>dev-socket</module> <module>dev-socket</module>
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<module>dev-train</module> <module>dev-train</module>
<module>dev-user</module> <module>dev-user</module>
<module>dev-usereport</module> <module>dev-usereport</module>
<module>dev-statistical</module>
</modules> </modules>
<properties> <properties>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论