提交 2cd42f98 authored 作者: 133's avatar 133

[用户 培训 =报废 销毁 清退 退役] 装备日志添加信息taskid

上级 ab745cca
...@@ -133,6 +133,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -133,6 +133,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
@Override @Override
public DeviceDecommissioningDetail provinceSendDecommissioning(Integer userId, DecommissioningOrderOutData decommissioningOrderOutData) { public DeviceDecommissioningDetail provinceSendDecommissioning(Integer userId, DecommissioningOrderOutData decommissioningOrderOutData) {
TaskBto taskBto;
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units = unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
DeviceDecommissioningDetail deviceDecommissioningDetail ; DeviceDecommissioningDetail deviceDecommissioningDetail ;
...@@ -148,7 +149,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -148,7 +149,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(seqNumbers,DeviceLifeStatus.REPEL.id); deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(seqNumbers,DeviceLifeStatus.REPEL.id);
//判断是否为草稿 还是直接发起 //判断是否为草稿 还是直接发起
if (decommissioningOrderOutData.getTaskId()!=null){ if (decommissioningOrderOutData.getTaskId()!=null){
TaskBto taskBto= taskService.get(decommissioningOrderOutData.getTaskId()); taskBto= taskService.get(decommissioningOrderOutData.getTaskId());
List<StatusEnum> statusEnums = new ArrayList<>(); List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.DECOMMISSIONING_1250); statusEnums.add(StatusEnum.DECOMMISSIONING_1250);
statusEnums.add(StatusEnum.DECOMMISSIONING_1252); statusEnums.add(StatusEnum.DECOMMISSIONING_1252);
...@@ -166,7 +167,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -166,7 +167,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
}else { }else {
deviceDecommissioningDetail = decommissioningOrderOutData.toDeviceDecommissioningDetail(); deviceDecommissioningDetail = decommissioningOrderOutData.toDeviceDecommissioningDetail();
deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail); deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail);
TaskBto taskBto= sendOutSuperior(units.getUnitId(), deviceDecommissioningDetail.getId(),userId); taskBto= sendOutSuperior(units.getUnitId(), deviceDecommissioningDetail.getId(),userId);
addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "发起退役任务,待上传回执单据", gainThisUser(user.getUserId(), user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "发起退役任务,待上传回执单据", gainThisUser(user.getUserId(), user.getUnitsId())));
deviceDecommissioningDetail.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + deviceDecommissioningDetail.getId()); deviceDecommissioningDetail.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + deviceDecommissioningDetail.getId());
deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus()); deviceDecommissioningDetail.setDecommissioningStatus(taskBto.getBillStatus());
...@@ -186,7 +187,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -186,7 +187,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
// deviceDecommissioningDetail.setDeviceLibraryEntities(findInvoleDevice(deviceDecommissioningDetail.getDeviceIds())); // deviceDecommissioningDetail.setDeviceLibraryEntities(findInvoleDevice(deviceDecommissioningDetail.getDeviceIds()));
deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail); deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail);
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.RETIRED.id,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.RETIRED.id,seqNumbers);
devLogAdd(seqNumbers,"发了退役任务,状态转化为退役中",userId); devLogAdd(seqNumbers,"发了退役任务,状态转化为退役中",userId,taskBto.getId());
if (decommissioningOrderOutData.getApplyId()!=null) { if (decommissioningOrderOutData.getApplyId()!=null) {
Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(decommissioningOrderOutData.getApplyId(), BusinessEnum.APPLY.id); Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(decommissioningOrderOutData.getApplyId(), BusinessEnum.APPLY.id);
taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto()); taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto());
...@@ -241,7 +242,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -241,7 +242,7 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceDecommissioningDetail.getReceiveUnit(),0,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.RETIRE.id,deviceDecommissioningDetail.getReceiveUnit(),0,seqNumbers);
deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail); deviceDecommissioningDetailService.saveDeviceDecommissioningDetail(deviceDecommissioningDetail);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"退役任务回执单据上传成功任务结束",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"退役任务回执单据上传成功任务结束",gainThisUser(user.getUserId(),user.getUnitsId())));
devLogAdd(seqNumbers,"退役任务完成,状态转化为已退役",storageDeviceDevommissiong.getUserId()); devLogAdd(seqNumbers,"退役任务完成,状态转化为已退役",storageDeviceDevommissiong.getUserId(),taskBto.getId());
} }
...@@ -341,14 +342,14 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss ...@@ -341,14 +342,14 @@ public class DeviceDecommissioningBusinessServiceImpl implements DeviceDecommiss
/** /**
* 异步添加装备日志 * 异步添加装备日志
*/ */
private void devLogAdd(List<String> seqNumbers, String remark, Integer userId){ private void devLogAdd(List<String> seqNumbers, String remark, Integer userId,Integer taskId){
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos=new ArrayList<>();
deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach( deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach(
deviceLibrary -> { deviceLibrary -> {
logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId).toDo()); logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId,taskId).toDo());
} }
); );
......
...@@ -105,7 +105,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -105,7 +105,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
@Override @Override
public DeviceDestroyBill provinceDeviceDestroyBill(SecurityUser securityUser, DeviceDestroyBillVo deviceDestroyBillVo) { public DeviceDestroyBill provinceDeviceDestroyBill(SecurityUser securityUser, DeviceDestroyBillVo deviceDestroyBillVo) {
DeviceDestroyBill deviceDestroyBill; DeviceDestroyBill deviceDestroyBill;
TaskBto taskBto;
List<String> seqNumbers= scriptListToStringList(deviceDestroyBillVo); List<String> seqNumbers= scriptListToStringList(deviceDestroyBillVo);
//判断装备序列号中是否有不等于指定的leftStatus的装备 //判断装备序列号中是否有不等于指定的leftStatus的装备
deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(seqNumbers,DeviceLifeStatus.TO_BE_DESTROYED.id); deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(seqNumbers,DeviceLifeStatus.TO_BE_DESTROYED.id);
...@@ -114,11 +114,11 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -114,11 +114,11 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill); deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill);
deviceDestroyBill.setNum("NO:第" + LocalDateTime.now().getYear() + "XF" + deviceDestroyBill.getId()); deviceDestroyBill.setNum("NO:第" + LocalDateTime.now().getYear() + "XF" + deviceDestroyBill.getId());
//等待上传销毁单据 //等待上传销毁单据
TaskBto taskBto= awaitUploadDestructionTask(securityUser.getCurrentUserInfo().getUnitsId(),deviceDestroyBill.getId(),securityUser.getCurrentUserInfo().getUserId()); taskBto= awaitUploadDestructionTask(securityUser.getCurrentUserInfo().getUnitsId(),deviceDestroyBill.getId(),securityUser.getCurrentUserInfo().getUserId());
deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus()); deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"销毁任务等待补充手续",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"销毁任务等待补充手续",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
}else { }else {
TaskBto taskBto = taskService.get(deviceDestroyBillVo.getTaskId()); taskBto = taskService.get(deviceDestroyBillVo.getTaskId());
deviceDestroyBill=deviceDestroyBillService.findDeviceDestroyBill(taskBto.getBillId()); deviceDestroyBill=deviceDestroyBillService.findDeviceDestroyBill(taskBto.getBillId());
taskBto= taskService.moveToSpecial(taskBto,StatusEnum.DESTROY_2,0); taskBto= taskService.moveToSpecial(taskBto,StatusEnum.DESTROY_2,0);
deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus()); deviceDestroyBill.setDestroyStatus(taskBto.getBillStatus());
...@@ -136,7 +136,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -136,7 +136,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
deviceDestroyBill.setScriptJson(JacksonUtil.toJSon(deviceDestroyBillVo.getScripts())); deviceDestroyBill.setScriptJson(JacksonUtil.toJSon(deviceDestroyBillVo.getScripts()));
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_DESTROYED.id,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_DESTROYED.id,seqNumbers);
deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill); deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill);
devLogAdd(seqNumbers,"发了销毁任务,状态转化为销毁中",securityUser.getCurrentUserInfo().getUserId()); devLogAdd(seqNumbers,"发了销毁任务,状态转化为销毁中",securityUser.getCurrentUserInfo().getUserId(),taskBto.getId());
if (deviceDestroyBillVo.getApplyId()!=null) { if (deviceDestroyBillVo.getApplyId()!=null) {
Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(deviceDestroyBillVo.getApplyId(), BusinessEnum.APPLY.id); Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(deviceDestroyBillVo.getApplyId(), BusinessEnum.APPLY.id);
taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto()); taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto());
...@@ -171,7 +171,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -171,7 +171,7 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill); deviceDestroyBillService.saveDeviceDestroyBill(deviceDestroyBill);
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.DESTROYED.id,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.DESTROYED.id,seqNumbers);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"销毁任务补充手续完成",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"销毁任务补充手续完成",gainThisUser(securityUser.getCurrentUserInfo().getUserId(),securityUser.getCurrentUserInfo().getUnitsId())));
devLogAdd(seqNumbers,"补充单据信息,状态转化已销毁",deviceDestroyBillVo.getOperationId()); devLogAdd(seqNumbers,"补充单据信息,状态转化已销毁",deviceDestroyBillVo.getOperationId(),taskBto.getId());
} }
...@@ -222,13 +222,13 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe ...@@ -222,13 +222,13 @@ public class DeviceDestroyBusinessServiceImpl implements DeviceDestroyBusinessSe
/** /**
* 异步添加装备日志 * 异步添加装备日志
*/ */
private void devLogAdd(List<String> seqNumbers, String remark, Integer userId){ private void devLogAdd(List<String> seqNumbers, String remark, Integer userId,Integer taskId){
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos=new ArrayList<>();
deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach( deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach(
deviceLibrary -> { deviceLibrary -> {
logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId).toDo()); logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId,taskId).toDo());
} }
); );
deviceLogService.saveAllLog(logDtos); deviceLogService.saveAllLog(logDtos);
......
...@@ -137,9 +137,9 @@ public class FileController { ...@@ -137,9 +137,9 @@ public class FileController {
documentDevice.setRemark("备注"); documentDevice.setRemark("备注");
documentDevice.setApplicationField("省一级"); documentDevice.setApplicationField("省一级");
documentDevice.setDeviceSerialNumber("asdq1231232"); documentDevice.setDeviceSerialNumber("asdq1231232");
documentDevice.setProductionSerialNumber("12312312312"); // documentDevice.setProductionSerialNumber("12312312312");
documentDevice.setParts("密码机"); documentDevice.setParts("密码机");
documentDevice.setCategory("装备"); // documentDevice.setCategory("装备");
documentDevice.setSecurityClassification("机密"); documentDevice.setSecurityClassification("机密");
documentDevices.add(documentDevice); documentDevices.add(documentDevice);
} }
......
...@@ -54,7 +54,7 @@ public class UseReportFIleServiceImpl implements UseReportFIleService { ...@@ -54,7 +54,7 @@ public class UseReportFIleServiceImpl implements UseReportFIleService {
String templatePath = ResourceUtils.getURL( "classpath:").getPath()+"docxModel.docx"; String templatePath = ResourceUtils.getURL( "classpath:").getPath()+"docxModel.docx";
url=url+"report/"; url=url+"report/";
String uuidName=UUID.randomUUID().toString().replace("-", "") + ".doc"; String uuidName=UUID.randomUUID().toString().replace("-", "") + ".doc";
String fileUrl= WordUtil.createWord(templatePath,url,uuidName,params); String fileUrl= WordUtil.createWord(templatePath,url,uuidName,params);
response.setContentType("application/x-download"); response.setContentType("application/x-download");
try { try {
......
package com.tykj.dev.device.file.util; package com.tykj.dev.device.file.util;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
import com.tykj.dev.device.file.entity.DocumentDevice;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -64,11 +67,7 @@ public class WordUtil { ...@@ -64,11 +67,7 @@ public class WordUtil {
public static void main(String[] args) { public static void main(String[] args) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
// 渲染文本 // 渲染文本
params.put("title1","2021年度省机要局装备使用情况报告"); List<DocumentDevice> documentDevices=new ArrayList<>();
params.put("title2","2021年1月至2021年一月使用");
params.put("total","2021年度本单位总件数11,其中入库总台数0,维修建设");
params.put("comfirm","列装总台数0台,退装总数0台");
params.put("unitName","省机要局");
params.put("time","2021年10月1日"); params.put("time","2021年10月1日");
// 渲染图片 // 渲染图片
......
<?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-questionbank</artifactId>
<dependencies>
<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.device.questionbank.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.questionbank.entity.Problem;
import com.tykj.dev.device.questionbank.entity.vo.ProblemPageVo;
import com.tykj.dev.device.questionbank.service.ProblemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* @author zjm
* @version 1.0.0
* @ClassName RepelQueryController.java
* @Description TODO
* @createTime 2021年01月10日 15:43:00
*/
@RestController
@Api(tags = "题库展示层", description = "题库展示层")
@AutoDocument
@RequestMapping("/questionBack")
public class QuestionBackController {
@Autowired
ProblemService problemService;
/**
* 添加题目
*/
@ApiOperation(value = "添加题目")
@PostMapping("/save")
public ResponseEntity findOutsideTheProvince(@RequestBody Problem problem) {
return ResponseEntity.ok(problemService.saveProble(problem));
}
/**
* 查询题目 -分页
*/
@ApiOperation(value = "分页查询题目")
@PostMapping("/find/page")
public ResponseEntity findAllPage(@RequestBody ProblemPageVo problemPageVo) {
return ResponseEntity.ok(problemService.pageProblemSelect(problemPageVo));
}
/**
* 根据id删除题目
*/
@ApiOperation(value = "根据id删除题目")
@GetMapping("/delete/{id}")
public ResponseEntity deleteById( @PathVariable Integer id) {
problemService.deleteById(id);
return ResponseEntity.ok("删除成功");
}
}
package com.tykj.dev.device.questionbank.dao;
import com.tykj.dev.device.questionbank.entity.Problem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName ProblemDao.java
* @Description 题目dco层
* @createTime 2021年05月29日 15:01:00
*/
public interface ProblemDao extends JpaRepository<Problem, Integer>, JpaSpecificationExecutor<Problem> {
List<Problem> findAllByProblemTypeAndProblemLevel(Integer type,int level);
}
package com.tykj.dev.device.questionbank.dao;
\ No newline at end of file
package com.tykj.dev.device.questionbank.entity;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Transient;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName Problem.java
* @Description 存放题目相关信息
* @createTime 2021年05月29日 14:47:00
*/
@ApiModel("题目对象")
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@EntityListeners(AuditingEntityListener.class)
public class Problem extends BaseEntity {
@Column(name = "des" ,columnDefinition = "TEXT")
@ApiModelProperty(value = "题目描述")
private String des;
@Column(name = "problem_answer" ,columnDefinition = "TEXT")
@ApiModelProperty(value = "题目答案")
private String problemAnswer;
@ApiModelProperty(value = "题目类型")
private Integer problemType;
@ApiModelProperty(value = "题目难度")
private Integer problemLevel;
@ApiModelProperty(value = "题目选项")
@Column(name = "choose_options" ,columnDefinition = "TEXT")
private String chooseOptions;
@Transient
//选项 type为1时使用
@ApiModelProperty(value = "题目选项集合 ")
private List<String> chooseOptionsList;
}
package com.tykj.dev.device.questionbank.entity;
\ No newline at end of file
package com.tykj.dev.device.questionbank.entity.vo;
import com.tykj.dev.misc.base.CustomPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName ProblemPageVo.java
* @Description TODO
* @createTime 2021年05月29日 16:15:00
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class ProblemPageVo extends CustomPage {
private Integer type;
private Integer level;
private String desDim;
}
package com.tykj.dev.device.questionbank;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author zjm
* @version 1.0.0
* @ClassName userApp.java
* @Description TODO
* @createTime 2020年09月01日 14:32:00
*/
@SpringBootApplication(scanBasePackages = {
"com.tykj.dev.*",
}
)
public class questionBankApp {
public static void main(String[] args) {
SpringApplication.run(questionBankApp.class, args);
}
}
package com.tykj.dev.device.questionbank.service;
import com.tykj.dev.device.questionbank.entity.Problem;
import com.tykj.dev.device.questionbank.entity.vo.ProblemPageVo;
import org.springframework.data.domain.Page;
import java.util.List;
public interface ProblemService {
/**
* 添加题目
*/
Problem saveProble(Problem problem);
/**
* 根据id查询题目
*/
Problem findByIdProble(Integer id);
/**
* 根据类型、等级查询题目集合
*/
List<Problem> findByTypeAndLevel(Integer type,Integer level);
/**
* 查询所有题目
*/
List<Problem> findAll();
/**
* 根据id删除题目
*/
void deleteById(Integer id);
Page<Problem> pageProblemSelect(ProblemPageVo problemPageVo);
}
package com.tykj.dev.device.questionbank.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.questionbank.dao.ProblemDao;
import com.tykj.dev.device.questionbank.entity.Problem;
import com.tykj.dev.device.questionbank.entity.vo.ProblemPageVo;
import com.tykj.dev.device.questionbank.service.ProblemService;
import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class ProblemServiceImpl implements ProblemService {
@Autowired
ProblemDao problemDao;
@Override
public Problem saveProble(Problem problem) {
if (problem.getProblemType()==1||problem.getProblemType()==4){
problem.setChooseOptions(JacksonUtil.toJSon(problem.getChooseOptionsList()));
}
return problemDao.save(problem);
}
@Override
public Problem findByIdProble(Integer id) {
Optional<Problem> optional = problemDao.findById(id);
if (optional.isPresent()){
return optional.get();
}else {
throw new ApiException(ResponseEntity.status(500).body("[题目] 没有找到对应的题目"));
}
}
@Override
public List<Problem> findByTypeAndLevel(Integer type, Integer level) {
return problemDao.findAllByProblemTypeAndProblemLevel(type,level);
}
@Override
public List<Problem> findAll() {
return problemDao.findAll();
}
@Override
public void deleteById(Integer id) {
problemDao.deleteById(id);
}
@Override
public Page<Problem> pageProblemSelect(ProblemPageVo problemPageVo) {
return problemDao.findAll(getProblemSpecification(problemPageVo),problemPageVo.getPageable()).map(problem -> {
if (problem.getChooseOptions()!=null){
problem.setChooseOptionsList(JacksonUtil.readValue(problem.getChooseOptions(), new TypeReference<List<String>>() {
}));
}
return problem;
});
}
private Specification<Problem> getProblemSpecification(ProblemPageVo problemPageVo) {
PredicateBuilder<Problem> predicateBuilder = Specifications.and();
if (problemPageVo!=null){
if (problemPageVo.getDesDim()!=null){
predicateBuilder.like("","%"+problemPageVo.getDesDim()+"%");
}
if (problemPageVo.getLevel()!=null){
predicateBuilder.eq("",problemPageVo.getLevel());
}
if (problemPageVo.getType()!=null){
predicateBuilder.eq("",problemPageVo.getType());
}
}
return predicateBuilder.build();
}
}
package com.tykj.dev.device.questionbank.service;
\ No newline at end of file
...@@ -131,6 +131,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -131,6 +131,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
User user = userService.findByUser(userId); User user = userService.findByUser(userId);
Units units = unitsService.findById(user.getUnitsId()); Units units = unitsService.findById(user.getUnitsId());
Scrap scrap; Scrap scrap;
TaskBto taskBto;
List<ScriptSaveVo> scriptSaveVos = scrapOrderOutData.getScriptSaveVos(); List<ScriptSaveVo> scriptSaveVos = scrapOrderOutData.getScriptSaveVos();
List<String> seqNumbers = new ArrayList<>(); List<String> seqNumbers = new ArrayList<>();
scriptSaveVos.forEach( scriptSaveVos.forEach(
...@@ -143,7 +144,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -143,7 +144,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(seqNumbers,DeviceLifeStatus.TO_BE_SCRAPPED.id); deviceLibraryService.judgeSeqNumbersInNotEqualLifeStatus(seqNumbers,DeviceLifeStatus.TO_BE_SCRAPPED.id);
//判断是否为草稿 还是直接发起 //判断是否为草稿 还是直接发起
if (scrapOrderOutData.getTaskId()!=null){ if (scrapOrderOutData.getTaskId()!=null){
TaskBto taskBto= taskService.get(scrapOrderOutData.getTaskId()); taskBto= taskService.get(scrapOrderOutData.getTaskId());
List<StatusEnum> statusEnums = new ArrayList<>(); List<StatusEnum> statusEnums = new ArrayList<>();
statusEnums.add(StatusEnum.SCRAP_2223); statusEnums.add(StatusEnum.SCRAP_2223);
statusEnums.add(StatusEnum.SCRAP_2225); statusEnums.add(StatusEnum.SCRAP_2225);
...@@ -156,7 +157,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -156,7 +157,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
scrap = scrapOrderOutData.toScrap(); scrap = scrapOrderOutData.toScrap();
scrapService.saveScrap(scrap); scrapService.saveScrap(scrap);
scrap.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + scrap.getId()); scrap.setNum("NO:第" + LocalDateTime.now().getYear() + "QT" + scrap.getId());
TaskBto taskBto= sendOutSuperior(units.getUnitId(), scrap.getId(),userId); taskBto= sendOutSuperior(units.getUnitId(), scrap.getId(),userId);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起报废任务,待上传回执单据",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"发起报废任务,待上传回执单据",gainThisUser(user.getUserId(),user.getUnitsId())));
scrap.setScrapStatus(taskBto.getBillStatus()); scrap.setScrapStatus(taskBto.getBillStatus());
} }
...@@ -173,7 +174,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -173,7 +174,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
scrap.setScriptJson(JacksonUtil.toJSon(scrapOrderOutData.getScriptSaveVos())); scrap.setScriptJson(JacksonUtil.toJSon(scrapOrderOutData.getScriptSaveVos()));
scrapService.saveScrap(scrap); scrapService.saveScrap(scrap);
deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_SCRAPPED.id,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatus(DeviceLifeStatus.IN_THE_SCRAPPED.id,seqNumbers);
devLogAdd(seqNumbers,"发了报废任务,状态转化为报废中",userId); devLogAdd(seqNumbers,"发了报废任务,状态转化为报废中",userId,taskBto.getId());
if (scrapOrderOutData.getApplyId()!=null) { if (scrapOrderOutData.getApplyId()!=null) {
Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(scrapOrderOutData.getApplyId(), BusinessEnum.APPLY.id); Optional<Task> billIdAndBusinessTypeNotBillStatus = taskService.findBillIdAndBusinessTypeNotBillStatus(scrapOrderOutData.getApplyId(), BusinessEnum.APPLY.id);
taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto()); taskService.moveToEnd(billIdAndBusinessTypeNotBillStatus.get().parse2Bto());
...@@ -225,7 +226,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -225,7 +226,7 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
scrap.setReceiveTime(new Date()); scrap.setReceiveTime(new Date());
deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SCRAP_I.id,scrap.getReceiveUnit(),0,seqNumbers); deviceLibraryDao.upDateSeqNumbersLeftStatusAndUnitNameAndLockStatus(DeviceLifeStatus.SCRAP_I.id,scrap.getReceiveUnit(),0,seqNumbers);
scrapService.saveScrap(scrap); scrapService.saveScrap(scrap);
devLogAdd(seqNumbers,"报废任务完成,状态转化为已报废",user.getUserId()); devLogAdd(seqNumbers,"报废任务完成,状态转化为已报废",user.getUserId(),taskBto.getId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"报废单据上传,任务结束",gainThisUser(user.getUserId(),user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"报废单据上传,任务结束",gainThisUser(user.getUserId(),user.getUnitsId())));
} }
...@@ -326,14 +327,14 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService { ...@@ -326,14 +327,14 @@ public class ScrapBusinessServiceImpl implements ScrapBusinessService {
/** /**
* 异步添加装备日志 * 异步添加装备日志
*/ */
private void devLogAdd(List<String> seqNumbers, String remark, Integer userId){ private void devLogAdd(List<String> seqNumbers, String remark, Integer userId,Integer taskId){
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos=new ArrayList<>();
deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach( deviceLibraryDao.findAllBySeqNumberIn(seqNumbers).forEach(
deviceLibrary -> { deviceLibrary -> {
logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId).toDo()); logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId,taskId).toDo());
} }
); );
......
...@@ -211,7 +211,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -211,7 +211,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
long time=System.currentTimeMillis(); long time=System.currentTimeMillis();
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), seqNumbers,lifeStatus); Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), seqNumbers,lifeStatus);
if (count!=0) { if (count!=0) {
TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(), userId); TaskBto taskBto1 = cityRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getName()+"]"+deviceRepel.getTitle(), taskBto.getId(), userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), ""));
} }
} }
...@@ -308,7 +308,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -308,7 +308,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceRepelDetail.setSendUnitId(units1.getUnitId()); deviceRepelDetail.setSendUnitId(units1.getUnitId());
Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus); Integer count=deviceLibraryService.countAllRepel(deviceRepel.getFieldingIds(),unitsService.findBySubordinateUnitName(units1.getUnitId()), DeviceSeqUtil.selectDeviceSeqs(deviceRepel.getSeqNumbers()),lifeStatus);
if (count!=0) { if (count!=0) {
TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(),userId); TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), "["+units1.getName()+"]"+deviceRepel.getTitle(), taskBto.getId(),userId);
list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(),repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel1.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(),repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), ""));
} }
} }
...@@ -373,7 +373,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -373,7 +373,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(),userId); TaskBto taskBto1 = countyRepelTask(unisId, deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail).getId(), deviceRepel.getTitle(), taskBto.getId(),userId);
list.add(new RepelTaskStatistical(deviceRepel.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), "")); list.add(new RepelTaskStatistical(deviceRepel.getId(), taskBto.getId(), taskBto1.getId(), 0, area1.getName(), repelStatusJudgeCount(deviceRepel.getRepelStatus(),count), ""));
} }
}else { }else {
//同上 缺失 //同上 缺失
} }
...@@ -543,7 +542,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -543,7 +542,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId()); DeviceRepel deviceRepel= deviceRepelService.findDeviceRepel(deviceRepelDetail.getRepelId());
waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getId(),"清退装备出库等待上传回执单",userId); waitingReceiptsTask(orderOutData.getSendUnitId(),deviceRepelDetail.getId(),taskBto.getId(),"清退装备出库等待上传回执单",userId);
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"根据["+deviceRepel.getTitle()+"]任务,已完成退回出库",gainThisUser(userId,user.getUnitsId()))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"根据["+deviceRepel.getTitle()+"]任务,已完成退回出库",gainThisUser(userId,user.getUnitsId())));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待接收",userId); devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),deviceRepelDetail.getSendUnit()+"装备清退出库"+",等待接收",userId,taskBto.getId());
orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds())); orderOutDataRepelDetail.setDeviceLibraryEntities(findInvoleDevice(deviceRepelDetail.getDeviceIds()));
//把一些字段填写到对象中,保存入库 //把一些字段填写到对象中,保存入库
//把任务状态修改为 清退提交装备待接收 //把任务状态修改为 清退提交装备待接收
...@@ -694,6 +693,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -694,6 +693,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId));
taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),"上传清退装备签收单,任务完成",storageDeviceRepel.getUserId(),taskBto.getId());
addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"上传签收单,任务完成",findUnitIds(user.getUserId(),unitIds))); addMessage(new MessageBto(taskBto.getId(),taskBto.getBusinessType(),"上传签收单,任务完成",findUnitIds(user.getUserId(),unitIds)));
} else { } else {
if (storageDeviceRepel.getIsIgnore()==null) { if (storageDeviceRepel.getIsIgnore()==null) {
...@@ -715,6 +715,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -715,6 +715,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
taskService.moveToEnd(taskBto); taskService.moveToEnd(taskBto);
taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToEnd(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId));
taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId)); taskService.moveToArchive(taskService.findBillTypeAndFatherId(BusinessEnum.SEND_BACK.id,taskId));
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),"上传清退装备签收单,任务完成",storageDeviceRepel.getUserId(),taskBto.getId());
Documents documents= deviceRepelDetail.toDoc(); Documents documents= deviceRepelDetail.toDoc();
documents.setSrcA(storageDeviceRepel.getSrcA()); documents.setSrcA(storageDeviceRepel.getSrcA());
documents.setSrcB(storageDeviceRepel.getSrcB()); documents.setSrcB(storageDeviceRepel.getSrcB());
...@@ -738,7 +739,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -738,7 +739,6 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical); repelTaskStatisticalService.saveRepelTaskStatistical(repelTaskStatistical);
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
isEnd(taskBto,deviceRepelDetail.getRepelId()); isEnd(taskBto,deviceRepelDetail.getRepelId());
devLogAdd(findInvoleDevice(deviceRepelDetail.getDeviceIds()),"上传清退装备签收单,任务完成",storageDeviceRepel.getUserId());
} }
...@@ -779,7 +779,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -779,7 +779,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndUnitNameAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), deviceRepelDetail.getSendUnit(), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
log.info("更新数据装备以及所属单位{}", System.currentTimeMillis() - time); log.info("更新数据装备以及所属单位{}", System.currentTimeMillis() - time);
} }
devLogAdd(libraries,"省本级清退,把装备转变为待清退",userId); devLogAdd(libraries,"省本级清退,把装备转变为待清退",userId,taskId);
} }
RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId()); RepelTaskStatistical repelTaskStatistical= repelTaskStatisticalService.findRepelTaskStatistical(taskBto.getId(),deviceRepelDetail.getRepelId());
...@@ -814,7 +814,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -814,7 +814,7 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
); );
deviceRepelDetail.setDirectlyUnderDevices(JacksonUtil.toJSon(map)); deviceRepelDetail.setDirectlyUnderDevices(JacksonUtil.toJSon(map));
deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail); deviceRepelDetailService.saveDeviceRepelDetail(deviceRepelDetail);
devLogAdd(libraries,"省直属清退,把装备转变为待清退",securityUser.getCurrentUserInfo().getUserId()); devLogAdd(libraries,"省直属清退,把装备转变为待清退",securityUser.getCurrentUserInfo().getUserId(),taskBto.getId());
deviceLibraryDao.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds())); deviceLibraryDao.upDateLeftStatusAndLockStatus(filterTypeReturnLeftStatus(deviceRepel.getType()), 0, StringUtils.stringToList(deviceRepelDetail.getDeviceIds()));
taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1213,0); taskService.moveToSpecial(taskBto,StatusEnum.SEND_BACK_1213,0);
} }
...@@ -1148,11 +1148,11 @@ public class RepelBusinessServiceImpl implements RepelBusinessService { ...@@ -1148,11 +1148,11 @@ public class RepelBusinessServiceImpl implements RepelBusinessService {
* @param remark * @param remark
* @param userId * @param userId
*/ */
public void devLogAdd(List<DeviceLibrary> deviceLibraries,String remark,Integer userId){ public void devLogAdd(List<DeviceLibrary> deviceLibraries,String remark,Integer userId,Integer taskId){
List<DeviceLog> logDtos=new ArrayList<>(); List<DeviceLog> logDtos=new ArrayList<>();
deviceLibraries.forEach( deviceLibraries.forEach(
deviceLibrary -> { deviceLibrary -> {
logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId).toDo()); logDtos.add(new DeviceLogDto(deviceLibrary.getId(),remark,null,userId,taskId).toDo());
} }
); );
......
...@@ -181,6 +181,7 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -181,6 +181,7 @@ public class RepelQueryServiceImpl implements RepelQueryService {
return new DeviceChooseRepel(deviceLibraryPage,deviceLibraryPageAbnormal,isNotSub,modelMap,typeMap,modelMapAbnormal,typeMapAbnormal); return new DeviceChooseRepel(deviceLibraryPage,deviceLibraryPageAbnormal,isNotSub,modelMap,typeMap,modelMapAbnormal,typeMapAbnormal);
} }
@Override @Override
public List<Integer> findIdList(DeviceChoosePageVo deviceChoosePageVo) { public List<Integer> findIdList(DeviceChoosePageVo deviceChoosePageVo) {
List<Integer> deviceLibraries=new ArrayList<>(); List<Integer> deviceLibraries=new ArrayList<>();
...@@ -587,7 +588,7 @@ public class RepelQueryServiceImpl implements RepelQueryService { ...@@ -587,7 +588,7 @@ public class RepelQueryServiceImpl implements RepelQueryService {
@Override @Override
public DeviceRepelDetail findByBillIdDeviceRepelDetail(Integer repelId) { public DeviceRepelDetail findByBillIdDeviceRepelDetail(Integer repelId) {
return repelDetailService.findDeviceRepelDetailNoDev(repelId); return repelDetailService.findDeviceRepelDetail(repelId);
} }
@Override @Override
......
...@@ -26,9 +26,14 @@ ...@@ -26,9 +26,14 @@
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-excel</artifactId> <artifactId>dev-excel</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.tykj</groupId> <groupId>com.tykj</groupId>
<artifactId>dev-file</artifactId> <artifactId>dev-questionbank</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
......
package com.tykj.dev.device.train.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjm
* @version 1.0.0
* @ClassName GenerateTestPaperController.java
* @Description TODO
* @createTime 2021年06月02日 18:34:00
*/
@RestController
@RequestMapping(value = "/generateTestPaper")
@AutoDocument
@Api(tags = "培训试卷模版", description = "培训试卷模版")
public class GenerateTestPaperController {
}
package com.tykj.dev.device.train.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.service.TestPaperService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjm
* @version 1.0.0
* @ClassName TestPaperController.java
* @Description TODO
* @createTime 2021年05月30日 16:53:00
*/
@RestController
@RequestMapping(value = "/testPaper")
@AutoDocument
@Api(tags = "试卷模块", description = "试卷模块")
public class TestPaperController {
@Autowired
TestPaperService testPaperService;
/**
* 生成试卷
*/
@PostMapping("/generateTestPaper")
public ResponseEntity trainThemeVoResponseEntity(@RequestBody GenerateTestPaper generateTestPaper) {
return ResponseEntity.ok(testPaperService.generateTestPaper(generateTestPaper));
}
}
package com.tykj.dev.device.train.dao;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.OnlineTainUserTime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface GenerateTestPaperDao extends JpaRepository<GenerateTestPaper, Integer>, JpaSpecificationExecutor<GenerateTestPaper> {
}
package com.tykj.dev.device.train.dao;
import com.tykj.dev.device.train.entity.OnlineTainUserTime;
import com.tykj.dev.device.train.entity.TestPaper;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.Optional;
public interface OnlineTainUserTimeDao extends JpaRepository<OnlineTainUserTime, Integer>, JpaSpecificationExecutor<OnlineTainUserTime> {
Optional<OnlineTainUserTime> findByUserIdAndTrainId(Integer userId, Integer trainId);
}
package com.tykj.dev.device.train.dao;
import com.tykj.dev.device.train.entity.TestPaper;
import com.tykj.dev.device.train.entity.TrainTheme;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface TestPaperDao extends JpaRepository<TestPaper, Integer>, JpaSpecificationExecutor<TestPaper> {
TestPaper findByTrainIdAndUserId(Integer trainId,Integer userId);
}
package com.tykj.dev.device.train.entity;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.misc.base.BaseEntity;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Transient;
import java.util.Map;
/**
* @author zjm
* @version 1.0.0
* @ClassName GenerateTestPaper.java
* @Description TODO
* @createTime 2021年05月30日 16:37:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@EntityListeners(AuditingEntityListener.class)
@Entity
@ApiModel(value = "生成试卷vo", description = "生成试卷vo")
public class GenerateTestPaper extends BaseEntity {
private Integer trainId;
@ApiModelProperty(value = "选择题的分数", example = "bmxx", name = "chooseScore")
private Integer chooseScore;
@ApiModelProperty(value = "判断题分数", example = "bmxx", name = "chooseScore")
private Integer judgeScore;
@ApiModelProperty(value = "多选题分数", example = "bmxx", name = "chooseScore")
private Integer multipleChoiceScore;
@ApiModelProperty(value = "简单题分数", example = "bmxx", name = "chooseScore")
private Integer shortAnswerScore;
@ApiModelProperty(value = "选择题的总数", example = "bmxx", name = "chooseScore")
private Integer chooseSubjectCount;
@ApiModelProperty(value = "判断题总数", example = "bmxx", name = "chooseScore")
private Integer judgeSubjectCount;
@ApiModelProperty(value = "多选题总数", example = "bmxx", name = "chooseScore")
private Integer multipleChoiceSubjectCount;
@ApiModelProperty(value = "简单题总数", example = "bmxx", name = "chooseScore")
private Integer shortAnswerSubjectCount;
@Transient
@ApiModelProperty(value = "选择题 key为等级 value 数量", example = "bmxx", name = "chooseCount")
private Map<Integer,Integer> chooseCount;
@Transient
@ApiModelProperty(value = "判断题 key为等级 value 数量", example = "bmxx", name = "judgeCount")
private Map<Integer,Integer> judgeCount;
@Transient
@ApiModelProperty(value = "多选题 key为等级 value 数量", example = "bmxx", name = "multipleChoiceCount")
private Map<Integer,Integer> multipleChoiceCount;
@Transient
@ApiModelProperty(value = "简单题 key为等级 value 数量", example = "bmxx", name = "shortAnswerCount")
private Map<Integer,Integer> shortAnswerCount;
}
package com.tykj.dev.device.train.entity;
import com.tykj.dev.device.train.entity.vo.SubjectVo;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Transient;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName OnlineTainUserTime.java
* @Description 记录用户每一个课题的学习是否完成
* @createTime 2021年06月02日 14:36:00
*/
@ApiModel("线上培训用户学习对象")
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@Data
@Entity
public class OnlineTainUserTime extends BaseEntity {
/**
* 用户id
*/
@ApiModelProperty(value = "用户id", example = "bmxx", name = "userId")
private Integer userId;
/**
* 培训id
*/
@ApiModelProperty(value = "培训id", example = "bmxx", name = "trainId")
private Integer trainId;
@Column(name = "subject_vos", columnDefinition = "TEXT")
private String subjectVos;
@Transient
@ApiModelProperty(value = "课件对象", example = "bmxx", name = "subjectVoList")
private List<SubjectVo> subjectVoList;
/**
* 是否可以考试 1.可以 0.不可以
*/
@ApiModelProperty(value = "是否可以考试 1.可以 0.不可以", example = "bmxx", name = "isNotCanExam")
private Integer isNotCanExam=0;
@Transient
@ApiModelProperty(value = "任务id", example = "bmxx", name = "taskId")
private Integer taskId;
}
package com.tykj.dev.device.train.entity;
import com.tykj.dev.device.train.entity.vo.ProblemVo;
import com.tykj.dev.misc.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Transient;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName TestPaper.java
* @Description 试卷对象
* @createTime 2021年05月30日 14:03:00
*/
@ApiModel("试卷对象")
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@Data
@Entity
public class TestPaper extends BaseEntity {
/**
* 阅卷人
*/
@ApiModelProperty(value = "阅卷人(不)", example = "bmxx", name = "taskId")
private String markingName;
/**
* 总分
*/
@ApiModelProperty(value = "总分(不)", example = "bmxx", name = "taskId")
private Float countScore;
/**
* 试卷所属用户id
*/
@ApiModelProperty(value = "用户id", example = "bmxx", name = "taskId")
private Integer userId;
/**
* 试卷所属用户名称
*/
@ApiModelProperty(value = "用户名称", example = "bmxx", name = "taskId")
private String userName;
@ApiModelProperty(value = "培训id", example = "bmxx", name = "taskId")
private Integer trainId;
@ApiModelProperty(value = "任务id", example = "bmxx", name = "taskId")
private Integer taskId;
//选择题
@Column(name = "choose_problem",columnDefinition = "TEXT")
@ApiModelProperty(value = "选择题(不)", example = "bmxx", name = "taskId")
private String chooseProblem;
//判断
@Column(name = "judge_problem",columnDefinition = "TEXT")
@ApiModelProperty(value = "判断(不)", example = "bmxx", name = "taskId")
private String judgeProblem;
//多选
@Column(name = "multiple_choiceProblem",columnDefinition = "TEXT")
@ApiModelProperty(value = "多选(不)", example = "bmxx", name = "taskId")
private String multipleChoiceProblem;
//简答
@Column(name = "short_answer_problem",columnDefinition = "TEXT")
@ApiModelProperty(value = "简答db(不)", example = "bmxx", name = "taskId")
private String shortAnswerProblem;
@ApiModelProperty(value = "选择题所得的分数(不)", example = "bmxx", name = "chooseScore")
private Float chooseScore;
@ApiModelProperty(value = "判断所得的分数(不)", example = "bmxx", name = "chooseScore")
private Float judgeScore;
@ApiModelProperty(value = "多选所得的分数(不)", example = "bmxx", name = "chooseScore")
private Float multipleScore;
@ApiModelProperty(value = "简答所得的分数(不)", example = "bmxx", name = "chooseScore")
private Float shortAnswerScore;
@Transient
@ApiModelProperty(value = "选择题集合", example = "bmxx", name = "chooseScore")
private List<ProblemVo> chooseProblemList;
@Transient
@ApiModelProperty(value = "判断集合", example = "bmxx", name = "chooseScore")
private List<ProblemVo> judgeProblemList;
@Transient
@ApiModelProperty(value = "多选题", example = "bmxx", name = "chooseScore")
private List<ProblemVo> multipleChoiceProblemList;
@Transient
@ApiModelProperty(value = "简答题", example = "bmxx", name = "chooseScore")
private List<ProblemVo> shortAnswerProblemList;
/**
* 0。待批阅 1。批阅完成
*/
private Integer status = 0;
@Transient
@ApiModelProperty(value = "试卷模版", example = "bmxx", name = "chooseScore")
private GenerateTestPaper generateTestPaper;
}
...@@ -3,7 +3,6 @@ package com.tykj.dev.device.train.entity; ...@@ -3,7 +3,6 @@ package com.tykj.dev.device.train.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.vo.*; import com.tykj.dev.device.train.entity.vo.*;
import com.tykj.dev.misc.base.BaseEntity;
import com.tykj.dev.misc.base.BeanHelper; import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -111,14 +110,12 @@ public class TrainTheme { ...@@ -111,14 +110,12 @@ public class TrainTheme {
@Transient @Transient
private List<FileRet> trainDataFileList = new ArrayList<>(); private List<FileRet> trainDataFileList = new ArrayList<>();
/** /**
* 培训简介 * 培训简介
*/ */
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainSynopsis")
private String trainSynopsis; private String trainSynopsis;
/** /**
* 培训结果 * 培训结果
*/ */
...@@ -172,11 +169,36 @@ public class TrainTheme { ...@@ -172,11 +169,36 @@ public class TrainTheme {
@LastModifiedDate @LastModifiedDate
private LocalDateTime updateTime; private LocalDateTime updateTime;
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
/**
* 考试时间限制
*/
private Integer examinationTL;
@Column(name = "generate_test_paper_string",columnDefinition = "TEXT")
private String generateTestPaperString;
@Transient
private GenerateTestPaper generateTestPaper;
/** /**
* 删除标记(0:未删除,1:已删除) * 删除标记(0:未删除,1:已删除)
*/ */
private Integer deleteTag = 0; private Integer deleteTag = 0;
@Column(name = "courseware_files",columnDefinition = "TEXT")
@ApiModelProperty(value = "课件DB", name = "trainPapersFiles")
private String coursewareFiles;
@ApiModelProperty(value = "课件集合")
@Transient
private List<CoursewareFile> coursewareFileList = new ArrayList<>();
@Column(name = "train_papers_files",columnDefinition = "TEXT") @Column(name = "train_papers_files",columnDefinition = "TEXT")
@ApiModelProperty(value = "培训试卷文件db", name = "trainPapersFiles") @ApiModelProperty(value = "培训试卷文件db", name = "trainPapersFiles")
......
...@@ -113,6 +113,17 @@ public class ByTrainingPeople { ...@@ -113,6 +113,17 @@ public class ByTrainingPeople {
@ApiModelProperty(value = "培训状态", name = "trainStatus") @ApiModelProperty(value = "培训状态", name = "trainStatus")
private Integer trainStatus; private Integer trainStatus;
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
/**
* 考试时间限制
*/
private Integer examinationTL;
/** /**
* 本单位需要参加培训的人员 * 本单位需要参加培训的人员
*/ */
......
package com.tykj.dev.device.train.entity.vo;
import com.tykj.dev.device.file.entity.FileRet;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName CoursewareFile.java
* @Description TODO
* @createTime 2021年06月06日 17:23:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel(value = "课题对象", description = "课题对象")
public class CoursewareFile extends FileRet {
private Integer time;
}
package com.tykj.dev.device.train.entity.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.Transient;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName ProblemVo.java
* @Description TODO
* @createTime 2021年06月02日 13:41:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "用户试卷信息", description = "用户试卷信息")
public class ProblemVo {
@ApiModelProperty(value = "题目描述")
private String des;
@ApiModelProperty(value = "题目答案")
private String problemAnswer;
@ApiModelProperty(value = "题目类型")
private Integer problemType;
@ApiModelProperty(value = "题目难度")
private Integer problemLevel;
//选项 type为1时使用
@ApiModelProperty(value = "题目选项集合")
private List<String> chooseOptionsList;
@ApiModelProperty(value = "用户答案")
private String userAnswers;
@ApiModelProperty(value = "得分")
private Float score;
}
package com.tykj.dev.device.train.entity.vo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName ReadOverTestPaper.java
* @Description TODO
* @createTime 2021年06月07日 19:24:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "批阅试卷接口vo", description = "批阅试卷接口vo")
public class ReadOverTestPaper {
@ApiModelProperty(value = "试卷用户")
private Integer userId;
@ApiModelProperty(value = "培训id")
private Integer trainId;
@ApiModelProperty(value = "阅读题目")
private List<ProblemVo> problemVos;
}
package com.tykj.dev.device.train.entity.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName SubjectVo.java
* @Description TODO
* @createTime 2021年06月02日 14:45:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "课题对象vo", description = "课题对象vo")
public class SubjectVo {
/**
* 课题名称
*/
private String subjectName;
/**
* 所看时间
*/
private Integer time;
/**
* 是否结束 1.结束 0.否
*/
private Integer isEnd;
}
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainUser; import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -12,6 +13,7 @@ import lombok.NoArgsConstructor; ...@@ -12,6 +13,7 @@ import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -119,11 +121,29 @@ public class TrainAuditVo { ...@@ -119,11 +121,29 @@ public class TrainAuditVo {
@ApiModelProperty(value = "发证状态") @ApiModelProperty(value = "发证状态")
private Integer good; private Integer good;
/** /**
* 成绩 * 成绩
*/ */
@ApiModelProperty(value = "gradeEntry") @ApiModelProperty(value = "gradeEntry")
private List<TrainUser> TrainUser; private List<TrainUser> TrainUser;
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
/**
* 考试时间限制
*/
@ApiModelProperty(value = "考试时间限制")
private Integer examinationTL;
@ApiModelProperty(value = "课件集合")
private List<CoursewareFile> coursewareFileList;
@Transient
private GenerateTestPaper generateTestPaper;
} }
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainUser; import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -141,4 +142,23 @@ public class TrainDetailsVo { ...@@ -141,4 +142,23 @@ public class TrainDetailsVo {
private List<TrainUser> trainUsers; private List<TrainUser> trainUsers;
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
/**
* 考试时间限制
*/
@ApiModelProperty(value = "考试时间限制")
private Integer examinationTL;
//
//
@ApiModelProperty(value = "课件集合")
private List<CoursewareFile> coursewareFileList;
@Transient
private GenerateTestPaper generateTestPaper;
} }
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainUser; import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -12,6 +13,8 @@ import lombok.NoArgsConstructor; ...@@ -12,6 +13,8 @@ import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -121,4 +124,23 @@ public class TrainRegistrationVo { ...@@ -121,4 +124,23 @@ public class TrainRegistrationVo {
@ApiModelProperty(value = "isEnd",name = "是否可以结束报名") @ApiModelProperty(value = "isEnd",name = "是否可以结束报名")
private Boolean isEnd; private Boolean isEnd;
@ApiModelProperty(value = "课件集合")
private List<CoursewareFile> coursewareFileList;
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
/**
* 考试时间限制
*/
private Integer examinationTL;
@ApiModelProperty(value = "试卷模版", name = "generateTestPaper")
private GenerateTestPaper generateTestPaper;
} }
package com.tykj.dev.device.train.entity.vo; package com.tykj.dev.device.train.entity.vo;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainTheme; import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.misc.base.BeanHelper; import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -10,6 +11,7 @@ import lombok.Data; ...@@ -10,6 +11,7 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import javax.persistence.Transient;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -94,18 +96,15 @@ public class TrainThemeAddVo { ...@@ -94,18 +96,15 @@ public class TrainThemeAddVo {
@ApiModelProperty(value = "trainSynopsis") @ApiModelProperty(value = "trainSynopsis")
private String trainSynopsis; private String trainSynopsis;
// /**
// * 必须参加
// */
// @ApiModelProperty(value = "参会人员id 集合")
// private List<Integer> joinUserIds=new ArrayList<>();
//
// /**
// * 不必须参会人员
// */
// @ApiModelProperty(value = "参会人员id 集合")
// private List<Integer> noJoinUserIds=new ArrayList<>();
@ApiModelProperty(value = "试卷模版",name = "generateTestPaper")
private GenerateTestPaper generateTestPaper;
/**
* 考试时间限制
*/
@ApiModelProperty(value = "考试时间限制",name = "examinationTL")
private Integer examinationTL;
/** /**
* 需要参加的单位 * 需要参加的单位
...@@ -119,6 +118,15 @@ public class TrainThemeAddVo { ...@@ -119,6 +118,15 @@ public class TrainThemeAddVo {
@ApiModelProperty(value = "培训状态") @ApiModelProperty(value = "培训状态")
private Integer trainStatus; private Integer trainStatus;
@ApiModelProperty(value = "课件集合")
@Transient
private List<CoursewareFile> coursewareFileList = new ArrayList<>();
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
public TrainTheme toDo() { public TrainTheme toDo() {
ModelMapper mapper = BeanHelper.getUserMapper(); ModelMapper mapper = BeanHelper.getUserMapper();
return mapper.map(this, TrainTheme.class); return mapper.map(this, TrainTheme.class);
......
...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo; ...@@ -2,6 +2,7 @@ package com.tykj.dev.device.train.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.device.file.entity.FileRet; import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainUser; import com.tykj.dev.device.train.entity.TrainUser;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -12,6 +13,7 @@ import lombok.NoArgsConstructor; ...@@ -12,6 +13,7 @@ import lombok.NoArgsConstructor;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -113,4 +115,23 @@ public class TrainTrainingVo { ...@@ -113,4 +115,23 @@ public class TrainTrainingVo {
@ApiModelProperty(value = "trainUsers") @ApiModelProperty(value = "trainUsers")
private List<TrainUser> trainUsers; private List<TrainUser> trainUsers;
/**
* 培训类别
*/
@ApiModelProperty(value = "培训类别", name = "trainType")
private Integer trainType;
/**
* 考试时间限制
*/
@ApiModelProperty(value = "考试时间限制")
private Integer examinationTL;
@ApiModelProperty(value = "课件集合")
private List<CoursewareFile> coursewareFileList;
@Transient
private GenerateTestPaper generateTestPaper;
} }
package com.tykj.dev.device.train.service;
import com.tykj.dev.device.train.entity.OnlineTainUserTime;
/**
* @author zjm
* @version 1.0.0
* @ClassName OnlineTainUserTimeService.java
* @Description TODO
* @createTime 2021年06月07日 20:08:00
*/
public interface OnlineTainUserTimeService {
OnlineTainUserTime findByUserIdAndTrainId(Integer userId,Integer trainId);
}
package com.tykj.dev.device.train.service;
import com.tykj.dev.device.train.entity.TestPaper;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import java.util.List;
public interface TestPaperService {
/**
* 添加试卷
*/
TestPaper saveProble(TestPaper testPaper);
/**
* 根据id查询试卷
*/
TestPaper findByIdProble(Integer id);
/**
* 根据id查询试卷
*/
TestPaper findByUserIdAndTrainId(Integer userId,Integer trainId);
/**
* 查询所有试卷
*/
List<TestPaper> findAll();
/**
* 根据id删除试卷
*/
void deleteById(Integer id);
/**
* 生成试卷
*/
TestPaper generateTestPaper(GenerateTestPaper generateTestPaper);
// Page<TestPaper> pageTestPaperSelect(TestPaperPageVo TestPaperPageVo);
}
package com.tykj.dev.device.train.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.train.dao.OnlineTainUserTimeDao;
import com.tykj.dev.device.train.entity.OnlineTainUserTime;
import com.tykj.dev.device.train.entity.vo.SubjectVo;
import com.tykj.dev.device.train.service.OnlineTainUserTimeService;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
* @author zjm
* @version 1.0.0
* @ClassName OnlineTainUserTimeServiceImpl.java
* @Description TODO
* @createTime 2021年06月07日 20:09:00
*/
@Service
public class OnlineTainUserTimeServiceImpl implements OnlineTainUserTimeService {
@Autowired
OnlineTainUserTimeDao onlineTainUserTimeDao;
@Override
public OnlineTainUserTime findByUserIdAndTrainId(Integer userId, Integer trainId) {
Optional<OnlineTainUserTime> optionalOnlineTainUserTime= onlineTainUserTimeDao.findByUserIdAndTrainId(userId,trainId);
if (optionalOnlineTainUserTime.isPresent()) {
OnlineTainUserTime onlineTainUserTime=optionalOnlineTainUserTime.get();
if (onlineTainUserTime.getSubjectVoList() != null) {
onlineTainUserTime.setSubjectVoList(JacksonUtil.readValue(onlineTainUserTime.getSubjectVos(), new TypeReference<List<SubjectVo>>() {
}));
}
return onlineTainUserTime;
}else {
return null;
}
}
}
package com.tykj.dev.device.train.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.questionbank.entity.Problem;
import com.tykj.dev.device.questionbank.service.ProblemService;
import com.tykj.dev.device.train.dao.TestPaperDao;
import com.tykj.dev.device.train.entity.TestPaper;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.vo.ProblemVo;
import com.tykj.dev.device.train.service.TestPaperService;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Random;
/**
* @author zjm
* @version 1.0.0
* @ClassName TestPaperServiceImpl.java
* @Description TODO
* @createTime 2021年05月30日 16:33:00
*/
@Service
public class TestPaperServiceImpl implements TestPaperService {
@Autowired
TestPaperDao testPaperDao;
@Autowired
ProblemService problemService;
@Override
public TestPaper saveProble(TestPaper testPaper) {
return testPaperDao.save(testPaper);
}
@Override
public TestPaper findByIdProble(Integer id) {
Optional<TestPaper> optional = testPaperDao.findById(id);
if (optional.isPresent()){
TestPaper testPaper= optional.get();
testPaper.setJudgeProblemList(JacksonUtil.readValue(testPaper.getJudgeProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setChooseProblemList(JacksonUtil.readValue(testPaper.getChooseProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setMultipleChoiceProblemList(JacksonUtil.readValue(testPaper.getMultipleChoiceProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setShortAnswerProblemList(JacksonUtil.readValue(testPaper.getShortAnswerProblem(), new TypeReference<List<ProblemVo>>() {
}));
return testPaper;
}else {
throw new ApiException(ResponseEntity.status(500).body("[试卷] 没有找到对应的试卷"));
}
}
@Override
public TestPaper findByUserIdAndTrainId(Integer userId, Integer trainId) {
TestPaper testPaper= testPaperDao.findByTrainIdAndUserId(trainId,userId);
testPaper.setJudgeProblemList(JacksonUtil.readValue(testPaper.getJudgeProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setChooseProblemList(JacksonUtil.readValue(testPaper.getChooseProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setMultipleChoiceProblemList(JacksonUtil.readValue(testPaper.getMultipleChoiceProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setShortAnswerProblemList(JacksonUtil.readValue(testPaper.getShortAnswerProblem(), new TypeReference<List<ProblemVo>>() {
}));
return testPaper;
}
@Override
public List<TestPaper> findAll() {
return testPaperDao.findAll();
}
@Override
public void deleteById(Integer id) {
testPaperDao.deleteById(id);
}
@Override
public TestPaper generateTestPaper(GenerateTestPaper generateTestPaper) {
TestPaper testPaper=new TestPaper();
// testPaper.setChooseProblemList(problemService.findByTypeAndLevel(1,1));
// testPaper.setJudgeProblemList(problemService.findByTypeAndLevel(2,1));
// testPaper.setMultipleChoiceProblemList(problemService.findByTypeAndLevel(4,1));
// testPaper.setShortAnswerProblemList(problemService.findByTypeAndLevel(3,1));
// generateTestPaper.
List<ProblemVo> chooseList=new ArrayList<>();
List<ProblemVo> judgeProblemList=new ArrayList<>();
List<ProblemVo> multipleChoiceProblemList=new ArrayList<>();
List<ProblemVo> shortAnswerProblemList=new ArrayList<>();
generateTestPaper.getChooseCount().forEach(
(k,v)->{
if (v!=0) {
chooseList.addAll(getSubStringByRadom(problemService.findByTypeAndLevel(1, k), v));
}
}
);
generateTestPaper.getJudgeCount().forEach(
(k,v)->{
if (v!=0) {
judgeProblemList.addAll(getSubStringByRadom(problemService.findByTypeAndLevel(2, k), v));
}
}
);
generateTestPaper.getMultipleChoiceCount().forEach(
(k,v)->{
if (v!=0) {
multipleChoiceProblemList.addAll(getSubStringByRadom(problemService.findByTypeAndLevel(4, k), v));
}
}
);
generateTestPaper.getShortAnswerCount().forEach(
(k,v)->{
if (v!=0) {
shortAnswerProblemList.addAll(getSubStringByRadom(problemService.findByTypeAndLevel(3, k), v));
}
}
);
testPaper.setChooseProblemList(chooseList);
testPaper.setShortAnswerProblemList(shortAnswerProblemList);
testPaper.setMultipleChoiceProblemList(multipleChoiceProblemList);
testPaper.setJudgeProblemList(judgeProblemList);
testPaper.setChooseProblem(JacksonUtil.toJSon(testPaper.getChooseProblemList()));
testPaper.setJudgeProblem(JacksonUtil.toJSon(testPaper.getJudgeProblemList()));
testPaper.setMultipleChoiceProblem(JacksonUtil.toJSon(testPaper.getMultipleChoiceProblemList()));
testPaper.setShortAnswerProblem(JacksonUtil.toJSon(testPaper.getShortAnswerProblemList()));
return testPaper;
}
public List<ProblemVo> getSubStringByRadom(List<Problem> list, int count){
List backList = null;
backList = new ArrayList<ProblemVo>();
Random random = new Random();
int backSum = 0;
if (list.size() >= count) {
backSum = count;
}else {
backSum = list.size();
}
for (int i = 0; i < backSum; i++) {
// 随机数的范围为0-list.size()-1
int target = random.nextInt(list.size());
backList.add(toVo(list.get(target)));
list.remove(target);
}
return backList;
}
private ProblemVo toVo(Problem problem){
ModelMapper mapper = BeanHelper.getUserMapper();
ProblemVo problemVo= mapper.map(problem,ProblemVo.class);
if (problem.getChooseOptions()!=null) {
problemVo.setChooseOptionsList(JacksonUtil.readValue(problem.getChooseOptions(), new TypeReference<List<String>>() {
}));
}
return problemVo;
}
}
package com.tykj.dev.device.train.service.impl; package com.tykj.dev.device.train.service.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.github.wenhao.jpa.PredicateBuilder; import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications; import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.blockcha.subject.entity.BcHash; import com.tykj.dev.blockcha.subject.entity.BcHash;
import com.tykj.dev.blockcha.subject.service.BlockChainUtil; import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil; import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.train.dao.TrainThemeDao; import com.tykj.dev.device.train.dao.TrainThemeDao;
import com.tykj.dev.device.train.dao.TrainUnitDao; import com.tykj.dev.device.train.dao.TrainUnitDao;
import com.tykj.dev.device.train.dao.TrainUserDao; import com.tykj.dev.device.train.dao.TrainUserDao;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TrainTheme; import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.entity.TrainUnit; import com.tykj.dev.device.train.entity.TrainUnit;
import com.tykj.dev.device.train.entity.TrainUser; import com.tykj.dev.device.train.entity.TrainUser;
...@@ -176,6 +179,8 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -176,6 +179,8 @@ public class TrainThemeServiceImpl implements TrainThemeService {
} }
} }
); );
trainRegistrationVo.setGenerateTestPaper(JacksonUtil.readValue(trainTheme.getGenerateTestPaperString(),GenerateTestPaper.class));
trainRegistrationVo.setCoursewareFileList(JacksonUtil.readValue(trainTheme.getCoursewareFiles(), new TypeReference<List<CoursewareFile>>() {}));
trainRegistrationVo.setIsEnd(flag.get()); trainRegistrationVo.setIsEnd(flag.get());
trainRegistrationVo.setNoSignUpTrainUserToUnitVo(notSignUpTrainUserToUnitVo); trainRegistrationVo.setNoSignUpTrainUserToUnitVo(notSignUpTrainUserToUnitVo);
trainRegistrationVo.setSignUpTrainUserToUnitVo(signUpTrainUserToUnitVo); trainRegistrationVo.setSignUpTrainUserToUnitVo(signUpTrainUserToUnitVo);
...@@ -189,6 +194,9 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -189,6 +194,9 @@ public class TrainThemeServiceImpl implements TrainThemeService {
TrainTrainingVo trainTrainingVo = trainTheme.toTrainTrainingVo(); TrainTrainingVo trainTrainingVo = trainTheme.toTrainTrainingVo();
trainTrainingVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles())); trainTrainingVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles()));
trainTrainingVo.setTrainUsers(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId)); trainTrainingVo.setTrainUsers(trainUserDao.findAllByIsSignUpAndTrainId(1,trainThemeId));
trainTrainingVo.setCoursewareFileList(JacksonUtil.readValue(trainTheme.getCoursewareFiles(), new TypeReference<List<CoursewareFile>>() {
}));
trainTrainingVo.setGenerateTestPaper(JacksonUtil.readValue(trainTheme.getGenerateTestPaperString(), GenerateTestPaper.class));
return trainTrainingVo; return trainTrainingVo;
} }
...@@ -262,6 +270,9 @@ public class TrainThemeServiceImpl implements TrainThemeService { ...@@ -262,6 +270,9 @@ public class TrainThemeServiceImpl implements TrainThemeService {
trainUsers.forEach(trainUser -> { trainUsers.forEach(trainUser -> {
trainUser.setMgrcert(mgrcertService.findByUserId(trainUser.getUserId())); trainUser.setMgrcert(mgrcertService.findByUserId(trainUser.getUserId()));
}); });
trainDetailsVo.setCoursewareFileList(JacksonUtil.readValue(trainTheme.getCoursewareFiles(), new TypeReference<List<CoursewareFile>>() {
}));
trainDetailsVo.setGenerateTestPaper(JacksonUtil.readValue(trainTheme.getGenerateTestPaperString(), GenerateTestPaper.class));
trainDetailsVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles())); trainDetailsVo.setTrainDataFileList(FilesUtil.stringFileToList(trainTheme.getTrainDataFiles()));
trainDetailsVo.setTrainPapersFileList(FilesUtil.stringFileToList(trainTheme.getTrainPapersFiles())); trainDetailsVo.setTrainPapersFileList(FilesUtil.stringFileToList(trainTheme.getTrainPapersFiles()));
trainDetailsVo.setTrainUsers(trainUsers); trainDetailsVo.setTrainUsers(trainUsers);
......
...@@ -352,6 +352,18 @@ ...@@ -352,6 +352,18 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-questionbank</artifactId>
<version>1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.tykj.dev</groupId>
<artifactId>union</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>rfid</artifactId> <artifactId>rfid</artifactId>
......
...@@ -10,6 +10,7 @@ import com.tykj.dev.device.user.base.ret.BusinessTypeVo; ...@@ -10,6 +10,7 @@ import com.tykj.dev.device.user.base.ret.BusinessTypeVo;
import com.tykj.dev.device.user.base.ret.MessageSelectVo; import com.tykj.dev.device.user.base.ret.MessageSelectVo;
import com.tykj.dev.device.user.read.service.MessageService; import com.tykj.dev.device.user.read.service.MessageService;
import com.tykj.dev.device.user.read.subject.vo.MessageUserVo; import com.tykj.dev.device.user.read.subject.vo.MessageUserVo;
import com.tykj.dev.device.user.subject.entity.SecurityUser;
import com.tykj.dev.misc.utils.PageUtil; import com.tykj.dev.misc.utils.PageUtil;
import com.tykj.dev.socket.MyWebSocket; import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -17,7 +18,9 @@ import io.swagger.annotations.ApiOperation; ...@@ -17,7 +18,9 @@ import io.swagger.annotations.ApiOperation;
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.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -95,4 +98,10 @@ public class MessageController { ...@@ -95,4 +98,10 @@ public class MessageController {
public ResponseEntity completeMessage(@PathVariable("id") int id){ public ResponseEntity completeMessage(@PathVariable("id") int id){
return ResponseEntity.ok(messageService.complete(id).parse2Bto().toVo()); return ResponseEntity.ok(messageService.complete(id).parse2Bto().toVo());
} }
@ApiOperation(value = "判断是否存在阅知")
@GetMapping("/isNotExistMessage")
public ResponseEntity completeMessage(@ApiIgnore @AuthenticationPrincipal SecurityUser securityUser){
return ResponseEntity.ok(messageService.isNotExistMessage(securityUser.getCurrentUserInfo().getUserId()));
}
} }
...@@ -41,4 +41,9 @@ public interface MessageService { ...@@ -41,4 +41,9 @@ public interface MessageService {
* 完成该阅知信息 * 完成该阅知信息
*/ */
Message complete(Integer messageId); Message complete(Integer messageId);
/**
* 根据用户id查询阅知信息
*/
boolean isNotExistMessage(Integer userId);
} }
...@@ -207,4 +207,13 @@ public class MessageServiceImpl implements MessageService { ...@@ -207,4 +207,13 @@ public class MessageServiceImpl implements MessageService {
messageBto.setCompleteUserIdList(userIds); messageBto.setCompleteUserIdList(userIds);
return messageDao.save(messageBto.toDo()); return messageDao.save(messageBto.toDo());
} }
@Override
public boolean isNotExistMessage(Integer userId) {
return messageDao.findAll().stream()
.map(Message::parse2Bto)
.allMatch(messageBto -> messageBto.getInvolveUserIdList().contains(userId)&&messageBto.getCompleteUserIdList().contains(userId));
}
} }
...@@ -234,4 +234,11 @@ public class UserController { ...@@ -234,4 +234,11 @@ public class UserController {
return ResponseEntity.ok(userService.findUnitIdListUser(unitId)); return ResponseEntity.ok(userService.findUnitIdListUser(unitId));
} }
@GetMapping("/deleteUser/{id}")
@ApiOperation(value = "删除不是专管员的用户")
public ResponseEntity delete(@PathVariable("id") Integer id){
userService.deleteById(id);
return ResponseEntity.ok("ok");
}
} }
...@@ -34,7 +34,6 @@ import javax.persistence.*; ...@@ -34,7 +34,6 @@ import javax.persistence.*;
@Entity @Entity
@ApiModel(value = "用户对象", description = "用户详细信息") @ApiModel(value = "用户对象", description = "用户详细信息")
@EntityListeners(AuditingEntityListener.class) @EntityListeners(AuditingEntityListener.class)
@Where(clause = "delete_tag = 0")
public class User { public class User {
/** /**
* 用户 * 用户
......
...@@ -170,4 +170,6 @@ public interface UserService extends PublicService<User> { ...@@ -170,4 +170,6 @@ public interface UserService extends PublicService<User> {
List<User> saveAll(List<User> users); List<User> saveAll(List<User> users);
void deleteById(Integer userId);
} }
...@@ -18,6 +18,7 @@ import com.tykj.dev.device.user.subject.entity.*; ...@@ -18,6 +18,7 @@ import com.tykj.dev.device.user.subject.entity.*;
import com.tykj.dev.device.user.subject.service.*; import com.tykj.dev.device.user.subject.service.*;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.SpringUtils; import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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;
...@@ -177,17 +178,17 @@ public class UserServiceImpl implements UserService { ...@@ -177,17 +178,17 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<UserShenRe> findByUniteId(Integer unitsId) { public List<UserShenRe> findByUniteId(Integer unitsId) {
return userDao.findAllByUnitsId(unitsId).stream().filter(user -> user.getIsDel()==0).map(User::toRe).sorted(Comparator.comparing(UserShenRe::getShowOrder)).collect(Collectors.toList()); return userDao.findAllByUnitsId(unitsId).stream().filter(user -> user.getIsDel()==0 && user.getDeleteTag()==0).map(User::toRe).sorted(Comparator.comparing(UserShenRe::getShowOrder)).collect(Collectors.toList());
} }
@Override @Override
public List<UserShenRe> findByUniteId1(Integer unitsId) { public List<UserShenRe> findByUniteId1(Integer unitsId) {
return userDao.findAllByUnitsId(unitsId).stream().filter(user -> user.getTrainStatus()!=5&&user.getIsDel()==0).map(User::toRe).sorted(Comparator.comparing(UserShenRe::getShowOrder)).collect(Collectors.toList()); return userDao.findAllByUnitsId(unitsId).stream().filter(user -> user.getTrainStatus()!=5&&user.getIsDel()==0&& user.getDeleteTag()==0).map(User::toRe).sorted(Comparator.comparing(UserShenRe::getShowOrder)).collect(Collectors.toList());
} }
@Override @Override
public List<User> findAllByUnite(Integer unitsId) { public List<User> findAllByUnite(Integer unitsId) {
return userDao.findAllByUnitsId(unitsId).stream().filter(user -> user.getTrainStatus()!=5&&user.getIsDel()==0).collect(Collectors.toList()); return userDao.findAllByUnitsId(unitsId).stream().filter(user -> user.getTrainStatus()!=5&&user.getIsDel()==0&& user.getDeleteTag()==0).collect(Collectors.toList());
} }
...@@ -310,6 +311,8 @@ public class UserServiceImpl implements UserService { ...@@ -310,6 +311,8 @@ public class UserServiceImpl implements UserService {
}else if (userConditionsVo.getType()==2){ }else if (userConditionsVo.getType()==2){
predicateBuilder.eq("unitsId",userConditionsVo.getUnitsId()); predicateBuilder.eq("unitsId",userConditionsVo.getUnitsId());
} }
predicateBuilder.eq("deleteTag",0);
predicateBuilder.eq("isDel",0);
if (userConditionsVo.getDim() != null) { if (userConditionsVo.getDim() != null) {
Class<User> deviceLibraryEntity = User.class; Class<User> deviceLibraryEntity = User.class;
Field[] declaredFields = deviceLibraryEntity.getDeclaredFields(); Field[] declaredFields = deviceLibraryEntity.getDeclaredFields();
...@@ -457,7 +460,7 @@ public class UserServiceImpl implements UserService { ...@@ -457,7 +460,7 @@ public class UserServiceImpl implements UserService {
List<UserSuperiorVo> list = new ArrayList<>(); List<UserSuperiorVo> list = new ArrayList<>();
User user = userDao.findById(userId).get(); User user = userDao.findById(userId).get();
userDao.findAllByUnitsIdIn(unitsService.findSuperiorByunitsId(user.getUnitsId())).stream().filter(user1 -> user1.getIsDel()==0&&user1.getTrainStatus()!=5).forEach( userDao.findAllByUnitsIdIn(unitsService.findSuperiorByunitsId(user.getUnitsId())).stream().filter(user1 -> user1.getIsDel()==0&&user1.getTrainStatus()!=5&& user.getDeleteTag()==0).forEach(
user1 -> { user1 -> {
UserSuperiorVo userSuperiorVo = user1.toUserSuperiorVo(); UserSuperiorVo userSuperiorVo = user1.toUserSuperiorVo();
userSuperiorVo.setUnitsName(unitsService.findById(user1.getUnitsId()).getName()); userSuperiorVo.setUnitsName(unitsService.findById(user1.getUnitsId()).getName());
...@@ -469,7 +472,7 @@ public class UserServiceImpl implements UserService { ...@@ -469,7 +472,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<User> findUnitsIdInUsers(List<Integer> units) { public List<User> findUnitsIdInUsers(List<Integer> units) {
return userDao.findAllByUnitsIdIn(units).stream().filter(user -> user.getTrainStatus()!=5).collect(Collectors.toList()); return userDao.findAllByUnitsIdIn(units).stream().filter(user -> user.getTrainStatus()!=5 && user.getDeleteTag()==0 && user.getIsDel()==0).collect(Collectors.toList());
} }
@Override @Override
...@@ -504,7 +507,11 @@ public class UserServiceImpl implements UserService { ...@@ -504,7 +507,11 @@ public class UserServiceImpl implements UserService {
public User addNoIsUser(NotIsUser notIsUser) { public User addNoIsUser(NotIsUser notIsUser) {
User user=new User(); User user=new User();
user.setName(notIsUser.getName()); user.setName(notIsUser.getName());
user.setUnitsId(notIsUser.getUnitId()); if (notIsUser.getUnitId()!=null) {
user.setUnitsId(notIsUser.getUnitId());
}else {
throw new ApiException(ResponseEntity.status(500).body("[用户] 没有传单位id"));
}
user.setShowOrder(3); user.setShowOrder(3);
user.setTrainStatus(5); user.setTrainStatus(5);
User user1 = userDao.save(user); User user1 = userDao.save(user);
...@@ -532,7 +539,7 @@ public class UserServiceImpl implements UserService { ...@@ -532,7 +539,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public List<UserShenRe> findUnitNameListUser(UnitNameVo unitNameVo) { public List<UserShenRe> findUnitNameListUser(UnitNameVo unitNameVo) {
return userDao.findAllByUnitsId(userPublicService.findUnitIdByName(unitNameVo.getUnitName())).stream().filter(user -> user.getIsDel()==0).map(User::toRe).collect(Collectors.toList()); return userDao.findAllByUnitsId(userPublicService.findUnitIdByName(unitNameVo.getUnitName())).stream().filter(user -> user.getIsDel()==0&& user.getDeleteTag()==0).map(User::toRe).collect(Collectors.toList());
} }
@Override @Override
...@@ -545,6 +552,13 @@ public class UserServiceImpl implements UserService { ...@@ -545,6 +552,13 @@ public class UserServiceImpl implements UserService {
return userDao.saveAll(users); return userDao.saveAll(users);
} }
@Override
public void deleteById(Integer userId) {
User user= findByUser(userId);
user.setDeleteTag(1);
userDao.save(user);
}
private List<Integer> to(List<Integer> ids,Area area){ private List<Integer> to(List<Integer> ids,Area area){
if (area.getFatherId()==null){ if (area.getFatherId()==null){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论