提交 b3e43c86 authored 作者: Matrix's avatar Matrix

[核查模块]

功能增加 - detail 与 stat 数据增加remark字段,信息为前端传入的remark - Stat 字段增加 checkUserId 与 checkUserName 字段 - 维护title标题
上级 6fea8a9a
...@@ -92,7 +92,7 @@ public class DeviceCheckController { ...@@ -92,7 +92,7 @@ public class DeviceCheckController {
public ResponseEntity findStatById(@PathVariable Integer id) { public ResponseEntity findStatById(@PathVariable Integer id) {
//还要查询出所有的 //还要查询出所有的
CheckStatVo statVoList = statRepo.findById(id) CheckStatVo statVoList = statRepo.findById(id)
.map(DeviceCheckStat::toVo) .map(transUtil::checkStatDo2Vo)
.orElse(CheckStatVo.empty()); .orElse(CheckStatVo.empty());
return ResponseEntity.ok(new ResultObj(statVoList)); return ResponseEntity.ok(new ResultObj(statVoList));
} }
...@@ -129,7 +129,7 @@ public class DeviceCheckController { ...@@ -129,7 +129,7 @@ public class DeviceCheckController {
log.info("[核查模块]发起手动核查,发起单位为{},被查单位为{}", startUnit.getName(), checkedUnitNames); log.info("[核查模块]发起手动核查,发起单位为{},被查单位为{}", startUnit.getName(), checkedUnitNames);
// 2-1 构建发起单位的 统计账单 // 2-1 构建发起单位的 统计账单
DeviceCheckStat provinceCheckStat = initStatData(startUnit.getName(), checkedUnits); DeviceCheckStat provinceCheckStat = initStatData(billVo.getRemark(), billVo.getUserAId(), billVo.getUserBId(), billVo.getCheckTitle(), startUnit.getName(), checkedUnits);
Integer billId = statRepo.save(provinceCheckStat).getId(); Integer billId = statRepo.save(provinceCheckStat).getId();
// 2-2 构建发起单位的 统计任务 // 2-2 构建发起单位的 统计任务
TaskBto provStatTask = new Task(CHECK_STAT_0.id, CONFIRM_CHECK_STAT.name, 0, ".0.", CONFIRM_CHECK_STAT.id, billId, startUnitId) TaskBto provStatTask = new Task(CHECK_STAT_0.id, CONFIRM_CHECK_STAT.name, 0, ".0.", CONFIRM_CHECK_STAT.id, billId, startUnitId)
...@@ -153,7 +153,7 @@ public class DeviceCheckController { ...@@ -153,7 +153,7 @@ public class DeviceCheckController {
// 对每个需要核查的单位构建其detail账单与task // 对每个需要核查的单位构建其detail账单与task
for (Units unit : checkedUnits) { for (Units unit : checkedUnits) {
// 3-1 构建被查单位的 自查账单 // 3-1 构建被查单位的 自查账单
DeviceCheckDetailEntity unitDetailDoc = DeviceCheckDetailEntity.EmptyWithChecker(billVo.getUserAId(), billVo.getUserBId(), 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>())); DeviceCheckDetailEntity unitDetailDoc = DeviceCheckDetailEntity.EmptyWithChecker(billVo.getRemark(), billVo.getCheckTitle(), billVo.getUserAId(), billVo.getUserBId(), 0, 0, unit.getName(), devInLib.getOrDefault(unit.getName(), new ArrayList<>()), devNotInLib.getOrDefault(unit.getName(), new ArrayList<>()));
DeviceCheckDetailEntity detail = detailRepo.save(unitDetailDoc); DeviceCheckDetailEntity detail = detailRepo.save(unitDetailDoc);
// 3-1 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态) // 3-1 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态)
TaskBto checkedTask = new TaskBto(CHECK_DETAIL_0.id, "自核查任务", provStatTask.getId(), addNode(provStatTask.getNodeIdDetail(), provStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0); TaskBto checkedTask = new TaskBto(CHECK_DETAIL_0.id, "自核查任务", provStatTask.getId(), addNode(provStatTask.getNodeIdDetail(), provStatTask.getId()), CONFIRM_CHECK_DETAIL.id, detail.getId(), unit.getUnitId(), 0);
...@@ -281,7 +281,7 @@ public class DeviceCheckController { ...@@ -281,7 +281,7 @@ public class DeviceCheckController {
// 获得当前城市的统计信息 以及 要汇总的地区信息 并累加保存 // 获得当前城市的统计信息 以及 要汇总的地区信息 并累加保存
List<CheckDeviceStatVo> addVos = parseStatString2Vo(currentTask, level, currentDetail.getCheckDetail()); List<CheckDeviceStatVo> addVos = parseStatString2Vo(currentTask, level, currentDetail.getCheckDetail());
CheckStatVo resultVo = statRepo.findById(statId).get().toVo(); CheckStatVo resultVo = transUtil.checkStatDo2Vo(statRepo.findById(statId).get());
resultVo.setDeviceStatVoList(accumulateStat(addVos, resultVo.getDeviceStatVoList())); resultVo.setDeviceStatVoList(accumulateStat(addVos, resultVo.getDeviceStatVoList()));
statRepo.save(resultVo.toDo()); statRepo.save(resultVo.toDo());
...@@ -326,8 +326,8 @@ public class DeviceCheckController { ...@@ -326,8 +326,8 @@ public class DeviceCheckController {
if (hasParent) { if (hasParent) {
// 累加当前地区数据 // 累加当前地区数据
TaskBto parentTask = taskService.get(parentTaskId); TaskBto parentTask = taskService.get(parentTaskId);
CheckStatVo cityStat = statRepo.findById(statId).get().toVo(); CheckStatVo cityStat = transUtil.checkStatDo2Vo(statRepo.findById(statId).get());
CheckStatVo provinceStat = statRepo.findById(parentTask.getBillId()).get().toVo(); CheckStatVo provinceStat = transUtil.checkStatDo2Vo(statRepo.findById(parentTask.getBillId()).get());
List<CheckDeviceStatVo> accStat = accumulateStat(cityStat.getDeviceStatVoList(), provinceStat.getDeviceStatVoList()); List<CheckDeviceStatVo> accStat = accumulateStat(cityStat.getDeviceStatVoList(), provinceStat.getDeviceStatVoList());
provinceStat.setDeviceStatVoList(accStat); provinceStat.setDeviceStatVoList(accStat);
statRepo.save(provinceStat.toDo()); statRepo.save(provinceStat.toDo());
...@@ -418,7 +418,7 @@ public class DeviceCheckController { ...@@ -418,7 +418,7 @@ public class DeviceCheckController {
* @param startUnitName 发起核查的单位名 * @param startUnitName 发起核查的单位名
* @param unitsList 被核查单位列表 * @param unitsList 被核查单位列表
*/ */
private DeviceCheckStat initStatData(String startUnitName, List<Units> unitsList) { private DeviceCheckStat initStatData(String remark, Integer checkUserAId, Integer checkUserBId, String checkTitle, String startUnitName, List<Units> unitsList) {
//获得要被统计的单位名列表 //获得要被统计的单位名列表
List<String> unitNameList = unitsList.stream().map(Units::getName).collect(toList()); List<String> unitNameList = unitsList.stream().map(Units::getName).collect(toList());
Map<String, List<DeviceLibrary>> modelMap = deviceRepo.findAll() Map<String, List<DeviceLibrary>> modelMap = deviceRepo.findAll()
...@@ -450,8 +450,12 @@ public class DeviceCheckController { ...@@ -450,8 +450,12 @@ public class DeviceCheckController {
LocalDate startTime = LocalDate.now(); LocalDate startTime = LocalDate.now();
LocalDate endTime = startTime.plusMonths(1); LocalDate endTime = startTime.plusMonths(1);
return new CheckStatVo(null, return new CheckStatVo(
"2020年下半年核查--" + startUnitName, remark,
checkUserAId,
checkUserBId,
null,
checkTitle + startUnitName + "核查统计单",
startUnitName + "待核查装备统计", startUnitName + "待核查装备统计",
localDateToDate(startTime), localDateToDate(startTime),
localDateToDate(endTime), localDateToDate(endTime),
......
...@@ -26,6 +26,7 @@ import java.util.Date; ...@@ -26,6 +26,7 @@ import java.util.Date;
@Where(clause = "delete_tag = 0") @Where(clause = "delete_tag = 0")
@ApiModel("装备核查账单") @ApiModel("装备核查账单")
@NoArgsConstructor @NoArgsConstructor
@Table(name = "device_check_bill")
public class DeviceCheckBillEntity { public class DeviceCheckBillEntity {
/** /**
......
...@@ -19,7 +19,6 @@ import org.springframework.util.StringUtils; ...@@ -19,7 +19,6 @@ import org.springframework.util.StringUtils;
import javax.persistence.*; import javax.persistence.*;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -33,6 +32,7 @@ import java.util.stream.Collectors; ...@@ -33,6 +32,7 @@ import java.util.stream.Collectors;
@Where(clause = "delete_tag = 0") @Where(clause = "delete_tag = 0")
@ApiModel("核查详情") @ApiModel("核查详情")
@NoArgsConstructor @NoArgsConstructor
@Table(name = "device_check_detail")
public class DeviceCheckDetailEntity { public class DeviceCheckDetailEntity {
/** /**
...@@ -40,9 +40,14 @@ public class DeviceCheckDetailEntity { ...@@ -40,9 +40,14 @@ public class DeviceCheckDetailEntity {
*/ */
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "主键id") @ApiModelProperty(name = "主键id")
private Integer id; private Integer id;
/**
* 检查详情名称
*/
@ApiModelProperty(name = "检查详情名称")
private String title;
/** /**
* 核查账单id * 核查账单id
*/ */
...@@ -165,9 +170,6 @@ public class DeviceCheckDetailEntity { ...@@ -165,9 +170,6 @@ public class DeviceCheckDetailEntity {
@ApiModelProperty(value = "预留字段2") @ApiModelProperty(value = "预留字段2")
private String var2; private String var2;
@ApiModelProperty(value = "核查标题")
@Transient
private String title;
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
@Transient @Transient
private String createUser; private String createUser;
...@@ -195,7 +197,8 @@ public class DeviceCheckDetailEntity { ...@@ -195,7 +197,8 @@ public class DeviceCheckDetailEntity {
/** /**
* 用于生成县级的核查详情账单的构造函数 * 用于生成县级的核查详情账单的构造函数
*/ */
public DeviceCheckDetailEntity(Integer finalCheckId, public DeviceCheckDetailEntity(String title,
Integer finalCheckId,
Integer checkUserAId, Integer checkUserAId,
Integer checkUserBId, Integer checkUserBId,
Integer userAId, Integer userAId,
...@@ -206,7 +209,9 @@ public class DeviceCheckDetailEntity { ...@@ -206,7 +209,9 @@ public class DeviceCheckDetailEntity {
Integer checkedCount, Integer checkedCount,
String checkResult, String checkResult,
String checkDetail, String checkDetail,
Integer checkStatus) { Integer checkStatus,
String remark) {
this.title = title;
this.finalCheckId = finalCheckId; this.finalCheckId = finalCheckId;
this.checkUserAId = checkUserAId; this.checkUserAId = checkUserAId;
this.checkUserBId = checkUserBId; this.checkUserBId = checkUserBId;
...@@ -219,6 +224,7 @@ public class DeviceCheckDetailEntity { ...@@ -219,6 +224,7 @@ public class DeviceCheckDetailEntity {
this.checkResult = checkResult; this.checkResult = checkResult;
this.checkDetail = checkDetail; this.checkDetail = checkDetail;
this.checkStatus = checkStatus; this.checkStatus = checkStatus;
this.remark = remark;
} }
/** /**
...@@ -227,39 +233,9 @@ public class DeviceCheckDetailEntity { ...@@ -227,39 +233,9 @@ public class DeviceCheckDetailEntity {
* @param badDevices 所属在,但所在不在本单位的装备集合 * @param badDevices 所属在,但所在不在本单位的装备集合
* @return 初始化的账单(还没有被人修改过的) * @return 初始化的账单(还没有被人修改过的)
*/ */
public static DeviceCheckDetailEntity Empty(String checkUnit, List<DeviceLibrary> goodDevices, List<DeviceLibrary> badDevices) {
//构造checkDetail 分当前在库与不在库的 赋予不同状态
String goodCheckDetail = goodDevices.stream()
.map(DeviceLibrary::getId)
.map(Objects::toString)
.collect(Collectors.joining("-2,"));
String badCheckDetail = badDevices.stream()
.map(DeviceLibrary::getId)
.map(Objects::toString)
.collect(Collectors.joining("-3,"));
//如果不在库的不为空,则拼接,否则没必要
String checkDetail = StringUtils.isEmpty(badCheckDetail) ? goodCheckDetail : goodCheckDetail + "," + badCheckDetail;
return new DeviceCheckDetailEntity(
0,
0,
0,
0,
0,
TimestampUtil.getNowDate(),
checkUnit,
goodDevices.size(),
0,
"",
checkDetail,
0
);
}
public static DeviceCheckDetailEntity EmptyWithChecker( public static DeviceCheckDetailEntity EmptyWithChecker(
String remark,
String title,
Integer checkUserA, Integer checkUserA,
Integer checkUserB, Integer checkUserB,
Integer userAId, Integer userAId,
...@@ -287,6 +263,7 @@ public class DeviceCheckDetailEntity { ...@@ -287,6 +263,7 @@ public class DeviceCheckDetailEntity {
String checkDetail = StringUtils.isEmpty(badCheckDetail) ? goodCheckDetail : goodCheckDetail + "," + badCheckDetail; String checkDetail = StringUtils.isEmpty(badCheckDetail) ? goodCheckDetail : goodCheckDetail + "," + badCheckDetail;
return new DeviceCheckDetailEntity( return new DeviceCheckDetailEntity(
title + checkUnit + "核查详情单",
0, 0,
checkUserA, checkUserA,
checkUserB, checkUserB,
...@@ -298,8 +275,8 @@ public class DeviceCheckDetailEntity { ...@@ -298,8 +275,8 @@ public class DeviceCheckDetailEntity {
0, 0,
"", "",
checkDetail, checkDetail,
0 0,
remark
); );
} }
} }
package com.tykj.dev.device.confirmcheck.entity.domain; package com.tykj.dev.device.confirmcheck.entity.domain;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckDeviceStatVo;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckStatVo;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
import org.modelmapper.ModelMapper;
import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedBy;
...@@ -18,7 +13,6 @@ import org.springframework.data.annotation.LastModifiedDate; ...@@ -18,7 +13,6 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
/** /**
...@@ -34,6 +28,7 @@ import java.util.Date; ...@@ -34,6 +28,7 @@ import java.util.Date;
@Where(clause = "delete_tag = 0") @Where(clause = "delete_tag = 0")
@ApiModel("装备核查统计") @ApiModel("装备核查统计")
@NoArgsConstructor @NoArgsConstructor
@Table(name = "device_check_stat")
public class DeviceCheckStat { public class DeviceCheckStat {
/** /**
* 主键 * 主键
...@@ -67,6 +62,14 @@ public class DeviceCheckStat { ...@@ -67,6 +62,14 @@ public class DeviceCheckStat {
*/ */
private String statInfo; private String statInfo;
@Column(name = "check_UserA_id")
private Integer checkUserAId;
@Column(name = "check_UserB_id")
private Integer checkUserBId;
private String remark;
/** /**
* 创建用户id * 创建用户id
*/ */
...@@ -108,16 +111,5 @@ public class DeviceCheckStat { ...@@ -108,16 +111,5 @@ public class DeviceCheckStat {
this.statInfo = statInfo; this.statInfo = statInfo;
} }
/**
* Do类转化为Vo类
*/
public CheckStatVo toVo() {
ModelMapper mapper = BeanHelper.getUserMapper();
//复制基本信息
CheckStatVo initialStat = mapper.map(this, CheckStatVo.class);
//解析JSON并赋值
CheckDeviceStatVo[] checkDeviceStatVos = JacksonUtil.readValue(this.statInfo, CheckDeviceStatVo[].class);
initialStat.setDeviceStatVoList(Arrays.asList(checkDeviceStatVos));
return initialStat;
}
} }
...@@ -19,12 +19,16 @@ import java.util.List; ...@@ -19,12 +19,16 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
public class CheckDetailVo { public class CheckDetailVo {
/** /**
* 主键id * 主键id
*/ */
@ApiModelProperty(name = "主键id") @ApiModelProperty(name = "主键id")
private Integer id; private Integer id;
/**
* 检查详情名称
*/
@ApiModelProperty(name = "检查详情名称")
private String title;
/** /**
* 核查账单id * 核查账单id
*/ */
......
...@@ -64,23 +64,36 @@ public class CheckStatVo { ...@@ -64,23 +64,36 @@ public class CheckStatVo {
private Integer updateUserId; private Integer updateUserId;
private Integer checkUserAId;
private Integer checkUserBId;
private String checkUserAName;
private String checkUserBName;
private String remark;
/** /**
* 核查装备详情 * 核查装备详情
*/ */
private List<CheckDeviceStatVo> deviceStatVoList; private List<CheckDeviceStatVo> deviceStatVoList;
public CheckStatVo(Integer id, String title, String subtitle, Date startTime, Date endTime, List<CheckDeviceStatVo> deviceStatVoList) { public CheckStatVo(String remark, Integer checkUserAId, Integer checkUserBId, Integer id, String title, String subtitle, Date startTime, Date endTime, List<CheckDeviceStatVo> deviceStatVoList) {
this.checkUserAId = checkUserAId;
this.checkUserBId = checkUserBId;
this.id = id; this.id = id;
this.title = title; this.title = title;
this.subtitle = subtitle; this.subtitle = subtitle;
this.startTime = startTime; this.startTime = startTime;
this.endTime = endTime; this.endTime = endTime;
this.deviceStatVoList = deviceStatVoList; this.deviceStatVoList = deviceStatVoList;
this.remark = remark;
} }
public static CheckStatVo empty() { public static CheckStatVo empty() {
List<CheckDeviceStatVo> emptyList = new ArrayList<>(); List<CheckDeviceStatVo> emptyList = new ArrayList<>();
return new CheckStatVo(0, "无指定数据", "无指定数据", null, null, emptyList); return new CheckStatVo("", 0, 0, 0, "无指定数据", "无指定数据", null, null, emptyList);
} }
/** /**
......
...@@ -3,17 +3,17 @@ package com.tykj.dev.device.confirmcheck.utils; ...@@ -3,17 +3,17 @@ package com.tykj.dev.device.confirmcheck.utils;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBillEntity; import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBillEntity;
import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetailEntity; import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetailEntity;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckBillVo; import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat;
import com.tykj.dev.device.confirmcheck.entity.vo.CheckDetailVo; import com.tykj.dev.device.confirmcheck.entity.vo.*;
import com.tykj.dev.device.confirmcheck.entity.vo.DeviceInLibVo;
import com.tykj.dev.device.confirmcheck.entity.vo.DeviceNotInLibVo;
import com.tykj.dev.device.library.repository.DeviceLibraryDao; import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.user.subject.dao.AreaDao; import com.tykj.dev.device.user.subject.dao.AreaDao;
import com.tykj.dev.device.user.subject.dao.UnitsDao; import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.dao.UserDao; import com.tykj.dev.device.user.subject.dao.UserDao;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.misc.base.BeanHelper; import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -21,6 +21,7 @@ import org.springframework.stereotype.Component; ...@@ -21,6 +21,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -45,6 +46,27 @@ public class ObjTransUtil { ...@@ -45,6 +46,27 @@ public class ObjTransUtil {
@Autowired @Autowired
private UnitsDao unitRepo; private UnitsDao unitRepo;
/**
* Do类转化为Vo类
*/
public CheckStatVo checkStatDo2Vo(DeviceCheckStat statDo) {
ModelMapper mapper = BeanHelper.getUserMapper();
//复制基本信息
CheckStatVo initialStat = mapper.map(statDo, CheckStatVo.class);
// 查询userAName 与 userBName
User checkUserA = userRepo.findById(statDo.getCheckUserAId()).orElse(null);
String userAName = checkUserA == null ? "" : checkUserA.getName();
User checkUserB = userRepo.findById(statDo.getCheckUserBId()).orElse(null);
String userBName = checkUserB == null ? "" : checkUserB.getName();
//解析JSON并赋值
CheckDeviceStatVo[] checkDeviceStatVos = JacksonUtil.readValue(statDo.getStatInfo(), CheckDeviceStatVo[].class);
initialStat.setDeviceStatVoList(Arrays.asList(checkDeviceStatVos));
initialStat.setCheckUserAName(userAName);
initialStat.setCheckUserBName(userBName);
return initialStat;
}
public DeviceCheckBillEntity checkBillVo2Do(CheckBillVo vo) { public DeviceCheckBillEntity checkBillVo2Do(CheckBillVo vo) {
ModelMapper modelMapper = BeanHelper.getUserMapper(); ModelMapper modelMapper = BeanHelper.getUserMapper();
DeviceCheckBillEntity billDo = modelMapper.map(vo, DeviceCheckBillEntity.class); DeviceCheckBillEntity billDo = modelMapper.map(vo, DeviceCheckBillEntity.class);
......
...@@ -14,9 +14,9 @@ import com.tykj.dev.device.task.subject.domin.Task; ...@@ -14,9 +14,9 @@ import com.tykj.dev.device.task.subject.domin.Task;
import com.tykj.dev.union.BaseTest; import com.tykj.dev.union.BaseTest;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.RequestBuilder; import org.springframework.test.web.servlet.RequestBuilder;
...@@ -37,7 +37,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. ...@@ -37,7 +37,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/ */
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
@WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员") @WithMockUser(username = "shena", password = "qwer1234", authorities = "省A专管员")
@AutoConfigureMockMvc @ActiveProfiles("dev")
class DeviceCheckControllerTest extends BaseTest { class DeviceCheckControllerTest extends BaseTest {
@Autowired @Autowired
......
package com.tykj.dev.union; package com.tykj.dev.union;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
...@@ -12,5 +13,6 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -12,5 +13,6 @@ import org.springframework.test.context.junit4.SpringRunner;
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = UnionApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(classes = UnionApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
public class BaseTest { public class BaseTest {
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论