修改培训管理相关接口

dev
litao 3 years ago
parent 536c183fb6
commit 6983e44cad
  1. 6
      lab-service-api/lab-dict-api/src/main/java/org/springblade/system/enums/DictBizEnum.java
  2. 2
      lab-service-api/lab-lims-api/src/main/java/org/springblade/lims/entry/ExamineDataArrVO.java
  3. 60
      lab-service-api/lab-user-api/src/main/java/org/springblade/system/user/entity/Train.java
  4. 6
      lab-service-api/lab-user-api/src/main/java/org/springblade/system/user/entity/TrainPerson.java
  5. 42
      lab-service-api/lab-user-api/src/main/java/org/springblade/system/user/entity/TrainYear.java
  6. 6
      lab-service-api/lab-user-api/src/main/java/org/springblade/system/user/entity/User.java
  7. 4
      lab-service/lab-file/src/main/java/org/springblade/file/controller/QualityFileController.java
  8. 1
      lab-service/lab-file/src/main/java/org/springblade/file/mapper/QualityFileMapper.xml
  9. 16
      lab-service/lab-file/src/main/java/org/springblade/file/service/impl/EquipVerificationServiceImpl.java
  10. 25
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/EntrustController.java
  11. 116
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/ExamineResultController.java
  12. 1
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/InstrumentController.java
  13. 46
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/LargeScreenController.java
  14. 10
      lab-service/lab-lims/src/main/java/org/springblade/lims/controller/TaskBlueprintController.java
  15. 336
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java
  16. 66
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/ExamineResultServiceImpl.java
  17. 16
      lab-service/lab-user/pom.xml
  18. 62
      lab-service/lab-user/src/main/java/org/springblade/system/user/controller/TeacherController.java
  19. 136
      lab-service/lab-user/src/main/java/org/springblade/system/user/controller/TrainController.java
  20. 5
      lab-service/lab-user/src/main/java/org/springblade/system/user/controller/TrainPersonController.java
  21. 25
      lab-service/lab-user/src/main/java/org/springblade/system/user/controller/TrainSpeakController.java
  22. 100
      lab-service/lab-user/src/main/java/org/springblade/system/user/controller/TrainYearController.java
  23. 4
      lab-service/lab-user/src/main/java/org/springblade/system/user/mapper/TrainPersonMapper.xml
  24. 14
      lab-service/lab-user/src/main/java/org/springblade/system/user/mapper/TrainYearMapper.java
  25. 10
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/ITrainService.java
  26. 18
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/ITrainYearService.java
  27. 404
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/impl/TrainServiceImpl.java
  28. 110
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/impl/TrainYearServiceImpl.java
  29. 4
      lab-service/lab-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@ -76,7 +76,11 @@ public enum DictBizEnum {
/**
* 打印标签相关
*/
LABEL_PRINT("label_print")
LABEL_PRINT("label_print"),
/**
* 考核方式
*/
ASSESSMENT_METHOD("assessment_method")
;

@ -2,8 +2,6 @@ package org.springblade.lims.entry;
import lombok.Data;
import java.util.List;
@Data
public class ExamineDataArrVO {

@ -8,7 +8,6 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
@ -28,14 +27,22 @@ public class Train extends BaseEntity {
* 编号
*/
private String code;
// 年度id
private Long yearId;
/**
* 培训名称
* 培训主题
*/
private String name;
/**
* 培训内容
*/
private String content;
/**
* 培训主体内容
*/
private String contentSubject;
/**
* 培训应到人数
*/
@ -55,6 +62,19 @@ public class Train extends BaseEntity {
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date startTime;
/**
* 培训结束时间
*/
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date endTime;
/**
* 时长
*/
@ -90,6 +110,12 @@ public class Train extends BaseEntity {
@TableField(exist = false)
private String trainPerson;
/**
* 主讲人
*/
@TableField(exist = false)
private String trainTeacher;
// 是否参加
@TableField(exist = false)
private Integer isJoin;
@ -100,5 +126,33 @@ public class Train extends BaseEntity {
// 评价分数
@TableField(exist = false)
private Integer evaluateScore;
private String evaluateScore;
// 培训部门
private String trainDept;
// 培训对象
private String trainTarget;
// 培训单位
private String trainUnit;
// 培训教材
private String trainMaterial;
// 考核方式
private String assessmentMethod;
// 培训有效性评价
private String trainEvaluate;
// 记录人
// private String recordName;
// 记录时间
// private Date recordTime;
// 评价人
// private String evaluateName;
// 评价时间
// private String evaluateTime;
}

@ -60,11 +60,11 @@ public class TrainPerson extends BaseEntity {
private Integer isDeleted;
// 是否评价
// 是否需要打分
private Integer isEvaluate;
// 评价分数
private Integer evaluateScore;
// 分数
private String evaluateScore;
// 签到时间
private Date signInTime;

@ -0,0 +1,42 @@
package org.springblade.system.user.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 培训计划表实体类
* @author litao
* @since 2022-06-10
*/
@Data
@TableName("blade_train_year")
@EqualsAndHashCode(callSuper = true)
public class TrainYear extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 年份
*/
private String year;
/**
* 人员现状分析
*/
private String userStatusAnalysis;
/**
* 计划数量
*/
private Integer count;
private String trainJson;
}

@ -1,6 +1,7 @@
package org.springblade.system.user.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -76,6 +77,11 @@ public class User extends TenantEntity {
* 部门id
*/
private String deptId;
/**
* 部门名称
*/
@TableField(exist = false)
private String deptName;
/**
* 岗位id
*/

@ -101,7 +101,9 @@ public class QualityFileController extends BladeController {
QueryWrapper<QualityFileAssistent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("quality_file_id", record.getId()).eq("version", version);
QualityFileAssistent one = qualityFileAssistentService.getOne(queryWrapper);
record.setVersionName(one.getName());
if (one != null) {
record.setVersionName(one.getName());
}
}
pages.setRecords(records);
return R.data(pages);

@ -30,6 +30,7 @@
AND active_dept_ids like CONCAT('%', #{qualityFile.categoryId,jdbcType=VARCHAR}, '%')
</if>
AND is_deleted = 0
ORDER BY create_time DESC
</where>
</select>

@ -101,9 +101,9 @@ public class EquipVerificationServiceImpl extends BaseServiceImpl<EquipVerificat
}
@Override
public void setVerificationState(List<EquipVerificationVO> list){
public void setVerificationState(List<EquipVerificationVO> list) {
//遍历确定每件设备是否该检定了
list.forEach(e ->{
list.forEach(e -> {
// //当前日期
// LocalDate localDate = LocalDate.now();
// LocalDateTime enableTime = e.getEnableTime();
@ -133,20 +133,20 @@ public class EquipVerificationServiceImpl extends BaseServiceImpl<EquipVerificat
LocalDate now = LocalDate.now();
LocalDateTime lastVerificationTime = e.getLastVerificationTime() == null ? e.getEnableTime() : e.getLastVerificationTime();
//上次检定日期
LocalDate lastVerificationDay =lastVerificationTime.toLocalDate();
LocalDate lastVerificationDay = lastVerificationTime.toLocalDate();
if(ChronoUnit.DAYS.between(lastVerificationDay, now) >= 0){ //只有当前日期 > = 上次检定日期
if (ChronoUnit.DAYS.between(lastVerificationDay, now) >= 0) { //只有当前日期 > = 上次检定日期
long between = ChronoUnit.DAYS.between(lastVerificationDay, now);
Integer cycle = e.getCycle();
if ((between / cycle) >= 1 ){ //说明超过一轮未检测了
if ((between / cycle) >= 1) { //说明超过一轮未检测了
e.setStatus(0);
}else if((between % cycle) < (cycle - e.getWarnBefore())){ //说明未到下一个预检周期
} else if ((between % cycle) < (cycle - e.getWarnBefore())) { //说明未到下一个预检周期
e.setStatus(1);
}else if((between % cycle) >= (cycle - e.getWarnBefore())){ //说明到下一个预检周期的提醒时间内了,也要设为未检查
} else if ((between % cycle) >= (cycle - e.getWarnBefore())) { //说明到下一个预检周期的提醒时间内了,也要设为未检查
e.setStatus(0);
}
}
}
});
}

@ -1540,10 +1540,31 @@ public class EntrustController extends BladeController {
*/
@GetMapping("/getEntrusts")
public R<List<Entrust>> getEntrusts(String id) {
List<Entrust> entrustList = new ArrayList<>();
List<String> list = new ArrayList<>();
list.add("111");
list.add("7");
list.add("2");
LambdaQueryWrapper<Entrust> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Entrust::getContractId, id);
wrapper.eq(Entrust::getEntrustStatus, "7");
return R.data(service.list(wrapper));
wrapper.in(Entrust::getEntrustStatus, list);
List<Entrust> entrusts = service.list(wrapper);
if (CollectionUtils.isNotEmpty(entrusts)) {
for (Entrust entrust : entrusts) {
LambdaQueryWrapper<Examine> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Examine::getEntrustId, entrust.getId());
List<Examine> examines = examineService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(examines)) {
String[] split = examines.get(0).getExperieNum().split(",")[0].split("-");
if (Integer.parseInt(split[split.length - 1]) != 1) {
continue;
}
entrustList.add(entrust);
}
}
}
return R.data(entrustList);
}
/**

@ -697,6 +697,103 @@ public class ExamineResultController extends BladeController {
map1.put("g" + (i + 1), mapList);
}
}
// 禽白血病病毒ELISA抗原检测试剂盒(哈尔滨国生生物科技股份有限公司)
else if ("1589877000410296322".equals(reagentId)) {
for (int i = 0; i < group; i++) {
List<Map<String, Map<String, Object>>> mapList = new ArrayList<>();
List<ExamineExcel> excels = map.get(i + 1 + "");
double code1 = Double.parseDouble(excels.get(0).getCode1());
double code2 = Double.parseDouble(excels.get(1).getCode1());
double code3 = Double.parseDouble(excels.get(2).getCode1());
double code4 = Double.parseDouble(excels.get(3).getCode1());
double v1 = (code1 + code2) / 2;
double v2 = (code3 + code4) / 2;
DecimalFormat df = new DecimalFormat("#0.000");
for (int j = 0; j < excels.size(); j++) {
// 行标头:前端渲染需要A、B、C....
String a = String.valueOf((char) (j + 65));
ExamineExcel examineExcel = excels.get(j);//取到一行记录
int filedsLength = examineExcel.getClass().getDeclaredFields().length - 1;
Map<String, Map<String, Object>> map2 = new HashMap<>();
String SP = "0.00";
for (int n = 1; n <= filedsLength; n++) {
String code;
switch (n) {
case 1:
code = examineExcel.getCode1();
break;
case 2:
code = examineExcel.getCode2();
break;
case 3:
code = examineExcel.getCode3();
break;
case 4:
code = examineExcel.getCode4();
break;
case 5:
code = examineExcel.getCode5();
break;
case 6:
code = examineExcel.getCode6();
break;
case 7:
code = examineExcel.getCode7();
break;
case 8:
code = examineExcel.getCode8();
break;
case 9:
code = examineExcel.getCode9();
break;
case 10:
code = examineExcel.getCode10();
break;
case 11:
code = examineExcel.getCode11();
break;
case 12:
code = examineExcel.getCode12();
break;
default:
code = "0";
}
Map<String, Object> mapResult = new HashMap<>();
int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义
if (StringUtil.isNoneBlank(code)) {
if (j > 5 || n > 1) {
if ((v2 - v1) != 0) {
SP = df.format((Double.parseDouble(code) - v1) / (v2 - v1));
}
mapResult.put("originResult", code);
mapResult.put("value", SP);
mapResult.put("num", "1");
if (Double.parseDouble(SP) >= 0.2) {
mapResult.put("result", "阳性");
} else {
mapResult.put("result", "阴性");
}
} else {
mapResult.put("originResult", code);
mapResult.put("num", "");
}
} else {
mapResult.put("originResult", "");
mapResult.put("num", "");
}
mapResult.put("order", index + i * 96);
map2.put(a + n, mapResult);
list.add(mapResult);
}
mapList.add(map2);
}
map1.put("g" + (i + 1), mapList);
}
}
// 小反刍兽疫病毒阻断ELISA抗体检测试剂盒---青岛立见生物科技有限公司
else if ("1570666183341043714".equals(reagentId)) {
for (int i = 0; i < group; i++) {
@ -2153,29 +2250,44 @@ public class ExamineResultController extends BladeController {
}
Map<String, Object> mapResult = new HashMap<>();
Map<String, Object> mapResult1 = new HashMap<>();
int index = (n - 1) * 8 + j + 1; //n是列,j是行 ,我们定义index是一列列的定义
double v1 = 0;
double v2 = 0;
if (StringUtil.isNoneBlank(code1) && StringUtil.isNoneBlank(code2) && StringUtil.isNoneBlank(code3)) {
if (j > 1 || n > 3) {
v1 = Double.parseDouble(code1) - Double.parseDouble(code3);
v2 = Double.parseDouble(code1) - Double.parseDouble(code2);
mapResult.put("originResult", code);
mapResult1.put("originResult", code);
mapResult.put("value", code);
mapResult1.put("value",df.format(v1) + "," + df.format(v2));
int indexNum = (i * 32) + (num * 8 + j) - ((i + 1) * 2);
mapResult.put("num", split[indexNum]);
if (Double.parseDouble(code1) - Double.parseDouble(code3) >= 0.2 && Double.parseDouble(code1) - Double.parseDouble(code2) >= 0.2) {
mapResult1.put("num", split[indexNum]);
if (v1 >= 0.2 && v2 >= 0.2) {
mapResult.put("result", "阳性");
mapResult1.put("result", "阳性");
} else {
mapResult.put("result", "阴性");
mapResult1.put("result", "阴性");
}
} else {
mapResult.put("originResult", code);
mapResult1.put("originResult", code);
mapResult.put("num", "");
mapResult1.put("num", "");
}
} else {
mapResult.put("originResult", "");
mapResult1.put("originResult", "");
mapResult.put("num", "");
mapResult1.put("num", "");
}
mapResult.put("order", index + i * 96);
mapResult1.put("order", index + i * 96);
map2.put(a + n, mapResult);
list.add(mapResult);
list.add(mapResult1);
}
mapList.add(map2);
}

@ -87,6 +87,7 @@ public class InstrumentController extends BladeController {
@GetMapping("/getAll")
public R getAll() {
LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Instrument::getType, "1");
wrapper.orderByDesc(Instrument::getCreateTime);
List<Instrument> list = iInstrumentService.list(wrapper);
return R.data(list);

@ -53,9 +53,14 @@ public class LargeScreenController extends BladeController {
String str = year + "-01-01 00:00:00";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date parse = sdf.parse(str);
List<String> list = new ArrayList<>();
list.add("7");
list.add("8");
// 本年度委托单完成数量
LambdaQueryWrapper<Entrust> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
// wrapper.eq(Entrust::getEntrustStatus, "7");
wrapper.ge(Entrust::getCreateTime, parse);
int count = entrtrustService.count(wrapper);
// 年度计划数量
@ -70,7 +75,7 @@ public class LargeScreenController extends BladeController {
}
// 委托
wrapper.clear();
wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.ge(Entrust::getCreateTime, parse);
wrapper.eq(Entrust::getInvestigativeType, "1");
int wt = entrtrustService.count(wrapper);
@ -82,7 +87,7 @@ public class LargeScreenController extends BladeController {
}
// 监督
wrapper.clear();
wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.ge(Entrust::getCreateTime, parse);
wrapper.eq(Entrust::getInvestigativeType, "2");
int jd = entrtrustService.count(wrapper);
@ -94,7 +99,7 @@ public class LargeScreenController extends BladeController {
}
// 仲裁
wrapper.clear();
wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.ge(Entrust::getCreateTime, parse);
wrapper.eq(Entrust::getInvestigativeType, "3");
int zc = entrtrustService.count(wrapper);
@ -106,7 +111,7 @@ public class LargeScreenController extends BladeController {
}
// 门诊
wrapper.clear();
wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.ge(Entrust::getCreateTime, parse);
wrapper.eq(Entrust::getInvestigativeType, "4");
int mz = entrtrustService.count(wrapper);
@ -133,7 +138,9 @@ public class LargeScreenController extends BladeController {
@GetMapping("/entrustMonth")
public R<Map<String, Object>> entrustMonth() throws ParseException {
Map<String, Object> map = new HashMap<>();
List<String> list = new ArrayList<>();
list.add("7");
list.add("8");
//设置日期格式
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -161,7 +168,8 @@ public class LargeScreenController extends BladeController {
// 本周的数量
LambdaQueryWrapper<Entrust> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Entrust::getEntrustStatus, 6);
// wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.between(Entrust::getCreateTime, parse1, parse2);
int currWeekEntrustCount = entrtrustService.count(wrapper);
DecimalFormat df1 = new DecimalFormat("#0.00");
@ -169,7 +177,8 @@ public class LargeScreenController extends BladeController {
// 上周的数量
wrapper.clear();
wrapper.eq(Entrust::getEntrustStatus, 6);
// wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.between(Entrust::getCreateTime, parse3, parse4);
int lastWeekEntrustCount = entrtrustService.count(wrapper);
double a2 = Double.parseDouble(df1.format(lastWeekEntrustCount));
@ -197,7 +206,8 @@ public class LargeScreenController extends BladeController {
Date tempParse2 = df2.parse(df.format(cld.getTime()) + " 23:59:59");
// 本周数量
wrapper.clear();
wrapper.eq(Entrust::getEntrustStatus, 6);
// wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
wrapper.between(Entrust::getCreateTime, tempParse1, tempParse2);
int count = entrtrustService.count(wrapper);
month.add(Integer.valueOf(getzs));
@ -234,6 +244,9 @@ public class LargeScreenController extends BladeController {
*/
@GetMapping("/entrustDay")
public R<Map<String, Object>> entrustDay() throws ParseException {
List<String> list = new ArrayList<>();
list.add("7");
list.add("8");
Map<String, Object> map = new HashMap<>();
//获取今年第一天
LocalDateTime dateTime = LocalDateTime.now();
@ -252,12 +265,15 @@ public class LargeScreenController extends BladeController {
int count = entrtrustService.count(wrapper);
wrapper.clear();
// 今日进行中
// wrapper.between(Entrust::getCreateTime, parse1, parse2);
wrapper.ne(Entrust::getEntrustStatus, 6);
wrapper.between(Entrust::getUpdateTime, parse1, parse2);
// wrapper.ne(Entrust::getEntrustStatus, 6);
wrapper.notIn(Entrust::getEntrustStatus, list);
int count1 = entrtrustService.count(wrapper);
wrapper.clear();
// 今日完成
wrapper.between(Entrust::getUpdateTime, parse1, parse2);
wrapper.eq(Entrust::getEntrustStatus, 6);
// wrapper.eq(Entrust::getEntrustStatus, 6);
wrapper.in(Entrust::getEntrustStatus, list);
int count2 = entrtrustService.count(wrapper);
map.put("count", count);
map.put("jxz", count1);
@ -281,7 +297,7 @@ public class LargeScreenController extends BladeController {
// 科室一今年已完成的检测
wrapper.eq(Examine::getDeptId, "1536303217085018114");
wrapper.eq(Examine::getIsFinished, "1");
wrapper.ge(Examine::getFinishTime, parse);
wrapper.ge(Examine::getCreateTime, parse);
List<Examine> examineList1 = examineService.list(wrapper);
int wt1 = 0;
int jd1 = 0;
@ -308,7 +324,7 @@ public class LargeScreenController extends BladeController {
wrapper.clear();
wrapper.eq(Examine::getDeptId, "1536303261238456322");
wrapper.eq(Examine::getIsFinished, "1");
wrapper.ge(Examine::getFinishTime, parse);
wrapper.ge(Examine::getCreateTime, parse);
List<Examine> examineList2 = examineService.list(wrapper);
int wt2 = 0;
int jd2 = 0;
@ -335,7 +351,7 @@ public class LargeScreenController extends BladeController {
wrapper.clear();
wrapper.eq(Examine::getDeptId, "1536303317815422978");
wrapper.eq(Examine::getIsFinished, "1");
wrapper.ge(Examine::getFinishTime, parse);
wrapper.ge(Examine::getCreateTime, parse);
List<Examine> examineList3 = examineService.list(wrapper);
int wt3 = 0;
int jd3 = 0;

@ -114,14 +114,18 @@ public class TaskBlueprintController extends BladeController {
String qz = "";
String[] split = experieNum.split("-");
for (int i = 0; i < split.length - 1; i++) {
qz += split[i] + "-";
if (i == split.length - 2) {
qz += split[i];
} else {
qz += split[i] + "-";
}
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// 条形码下需要打印的文字内容: 检测编号,样品名称,样品数量,送样时间,科室
String s = qz + " " + name + " " + simpleList.size() + " " + dateFormat.format(new Date());
String s = qz + " " + name + " " + simpleList.size() + " " + dateFormat.format(new Date());
//设置条形码表尾信息
BufferedImage image = insertWords(getBarCode(s), s);
BufferedImage image = insertWords(getBarCode(qz), s);
String pathpicture = path + format + "-(" + name + ").png";
list.add(pathpicture);

@ -94,82 +94,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Autowired
private IContractSampleService contractSampleService;
// @Value("${handleUrl}")
// private String handleUrl;
//
// @Value("${print1}")
// private String print1;
//
// @Value("${print2}")
// private String print2;
//
// @Value("${print3}")
// private String print3;
//
// @Value("${print4}")
// private String print4;
//
// @Value("${print5}")
// private String print5;
//
// @Value("${print6}")
// private String print6;
//
// @Value("${print7}")
// private String print7;
//
// @Value("${print8}")
// private String print8;
//
// @Value("${print9}")
// private String print9;
//
// @Value("${print10}")
// private String print10;
//
// @Value("${reportPrint}")
// private String reportPrint;
//
// @Value("${examineReportPrint}")
// private String examineReportPrint;
//
// @Value("${BLSreportPrint}")
// private String BLSreportPrint;
//
// @Value("${PCRreportPrint}")
// private String PCRreportPrint;
//
// @Value("${XNreportPrint}")
// private String XNreportPrint;
//
// @Value("${LDanreportPrint}")
// private String LDanreportPrint;
//
// @Value("${LDuoreportPrint}")
// private String LDuoreportPrint;
//
// @Value("${simpleRegisterPrint}")
// private String simpleRegisterPrint;
//
// @Value("${simpleNumberPrint}")
// private String simpleNumberPrint;
//
// @Value("${eTaskPrint}")
// private String eTaskPrint;
//
// @Value("${simpleHandlePrint}")
// private String simpleHandlePrint;
//
// @Value("${simpleReceivePrint}")
// private String simpleReceivePrint;
//
// @Value("${repairPrint}")
// private String repairPrint;
// @Value("${imagePrint}")
// private String imagePrint;
@Override
@Transactional(rollbackFor = Exception.class)
public Entrust addEntrust(Entrust entrust) {
@ -461,7 +385,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
ExamineResult examineResult = getExamineResultByExamineId(examine.getId());
// 布鲁氏检测
if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode())) {
if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) {
List<ExamineTemplate2Excel> list = JSON.parseArray(examineResult.getExamineDataArr(), ExamineTemplate2Excel.class);
if (list != null && list.size() > 0) {
for (int i1 = 0; i1 < list.size(); i1++) {
@ -1392,7 +1316,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
// 如果是布鲁氏检测 (列排单+式和列排多+式)
if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode())) {
if ("2".equals(examineWay.getInputMode()) || "6".equals(examineWay.getInputMode()) || "7".equals(examineWay.getInputMode())) {
if ("2".equals(examineWay.getInputMode())) {
result.put("18", "平板凝集");
} else {
@ -2636,6 +2560,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
|| "1570297916894146562".equals(examineResult.getReagentId())
|| "1570667729797705730".equals(examineResult.getReagentId())
|| "1570671477110534145".equals(examineResult.getReagentId())
|| "1589877000410296322".equals(examineResult.getReagentId())
|| "1582988982068027393".equals(examineResult.getReagentId())) {
result.put("18", "S/P");
} else if ("1580815808211578882".equals(examineResult.getReagentId())) {
@ -2653,6 +2578,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
|| "1570666622551781378".equals(examineResult.getReagentId())
|| "1570667398619656194".equals(examineResult.getReagentId())) {
result.put("18", "S/N");
} else if ("1570297053211455490".equals(examineResult.getReagentId())) {
result.put("18", "牛PPD-PBS");
result.put("19", "牛PPD-禽PPD");
} else {
result.put("18", "样品OD");
}
@ -2724,79 +2652,145 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// list1.add(dataArrVO1);
// list1.add(dataArrVO2);
if (list1.size() > 0) {
Map<String, List<ExamineDataArrVO>> resultMap = new HashMap<>();
int count = 0;
List<ExamineDataArrVO> everyGroupData = new ArrayList<>();
for (int j = 0; j < list1.size(); j++) {
if (count == 90 || j == list1.size() - 1) {
int keyCount = (j / 90);
if (j == list1.size() - 1) {
keyCount = keyCount + 1;
everyGroupData.add(list1.get(j));
if ("1570297053211455490".equals(examineResult.getReagentId())) {
// 根据样品编号去重
list1 = list1.stream().collect(Collectors
.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ExamineDataArrVO::getNum))),
ArrayList::new));
// 根据order排序
sortByOrder(list1);
if (list1.size() > 0) {
Map<String, List<ExamineDataArrVO>> resultMap = new HashMap<>();
int count = 0;
List<ExamineDataArrVO> everyGroupData = new ArrayList<>();
for (int j = 0; j < list1.size(); j++) {
if (count == 60 || j == list1.size() - 1) {
int keyCount = (j / 60);
if (j == list1.size() - 1) {
keyCount = keyCount + 1;
everyGroupData.add(list1.get(j));
}
resultMap.put(keyCount + "", everyGroupData);
everyGroupData = new ArrayList<>();
count = 0;
}
resultMap.put(keyCount + "", everyGroupData);
everyGroupData = new ArrayList<>();
count = 0;
everyGroupData.add(list1.get(j));
count++;
}
everyGroupData.add(list1.get(j));
count++;
}
for (int j = 1; j <= resultMap.size(); j++) {
List<ExamineDataArrVO> arrVOList = resultMap.get(String.valueOf(j));
// 使用每一页的数据
if (arrVOList.size() % 3 == 0) {
for (int i = 0; i < arrVOList.size() / 3; i++) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue());
map.put("result1", arrVOList.get(i).getResult());
map.put("num2", arrVOList.get(arrVOList.size() / 3 + i).getNum());
map.put("value2", arrVOList.get(arrVOList.size() / 3 + i).getValue());
map.put("result2", arrVOList.get(arrVOList.size() / 3 + i).getResult());
map.put("num3", arrVOList.get(arrVOList.size() / 3 * 2 + i).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 3 * 2 + i).getValue());
map.put("result3", arrVOList.get(arrVOList.size() / 3 * 2 + i).getResult());
resultList1.add(map);
}
} else {
for (int i = 0; i < arrVOList.size() / 3 + 1; i++) {
if (arrVOList.size() % 3 == 1) {
for (int j = 1; j <= resultMap.size(); j++) {
List<ExamineDataArrVO> arrVOList = resultMap.get(String.valueOf(j));
// 使用每一页的数据
if (arrVOList.size() % 2 == 0) {
for (int i = 0; i < arrVOList.size() / 2; i++) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue());
map.put("value1", arrVOList.get(i).getValue().split(",")[0]);
map.put("value2", arrVOList.get(i).getValue().split(",")[1]);
map.put("result1", arrVOList.get(i).getResult());
if (i < arrVOList.size() / 3) {
map.put("num2", arrVOList.get(arrVOList.size() / 3 + i + 1).getNum());
map.put("value2", arrVOList.get(arrVOList.size() / 3 + i + 1).getValue());
map.put("result2", arrVOList.get(arrVOList.size() / 3 + i + 1).getResult());
map.put("num3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 1).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 1).getValue());
map.put("result3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 1).getResult());
map.put("num2", arrVOList.get(arrVOList.size() / 2 + i).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 2 + i).getValue().split(",")[0]);
map.put("value4", arrVOList.get(arrVOList.size() / 2 + i).getValue().split(",")[1]);
map.put("result2", arrVOList.get(arrVOList.size() / 2 + i).getResult());
resultList1.add(map);
}
} else {
for (int i = 0; i < arrVOList.size() / 2 + 1; i++) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue().split(",")[0]);
map.put("value2", arrVOList.get(i).getValue().split(",")[1]);
map.put("result1", arrVOList.get(i).getResult());
if (i < arrVOList.size() / 2) {
map.put("num2", arrVOList.get(arrVOList.size() / 2 + i + 1).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 2 + i + 1).getValue().split(",")[0]);
map.put("value4", arrVOList.get(arrVOList.size() / 2 + i + 1).getValue().split(",")[1]);
map.put("result2", arrVOList.get(arrVOList.size() / 2 + i + 1).getResult());
}
resultList1.add(map);
} else if (arrVOList.size() % 3 == 2) {
}
}
}
result.put("list1", resultList1);
}
}
else {
if (list1.size() > 0) {
Map<String, List<ExamineDataArrVO>> resultMap = new HashMap<>();
int count = 0;
List<ExamineDataArrVO> everyGroupData = new ArrayList<>();
for (int j = 0; j < list1.size(); j++) {
if (count == 90 || j == list1.size() - 1) {
int keyCount = (j / 90);
if (j == list1.size() - 1) {
keyCount = keyCount + 1;
everyGroupData.add(list1.get(j));
}
resultMap.put(keyCount + "", everyGroupData);
everyGroupData = new ArrayList<>();
count = 0;
}
everyGroupData.add(list1.get(j));
count++;
}
for (int j = 1; j <= resultMap.size(); j++) {
List<ExamineDataArrVO> arrVOList = resultMap.get(String.valueOf(j));
// 使用每一页的数据
if (arrVOList.size() % 3 == 0) {
for (int i = 0; i < arrVOList.size() / 3; i++) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue());
map.put("result1", arrVOList.get(i).getResult());
map.put("num2", arrVOList.get(arrVOList.size() / 3 + i + 1).getNum());
map.put("value2", arrVOList.get(arrVOList.size() / 3 + i + 1).getValue());
map.put("result2", arrVOList.get(arrVOList.size() / 3 + i + 1).getResult());
if (i < arrVOList.size() / 3) {
map.put("num3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 2).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 2).getValue());
map.put("result3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 2).getResult());
}
map.put("num2", arrVOList.get(arrVOList.size() / 3 + i).getNum());
map.put("value2", arrVOList.get(arrVOList.size() / 3 + i).getValue());
map.put("result2", arrVOList.get(arrVOList.size() / 3 + i).getResult());
map.put("num3", arrVOList.get(arrVOList.size() / 3 * 2 + i).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 3 * 2 + i).getValue());
map.put("result3", arrVOList.get(arrVOList.size() / 3 * 2 + i).getResult());
resultList1.add(map);
}
} else {
for (int i = 0; i < arrVOList.size() / 3 + 1; i++) {
if (arrVOList.size() % 3 == 1) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue());
map.put("result1", arrVOList.get(i).getResult());
if (i < arrVOList.size() / 3) {
map.put("num2", arrVOList.get(arrVOList.size() / 3 + i + 1).getNum());
map.put("value2", arrVOList.get(arrVOList.size() / 3 + i + 1).getValue());
map.put("result2", arrVOList.get(arrVOList.size() / 3 + i + 1).getResult());
map.put("num3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 1).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 1).getValue());
map.put("result3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 1).getResult());
}
resultList1.add(map);
} else if (arrVOList.size() % 3 == 2) {
Map<String, Object> map = new HashMap<>();
map.put("num1", arrVOList.get(i).getNum());
map.put("value1", arrVOList.get(i).getValue());
map.put("result1", arrVOList.get(i).getResult());
map.put("num2", arrVOList.get(arrVOList.size() / 3 + i + 1).getNum());
map.put("value2", arrVOList.get(arrVOList.size() / 3 + i + 1).getValue());
map.put("result2", arrVOList.get(arrVOList.size() / 3 + i + 1).getResult());
if (i < arrVOList.size() / 3) {
map.put("num3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 2).getNum());
map.put("value3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 2).getValue());
map.put("result3", arrVOList.get(arrVOList.size() / 3 * 2 + i + 2).getResult());
}
resultList1.add(map);
}
}
}
}
result.put("list1", resultList1);
}
result.put("list1", resultList1);
}
// 原始酶标板数据
@ -3063,7 +3057,11 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
result.put("list2", resultList2);
result.put("list3", resultList3);
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "reportPrint");
if ("1570297053211455490".equals(examineResult.getReagentId())) {
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "reportPrint2");
} else {
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "reportPrint");
}
}
}
@ -3129,6 +3127,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
/**
* 获取成立条件
*
* @param list
* @param i
* @param df
@ -3190,6 +3189,15 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map2.put("2", "阳性对照OD平均值");
map2.put("3", format1);
}
// 禽白血病病毒ELISA抗原检测试剂盒(哈尔滨国生生物科技股份有限公司)
else if ("1589877000410296322".equals(reagentId)) {
map1.put("2", "阴性对照OD值");
map1.put("3", a1);
map1.put("4", a2);
map2.put("2", "阳性对照OD值");
map2.put("3", b1);
map2.put("4", b2);
}
// 小反刍兽疫病毒阻断ELISA抗体检测试剂盒---青岛立见生物科技有限公司
else if ("1570666183341043714".equals(reagentId)) {
map1.put("2", "阴性对照血清阻断率");
@ -3280,7 +3288,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map3.put("1", s + "(" + startNum + "-" + endNum + ")");
map3.put("2", "阴性对照平均OD值/阳性对照平均OD值");
map3.put("3", df.format(Double.parseDouble(format) / Double.parseDouble(format1) * 100) + "%");
map3.put("5","成立");
map3.put("5", "成立");
resultList3.add(map3);
}
// 牛布鲁氏菌竞争ELISA抗体检测试剂盒(牛)---洛阳莱普生信息科技有限公司
@ -3571,7 +3579,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
public void eTaskPrint(String id, String deptId, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();
// Entrust entrust = this.getById(id);
Entrust entrust = this.getById(id);
//任务书
LambdaQueryWrapper<TaskBlueprint> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TaskBlueprint::getEntrustId, id);
@ -3692,6 +3700,19 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
resultList.add(map);
}
if (examineList.size() < 6) {
for (int i = 0; i < 6 - examineList.size(); i++) {
Map<String, Object> map = new HashMap<>();
map.put("simpleName","");
map.put("simpleCount","");
map.put("experieNum","");
map.put("examineItemName","");
map.put("examineWayName","");
map.put("examineBasisName","");
resultList.add(map);
}
}
String s = examineList.get(0).getExperieNum().split(",")[0];
result.put("acceptanceNum", getExperieNumPrefix(s));
}
@ -3699,7 +3720,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
//模板地址
// String handleUrl = "C://Users//AAA//Desktop//烁今//打印模板//检测任务书(模板).docx";
String url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "eTaskPrint");
String url;
if (entrust.getEntrustType() == 1) {
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "eTaskPrint");
} else {
url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "eTaskPrintContract");
}
// System.out.println("===============================================");
// System.out.println("url:" + url);
// System.out.println("result:" + result);
@ -4346,9 +4372,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
public void sampleRegister(String id, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> list = new ArrayList<>();
LambdaQueryWrapper<ContractSample> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ContractSample::getEntrustId, id);
List<ContractSample> contractSamples = contractSampleService.list(wrapper);
// 查询符合本委托单条件的所有委托单
Entrust entrust = this.getById(id);
LambdaQueryWrapper<Entrust> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Entrust::getEntrustType, 2);
queryWrapper.eq(Entrust::getSimpleName, entrust.getSimpleName());
queryWrapper.eq(Entrust::getFarmType, entrust.getFarmType());
List<Entrust> entrusts = this.list(queryWrapper);
// 本委托单相关的所有收样登记表数据
List<ContractSample> contractSamples = new ArrayList<>();
if (CollectionUtils.isNotEmpty(entrusts)) {
for (Entrust entrust1 : entrusts) {
LambdaQueryWrapper<ContractSample> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ContractSample::getEntrustId, entrust1.getId());
List<ContractSample> sampleList = contractSampleService.list(wrapper);
contractSamples.addAll(sampleList);
}
}
// 循环收样登记表数据
if (CollectionUtils.isNotEmpty(contractSamples)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
for (ContractSample contractSample : contractSamples) {
@ -4364,7 +4408,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
map.put("9", contractSample.getOriginalNum());
map.put("10", contractSample.getExperimentNum());
map.put("11", contractSample.getSampleReceiverName());
map.put("12", format.format(contractSample.getSampleReceiverTime()));
if (contractSample.getSampleReceiverTime() != null) {
map.put("12", format.format(contractSample.getSampleReceiverTime()));
}
list.add(map);
}
result.put("list", list);
@ -4602,12 +4648,15 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
* 有共同点待抽
*/
private void addIfNull(Entrust entrust) {
Random random = new Random();
// 送检单位
EntrustCustomer byId = customerService.getById(entrust.getEntrustCustomerId());
if (byId != null) {
entrust.setEntrustCustomerName(byId.getName());
} else {
EntrustCustomer customer = new EntrustCustomer();
customer.setId(random.nextLong());
customer.setStatus(1);
customer.setPhone(entrust.getPhone());
customer.setId(RandomUtils.nextLong());
@ -4616,6 +4665,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
customer.setFullName(entrust.getSubmittedBy());
customer.setName(entrust.getEntrustCustomerName());
customerService.save(customer);
entrust.setEntrustCustomerId(customer.getId());
}
// 采样单位
@ -4624,6 +4674,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrust.setTakeCompany(byId1.getName());
} else {
EntrustCustomer customer = new EntrustCustomer();
customer.setId(random.nextLong());
customer.setStatus(2);
customer.setId(RandomUtils.nextLong());
customer.setPhone(entrust.getTakePhone());
@ -4632,6 +4683,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
customer.setFullName(entrust.getTakePerson());
customer.setAddress(entrust.getTakeCompanyAddress());
customerService.save(customer);
entrust.setTakeCompanyId(customer.getId());
}
}

@ -10,7 +10,6 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.lims.entry.*;
import org.springblade.lims.excel.PCR2Excel;
import org.springblade.lims.mapper.ExamineResultMapper;
import org.springblade.lims.service.*;
import org.springblade.resource.enums.SysTypeEnum;
@ -21,7 +20,6 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.spring.web.json.Json;
import java.io.*;
import java.util.*;
@ -363,6 +361,70 @@ public class ExamineResultServiceImpl extends BaseServiceImpl<ExamineResultMappe
entry.setPicturePath("");
}
}
// 如果是禽流感病毒核酸检测且有阳性
if (byId.getExamineItemId() == 1595723686709940226L && entry.getNeedTwice() == 1) {
// 上次检测结果为阳性的数据
String[] split = entry.getPositiveNum().split(",");
String yang = "";
for (int i = 0; i < split.length - 1; i++) {
yang += split[i] + ",";
}
entry.setPositiveNum(yang);
int length = yang.split(",").length;
// H5亚型禽流感病毒核酸
Examine examine = BeanUtil.copy(byId, Examine.class);
examine.setId(null);
examine.setExperieNum(entry.getPositiveNum());
examine.setSimpleCount(length);
examine.setIsFinished("-1");
ExamineItem examineItem = examineItemService.getById(1594586638846377986L);
if (examineItem != null) {
examine.setExamineItemId(examineItem.getId());
String wayAndBasis = examineItem.getWayAndBasis();
List<WayAndBasis> wayAndBaseList = JSON.parseArray(wayAndBasis, WayAndBasis.class);
if (CollectionUtil.isNotEmpty(wayAndBaseList) && wayAndBaseList.get(0) != null) {
WayAndBasis wayAndBasis1 = wayAndBaseList.get(0);
examine.setExamineWayId(Long.valueOf(wayAndBasis1.getExamineWayId()));
examine.setExamineBasisId(Long.valueOf(wayAndBasis1.getExamineBasisId()));
}
}
examineService.save(examine);
// 新增一条记录
SimpleDoExamineLog log = new SimpleDoExamineLog();
log.setExamineId(examine.getId());
log.setBatch(1);
log.setSimpleCount(length);
log.setExperieNum(entry.getPositiveNum());
log.setIsFinished(0);
simpleDoExamineLogService.save(log);
// H7亚型禽流感病毒核酸
Examine examine1 = BeanUtil.copy(byId, Examine.class);
examine1.setId(null);
examine1.setExperieNum(entry.getPositiveNum());
examine1.setSimpleCount(length);
examine1.setIsFinished("-1");
ExamineItem examineItem1 = examineItemService.getById(1585450891962724354L);
if (examineItem1 != null) {
examine1.setExamineItemId(examineItem1.getId());
String wayAndBasis = examineItem1.getWayAndBasis();
List<WayAndBasis> wayAndBaseList = JSON.parseArray(wayAndBasis, WayAndBasis.class);
if (CollectionUtil.isNotEmpty(wayAndBaseList) && wayAndBaseList.get(0) != null) {
WayAndBasis wayAndBasis1 = wayAndBaseList.get(0);
examine1.setExamineWayId(Long.valueOf(wayAndBasis1.getExamineWayId()));
examine1.setExamineBasisId(Long.valueOf(wayAndBasis1.getExamineBasisId()));
}
}
examineService.save(examine1);
// 新增一条记录
SimpleDoExamineLog log1 = new SimpleDoExamineLog();
log1.setExamineId(examine1.getId());
log1.setBatch(1);
log1.setSimpleCount(length);
log1.setExperieNum(entry.getPositiveNum());
log1.setIsFinished(0);
simpleDoExamineLogService.save(log1);
}
return this.updateById(entry);
}
// 提交修改实验结果

@ -51,6 +51,22 @@
<version>2.8.1.RELEASE</version>
<scope>compile</scope>
</dependency>
<!--打印-->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-wps</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>
</dependencies>

@ -1,10 +1,11 @@
package org.springblade.system.user.controller;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -15,8 +16,10 @@ import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.UserClient;
import org.springblade.system.user.service.ITeacherService;
import org.springblade.system.user.service.ITrainService;
import org.springblade.system.user.service.IUserService;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -38,6 +41,9 @@ public class TeacherController extends BladeController {
private final ITrainService trainService;
private final IUserService userService;
/**
* 分页 查看
*/
@ -67,22 +73,24 @@ public class TeacherController extends BladeController {
*/
@PostMapping("/save")
public R save(@RequestBody Teacher teacher) {
User user = userClient.userInfoById(teacher.getTeacherId()).getData();
teacher.setName(user.getName());
teacher.setSex(user.getSex());
teacher.setDeptId(user.getDeptId());
teacher.setDeptName(sysClient.getDeptName(Long.valueOf(user.getDeptId())).getData());
// User user = userClient.userInfoById(teacher.getTeacherId()).getData();
// teacher.setName(user.getName());
// teacher.setSex(user.getSex());
// teacher.setDeptId(user.getDeptId());
// if (StringUtils.isNotBlank(teacher.getDeptId())) {
// teacher.setDeptName(sysClient.getDeptName(Long.valueOf(teacher.getDeptId())).getData());
// }
teacher.setTrainCount(0);
// 讲师相关培训
LambdaQueryWrapper<Train> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Train::getTeacher, teacher.getTeacherId());
wrapper.orderByDesc(Train::getCreateTime);
List<Train> list = trainService.list(wrapper);
if (list != null && list.size() > 0) {
teacher.setRecentTrain(list.get(0).getName());
}
teacher.setEducation(user.getEducation());
teacher.setTel(user.getPhone());
// LambdaQueryWrapper<Train> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(Train::getTeacher, teacher.getTeacherId());
// wrapper.orderByDesc(Train::getCreateTime);
// List<Train> list = trainService.list(wrapper);
// if (list != null && list.size() > 0) {
// teacher.setRecentTrain(list.get(0).getName());
// }
// teacher.setEducation(user.getEducation());
// teacher.setTel(user.getPhone());
teacher.setPraise(0);
return R.status(teacherService.save(teacher));
}
@ -103,4 +111,28 @@ public class TeacherController extends BladeController {
return R.status(teacherService.delete(ids));
}
/**
* 根据姓名模糊搜索人员
*/
@GetMapping("/likeUser")
public R<List<User>> likeUser(String name) {
List<Long> ids = new ArrayList<>();
ids.add(1530823299437965313L);
ids.add(1123598821738675201L);
LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(name)) {
wrapper.like(User::getRealName, name);
}
wrapper.notIn(User::getId, ids);
List<User> users = userService.list(wrapper);
if (CollectionUtils.isNotEmpty(users)) {
for (User user : users) {
if (StringUtils.isNotBlank(user.getDeptId())) {
user.setDeptName(sysClient.getDeptName(Long.valueOf(user.getDeptId())).getData());
}
}
}
return R.data(users);
}
}

@ -3,6 +3,7 @@ package org.springblade.system.user.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
@ -30,12 +31,10 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -55,15 +54,33 @@ public class TrainController extends BladeController {
private final ITrainPersonService trainPersonService;
private final ITrainSpeakService trainSpeakService;
/**
* 详情
*/
@GetMapping("/detail")
public R<Train> detail(Train train) {
Train detail = trainService.getOne(Condition.getQueryWrapper(train));
return R.data(detail);
public R<Map<String, Object>> detail(String id) {
Map<String, Object> map = new HashMap<>();
// 培训计划基础信息
map.put("train", trainService.getById(id));
// 培训计划对应参训人员数据
LambdaQueryWrapper<TrainPerson> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TrainPerson::getTrainId, id);
List<TrainPerson> personList = trainPersonService.list(wrapper);
if (CollectionUtils.isNotEmpty(personList)) {
map.put("personList", personList);
}
// 培训计划对应讲师数据
LambdaQueryWrapper<TrainSpeak> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TrainSpeak::getTrainId, id);
List<TrainSpeak> speakList = trainSpeakService.list(queryWrapper);
if (CollectionUtils.isNotEmpty(speakList)) {
map.put("speakList", speakList);
}
return R.data(map);
}
/**
@ -79,25 +96,47 @@ public class TrainController extends BladeController {
.like(Train::getPlace, train.getName()).or()
.like(Train::getContent, train.getName());
}
wrapper.orderByDesc(Train::getCreateTime);
wrapper.orderByAsc(Train::getStartTime);
IPage<Train> page = trainService.page(Condition.getPage(query), wrapper);
List<Train> trains = page.getRecords();
if (trains != null && trains.size() > 0) {
if (CollectionUtils.isNotEmpty(trains)) {
for (Train train1 : trains) {
if (train1.getStatus() == 0) {
continue;
}
long time = System.currentTimeMillis();
long startTime = train1.getStartTime().getTime();
long endTime = 1000 * 60 * train1.getDuration() + startTime;
long endTime = train1.getEndTime().getTime();
// long endTime = 1000 * 60 * train1.getDuration() + startTime;
if (time >= startTime && time <= endTime) {
train1.setStatus(1);
}
if (time > endTime) {
train1.setStatus(2);
}
if (time > endTime && train1.getStatus() == 2) {
train1.setStatus(3);
}
// 对应讲师
LambdaQueryWrapper<TrainSpeak> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(TrainSpeak::getTrainId, train1.getId());
List<TrainSpeak> speakList = trainSpeakService.list(lambdaQueryWrapper);
StringBuilder speakId = new StringBuilder();
if (CollectionUtils.isNotEmpty(speakList)) {
for (int i = 0; i < speakList.size(); i++) {
if (i < speakList.size() - 1) {
speakId.append(speakList.get(i).getSpeakId()).append(",");
} else {
speakId.append(speakList.get(i).getSpeakId());
}
}
}
train1.setTrainTeacher(speakId.toString());
// 对应参训人员
LambdaQueryWrapper<TrainPerson> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TrainPerson::getTrainId, train1.getId());
List<TrainPerson> personList = trainPersonService.list(queryWrapper);
StringBuilder personId = new StringBuilder();
if (personList != null && personList.size() > 0) {
if (CollectionUtils.isNotEmpty(personList)) {
for (int i = 0; i < personList.size(); i++) {
if (i < personList.size() - 1) {
personId.append(personList.get(i).getPersonId()).append(",");
@ -107,26 +146,26 @@ public class TrainController extends BladeController {
}
}
train1.setTrainPerson(personId.toString());
queryWrapper.clear();
queryWrapper.eq(TrainPerson::getTrainId, train1.getId());
queryWrapper.eq(TrainPerson::getPersonId, AuthUtil.getUserId());
TrainPerson trainPerson = trainPersonService.getOne(queryWrapper);
if (trainPerson != null) {
if (trainPerson.getStatus() == 0) {
train1.setIsJoin(0);
train1.setIsEvaluate(0);
} else {
if (trainPerson.getIsEvaluate() == 0) {
train1.setIsEvaluate(0);
} else {
train1.setIsEvaluate(1);
}
train1.setIsJoin(1);
}
} else {
train1.setIsJoin(0);
train1.setIsEvaluate(0);
}
// queryWrapper.clear();
// queryWrapper.eq(TrainPerson::getTrainId, train1.getId());
// queryWrapper.eq(TrainPerson::getPersonId, AuthUtil.getUserId());
// TrainPerson trainPerson = trainPersonService.getOne(queryWrapper);
// if (trainPerson != null) {
// if (trainPerson.getStatus() == 0) {
// train1.setIsJoin(0);
// train1.setIsEvaluate(0);
// } else {
// if (trainPerson.getIsEvaluate() == 0) {
// train1.setIsEvaluate(0);
// } else {
// train1.setIsEvaluate(1);
// }
// train1.setIsJoin(1);
// }
// } else {
// train1.setIsJoin(0);
// train1.setIsEvaluate(0);
// }
}
trainService.updateBatchById(trains);
}
@ -134,7 +173,7 @@ public class TrainController extends BladeController {
}
/**
* 新增 培训计划表
* 第一次完善 培训计划表
*/
@PostMapping("/save")
public R save(@RequestBody Train train) {
@ -153,7 +192,7 @@ public class TrainController extends BladeController {
* 修改 培训计划表
*/
@PostMapping("/update")
public R update(@RequestBody Train train) {
public R update(@RequestBody Train train) throws Exception {
return R.status(trainService.updateTrain(train));
}
@ -226,5 +265,28 @@ public class TrainController extends BladeController {
return R.success("ok");
}
/**
* 下载人员培训记录表
*/
@GetMapping("/trainUserLog")
public void trainUserLog(String id, HttpServletResponse response){
trainService.trainUserLog(id, response);
}
/**
* 下载培训考勤登记表
*/
@GetMapping("/trainCheck")
public void trainCheck(String id, HttpServletResponse response){
trainService.trainCheck(id, response);
}
/**
* 完善培训计划考核方式培训内容培训有效性评价
*/
@PostMapping("/updateTwo")
public R updateTwo(@RequestBody Train train) {
return R.status(trainService.updateTwo(train));
}
}

@ -1,17 +1,13 @@
package org.springblade.system.user.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.system.user.entity.Train;
import org.springblade.system.user.entity.TrainPerson;
import org.springblade.system.user.service.ITrainPersonService;
import org.springblade.system.user.service.ITrainService;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@ -50,7 +46,6 @@ public class TrainPersonController extends BladeController {
@PostMapping("/update")
public R update(@RequestBody TrainPerson trainPerson) {
trainPerson.setSignInTime(new Date());
return R.status(trainPersonService.updateById(trainPerson));
}

@ -2,8 +2,15 @@ package org.springblade.system.user.controller;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.system.user.entity.Teacher;
import org.springblade.system.user.entity.TrainPerson;
import org.springblade.system.user.entity.TrainSpeak;
import org.springblade.system.user.service.ITeacherService;
import org.springblade.system.user.service.ITrainService;
import org.springblade.system.user.service.ITrainSpeakService;
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;
@ -20,4 +27,22 @@ public class TrainSpeakController extends BladeController {
private final ITrainSpeakService trainSpeakService;
private final ITeacherService teacherService;
private final ITrainService trainService;
@PostMapping("/update")
public R update(@RequestBody TrainSpeak trainSpeak) {
TrainSpeak speak = trainSpeakService.getById(trainSpeak.getId());
Teacher teacher = teacherService.getById(speak.getSpeakId());
// 修改培训次数
teacher.setTrainCount(teacher.getTrainCount() + 1);
// 修改讲师近期培训
teacher.setRecentTrain(trainService.getById(speak.getTrainId()).getName());
teacherService.updateById(teacher);
return R.status(trainSpeakService.updateById(trainSpeak));
}
}

@ -0,0 +1,100 @@
package org.springblade.system.user.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.RandomUtils;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.Train;
import org.springblade.system.user.entity.TrainPerson;
import org.springblade.system.user.entity.TrainYear;
import org.springblade.system.user.service.ITrainService;
import org.springblade.system.user.service.ITrainYearService;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.List;
/**
* 年度培训计划 控制器
* @author litao1
* @since 2022-06-10
*/
@RestController
@RequestMapping("/trainYear")
@AllArgsConstructor
public class TrainYearController extends BladeController {
private final ITrainYearService trainYearService;
private final ITrainService trainService;
/**
* 分页
*/
@GetMapping("/list")
public R<IPage<TrainYear>> list(TrainYear trainYear, Query query) {
LambdaQueryWrapper<TrainYear> wrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(trainYear.getYear())) {
wrapper.like(TrainYear::getYear, trainYear.getYear());
}
wrapper.orderByDesc(TrainYear::getCreateTime);
return R.data(trainYearService.page(Condition.getPage(query), wrapper));
}
/**
* 新增
*/
@PostMapping("/save")
public R<TrainYear> save(@RequestBody TrainYear trainYear) {
long id = RandomUtils.nextLong();
trainYear.setId(id);
trainYear.setCreateTime(new Date());
trainYearService.save(trainYear);
return R.data(trainYear);
}
/**
* 修改
*/
@PostMapping("/update")
public R<TrainYear> update(@RequestBody TrainYear trainYear) {
trainYearService.updateById(trainYear);
return R.data(trainYear);
}
/**
* 三级审批后确认
*/
@PostMapping("/confirm")
public R confirm(@RequestBody TrainYear trainYear) {
List<Train> trains = JSON.parseArray(trainYear.getTrainJson(), Train.class);
if (CollectionUtils.isNotEmpty(trains)) {
for (Train train : trains) {
train.setYearId(trainYear.getId());
train.setStatus(0);
}
}
trainService.saveBatch(trains);
return R.status(trainYearService.updateById(trainYear));
}
/**
* 下载年度人员培训计划表
*/
@GetMapping("/trainYear")
public void trainYear(String id, HttpServletResponse response){
trainYearService.trainYear(id, response);
}
}

@ -25,8 +25,8 @@
</if>
</where>
ORDER BY
A.create_time DESC
ORDER BY
A.create_time DESC
</select>
</mapper>

@ -0,0 +1,14 @@
package org.springblade.system.user.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.system.user.entity.Train;
import org.springblade.system.user.entity.TrainYear;
/**
* 培训计划 Mapper 接口
*
* @author litao
* @since 2022-06-10
*/
public interface TrainYearMapper extends BaseMapper<TrainYear> {
}

@ -4,6 +4,8 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.system.user.entity.Train;
import org.springblade.system.user.vo.TrainVO;
import javax.servlet.http.HttpServletResponse;
/**
* 培训计划服务类
*
@ -13,11 +15,17 @@ import org.springblade.system.user.vo.TrainVO;
public interface ITrainService extends BaseService<Train> {
boolean saveTrain(Train train);
boolean updateTrain(Train train);
boolean updateTrain(Train train) throws Exception;
boolean delete(String ids);
void messageNotice(Train train);
void evaluateSubmit(Train train);
void trainUserLog(String id, HttpServletResponse response);
void trainCheck(String id, HttpServletResponse response);
boolean updateTwo(Train train);
}

@ -0,0 +1,18 @@
package org.springblade.system.user.service;
import org.springblade.core.mp.base.BaseService;
import org.springblade.system.user.entity.Train;
import org.springblade.system.user.entity.TrainYear;
import javax.servlet.http.HttpServletResponse;
/**
* 培训计划服务类
*
* @author litao
* @since 2022-06-10
*/
public interface ITrainYearService extends BaseService<TrainYear> {
void trainYear(String id, HttpServletResponse response);
}

@ -1,14 +1,20 @@
package org.springblade.system.user.service.impl;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.resource.enums.SysTypeEnum;
import org.springblade.resource.feign.IMessageClient;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.enums.DictBizEnum;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.*;
import org.springblade.system.user.feign.IUserClient;
@ -26,11 +32,12 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -58,7 +65,7 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
private final ISysClient sysClient;
@Autowired
private RedisDelayQueueUtil redisDelayQueueUtil;
private RedisDelayQueueUtil redisDelayQueueUtil;
@Autowired
private StringRedisTemplate redisTemplate;
@ -66,29 +73,13 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
@Override
@Transactional(rollbackFor = Exception.class)
public boolean saveTrain(Train train) {
User user1 = userClient.userInfoById(train.getTeacher()).getData();
train.setTeacherName(user1.getName());
String[] split = train.getTrainPerson().split(",");
train.setNum(split.length);
train.setStatus(-1);
this.save(train);
//计算相关时间
//提前通知时间 分钟
Integer remind = Integer.parseInt(train.getRemind());
//会议开始时间
Date startTime = train.getStartTime();
//会议开始时间的毫秒数
long time = startTime.getTime();
//应该开始提醒的毫秒数
long time1 = time - remind * 60 *1000;
//当前时间的毫秒数
Long now = LocalDateTime.now().toInstant(OffsetDateTime.now().getOffset()).toEpochMilli();
// 参训人员入库
if (train.getTrainPerson() != null && !"".equals(train.getTrainPerson())) {
// 参训人员
int a1 = 0;
if (StringUtils.isNotBlank(train.getTrainPerson())) {
String[] split1 = train.getTrainPerson().split(",");
a1 = split1.length;
List<TrainPerson> personList = new ArrayList<>();
for (String s : split) {
for (String s : split1) {
R<User> userR = userClient.userInfoById(Long.parseLong(s));
User user = userR.getData();
TrainPerson trainPerson = new TrainPerson();
@ -101,45 +92,62 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
trainPerson.setDeptName(deptName);
trainPerson.setTel(user.getPhone());
trainPerson.setStatus(0);
trainPerson.setIsEvaluate(0);
trainPerson.setCreateTime(new Date());
personList.add(trainPerson);
messageClient.event(SysTypeEnum.INFORM.getValue(), "培训会议",
"您有新的培训会议待参加,请及时查看详情", 1, 5, s, "/train/project");
}
trainPersonService.saveBatch(personList);
}
// 讲师入库
if (train.getTeacher() != null) {
TrainSpeak trainSpeak = new TrainSpeak();
trainSpeak.setTrainId(train.getId());
trainSpeak.setTrainName(train.getName());
trainSpeak.setSpeakId(train.getTeacher());
trainSpeak.setSpeakName(user1.getName());
trainSpeak.setDeptId(Long.parseLong(user1.getDeptId()));
trainSpeak.setTel(user1.getPhone());
trainSpeak.setStatus(0);
trainSpeak.setCreateTime(new Date());
trainSpeakService.save(trainSpeak);
messageClient.event(SysTypeEnum.INFORM.getValue(), "培训会议",
"您有新的培训会议待参加,请及时查看详情", 1, 5, train.getTeacher().toString(), "/train/project");
// 参训讲师
int a2 = 0;
if (StringUtils.isNotBlank(train.getTrainTeacher())) {
String[] split2 = train.getTrainTeacher().split(",");
a2 = split2.length;
List<TrainSpeak> speakList = new ArrayList<>();
for (String s : split2) {
Teacher teacher = teacherService.getById(s);
// 讲师入库
TrainSpeak trainSpeak = new TrainSpeak();
trainSpeak.setTrainId(train.getId());
trainSpeak.setTrainName(train.getName());
trainSpeak.setSpeakId(teacher.getId());
trainSpeak.setSpeakName(teacher.getName());
trainSpeak.setTel(teacher.getTel());
trainSpeak.setStatus(0);
speakList.add(trainSpeak);
messageClient.event(SysTypeEnum.INFORM.getValue(), "培训会议",
"您有新的培训会议待参加,请及时查看详情", 1, 5, train.getTeacher().toString(), "/train/project");
}
trainSpeakService.saveBatch(speakList);
}
train.setNum(a1 + a2);
//计算相关时间
//提前通知时间 分钟
Integer remind = Integer.parseInt(train.getRemind());
//会议开始时间
Date startTime = train.getStartTime();
//会议开始时间的毫秒数
long time = startTime.getTime();
//应该开始提醒的毫秒数
long time1 = time - remind * 60 * 1000;
//当前时间的毫秒数
Long now = LocalDateTime.now().toInstant(OffsetDateTime.now().getOffset()).toEpochMilli();
// 讲师培训次数
LambdaQueryWrapper<Teacher> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Teacher::getTeacherId, train.getTeacher());
Teacher teacher = teacherService.getOne(wrapper);
Integer count = teacher.getTrainCount();
teacher.setTrainCount(count + 1);
// LambdaQueryWrapper<Teacher> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(Teacher::getTeacherId, train.getTeacher());
// Teacher teacher = teacherService.getOne(wrapper);
// Integer count = teacher.getTrainCount();
// teacher.setTrainCount(count + 1);
// 讲师相关培训
LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Train::getTeacher, teacher.getTeacherId());
queryWrapper.orderByDesc(Train::getCreateTime);
List<Train> list = this.list(queryWrapper);
if (list != null && list.size() > 0) {
teacher.setRecentTrain(list.get(0).getName());
}
// LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(Train::getTeacher, teacher.getTeacherId());
// queryWrapper.orderByDesc(Train::getCreateTime);
// List<Train> list = this.list(queryWrapper);
// if (list != null && list.size() > 0) {
// teacher.setRecentTrain(list.get(0).getName());
// }
//异步执行提前通知参会人员的任务
// ThreadPoolFactory.sheduleThreadPool.schedule(new Runnable() {
@ -152,9 +160,9 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
// }
// },time1 - now, TimeUnit.MILLISECONDS);
//提前通知参会人员和讲师的替代方案
redisDelayQueueUtil.addDelayQueue(train.getId(),time1 - now, TimeUnit.MILLISECONDS, QueueEnum.METTING_REMAIND.getCode());
redisDelayQueueUtil.addDelayQueue(train.getId(), time1 - now, TimeUnit.MILLISECONDS, QueueEnum.METTING_REMAIND.getCode());
//可以通过如下方法自动将到期会议状态设置为2,需要的话放开该注释即可
// redisDelayQueueUtil.addDelayQueue(train.getId(),time - now, TimeUnit.MILLISECONDS, QueueEnum.METTING_END.getCode());
// redisDelayQueueUtil.addDelayQueue(train.getId(),time - now, TimeUnit.MILLISECONDS, QueueEnum.METTING_END.getCode());
//异步执行提前通知讲师的任务
// ThreadPoolFactory.sheduleThreadPool.schedule(new Runnable() {
@ -168,26 +176,29 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
//向redis中加入过期key --培训的id
//redisTemplate.opsForValue().set(train.getId().toString(), train.getId().toString(),time1 - now , TimeUnit.MILLISECONDS);
return teacherService.updateById(teacher);
train.setStatus(1);
return this.updateById(train);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateTrain(Train train) {
String[] split = train.getTrainPerson().split(",");
train.setNum(split.length);
public boolean updateTrain(Train train) throws Exception {
// 删除参训人员记录
LambdaQueryWrapper<TrainPerson> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TrainPerson::getTrainId, train.getId());
trainPersonService.remove(wrapper);
// 删除参训讲师记录
LambdaQueryWrapper<TrainSpeak> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TrainSpeak::getTrainId, train.getId());
trainSpeakService.remove(queryWrapper);
if (train.getTrainPerson() != null && !"".equals(train.getTrainPerson())) {
// 参训人员记录入库
int a1 = 0;
if (StringUtils.isNotBlank(train.getTrainPerson())) {
String[] split1 = train.getTrainPerson().split(",");
a1 = split1.length;
List<TrainPerson> personList = new ArrayList<>();
for (String s : split) {
for (String s : split1) {
R<User> userR = userClient.userInfoById(Long.parseLong(s));
User user = userR.getData();
TrainPerson trainPerson = new TrainPerson();
@ -196,25 +207,101 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
trainPerson.setPersonId(Long.parseLong(s));
trainPerson.setPersonName(user.getName());
trainPerson.setDeptId(Long.parseLong(user.getDeptId()));
String deptName = sysClient.getDeptName(Long.parseLong(user.getDeptId())).getData();
trainPerson.setDeptName(deptName);
trainPerson.setTel(user.getPhone());
trainPerson.setStatus(0);
personList.add(trainPerson);
messageClient.event(SysTypeEnum.INFORM.getValue(), "培训会议",
"您有新的培训会议待参加,请及时查看详情", 1, 5, s, "/train/project");
}
trainPersonService.saveBatch(personList);
}
if (train.getTeacher() != null) {
User user1 = userClient.userInfoById(train.getTeacher()).getData();
train.setTeacherName(user1.getName());
// 讲师入库
TrainSpeak trainSpeak = new TrainSpeak();
trainSpeak.setTrainId(train.getId());
trainSpeak.setTrainName(train.getName());
trainSpeak.setSpeakId(train.getTeacher());
trainSpeak.setSpeakName(user1.getName());
trainSpeak.setDeptId(Long.parseLong(user1.getDeptId()));
trainSpeak.setTel(user1.getPhone());
trainSpeakService.save(trainSpeak);
// 参训讲师记录入库
int a2 = 0;
if (StringUtils.isNotBlank(train.getTrainTeacher())) {
String[] split2 = train.getTrainTeacher().split(",");
a2 = split2.length;
List<TrainSpeak> speakList = new ArrayList<>();
for (String s : split2) {
Teacher teacher = teacherService.getById(s);
// 讲师入库
TrainSpeak trainSpeak = new TrainSpeak();
trainSpeak.setTrainId(train.getId());
trainSpeak.setTrainName(train.getName());
trainSpeak.setSpeakId(teacher.getId());
trainSpeak.setSpeakName(teacher.getName());
trainSpeak.setTel(teacher.getTel());
trainSpeak.setStatus(0);
speakList.add(trainSpeak);
messageClient.event(SysTypeEnum.INFORM.getValue(), "培训会议",
"您有新的培训会议待参加,请及时查看详情", 1, 5, train.getTeacher().toString(), "/train/project");
}
trainSpeakService.saveBatch(speakList);
}
train.setNum(a1 + a2);
// 获取队列消息,如果有则不添加
// if (redisDelayQueueUtil.getDelayQueue(QueueEnum.METTING_REMAIND.getCode()) != null) {
// //计算相关时间
// //提前通知时间 分钟
// Integer remind = Integer.parseInt(train.getRemind());
// //会议开始时间
// Date startTime = train.getStartTime();
// //会议开始时间的毫秒数
// long time = startTime.getTime();
// //应该开始提醒的毫秒数
// long time1 = time - remind * 60 * 1000;
// //当前时间的毫秒数
// Long now = LocalDateTime.now().toInstant(OffsetDateTime.now().getOffset()).toEpochMilli();
//
// // 讲师培训次数
//// LambdaQueryWrapper<Teacher> wrapper = new LambdaQueryWrapper<>();
//// wrapper.eq(Teacher::getTeacherId, train.getTeacher());
//// Teacher teacher = teacherService.getOne(wrapper);
//// Integer count = teacher.getTrainCount();
//// teacher.setTrainCount(count + 1);
// // 讲师相关培训
//// LambdaQueryWrapper<Train> queryWrapper = new LambdaQueryWrapper<>();
//// queryWrapper.eq(Train::getTeacher, teacher.getTeacherId());
//// queryWrapper.orderByDesc(Train::getCreateTime);
//// List<Train> list = this.list(queryWrapper);
//// if (list != null && list.size() > 0) {
//// teacher.setRecentTrain(list.get(0).getName());
//// }
//
// //异步执行提前通知参会人员的任务
//// ThreadPoolFactory.sheduleThreadPool.schedule(new Runnable() {
//// @Override
//// public void run() {
//// for (String s : split) {
//// messageClient.event(SysTypeEnum.INFORM.getValue(), "会议提醒",
//// "您有新的会议将在" + train.getDuration() + "分钟后开始,请准时参加!", 1, 5, s, "/train/project");
//// }
//// }
//// },time1 - now, TimeUnit.MILLISECONDS);
// //提前通知参会人员和讲师的替代方案
// redisDelayQueueUtil.addDelayQueue(train.getId(), time1 - now, TimeUnit.MILLISECONDS, QueueEnum.METTING_REMAIND.getCode());
// //可以通过如下方法自动将到期会议状态设置为2,需要的话放开该注释即可
// // redisDelayQueueUtil.addDelayQueue(train.getId(),time - now, TimeUnit.MILLISECONDS, QueueEnum.METTING_END.getCode());
//
// //异步执行提前通知讲师的任务
//// ThreadPoolFactory.sheduleThreadPool.schedule(new Runnable() {
//// @Override
//// public void run() {
//// messageClient.event(SysTypeEnum.INFORM.getValue(), "会议提醒",
//// "您有新的会议将在" + train.getDuration() + "分钟后开始,请准时参加!", 1, 5, train.getTeacher().toString(), "/train/project");
//// }
//// },time1 - now, TimeUnit.MILLISECONDS);
//
//
// //向redis中加入过期key --培训的id
// //redisTemplate.opsForValue().set(train.getId().toString(), train.getId().toString(),time1 - now , TimeUnit.MILLISECONDS);
// }
// 培训状态未开始
// train.setStatus(1);
return this.updateById(train);
}
@ -269,9 +356,170 @@ public class TrainServiceImpl extends BaseServiceImpl<TrainMapper, Train> implem
queryWrapper.eq(Teacher::getTeacherId, byId.getTeacher());
Teacher teacher = teacherService.getOne(queryWrapper);
Integer praise = teacher.getPraise();
teacher.setPraise(praise + train.getEvaluateScore());
// teacher.setPraise(praise + train.getEvaluateScore());
teacherService.updateById(teacher);
}
}
@Override
public void trainUserLog(String id, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Train train = this.getById(id);
if (train != null) {
LambdaQueryWrapper<TrainSpeak> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TrainSpeak::getTrainId, id);
List<TrainSpeak> speakList = trainSpeakService.list(wrapper);
String speak = "";
if (CollectionUtils.isNotEmpty(speakList)) {
for (int i = 0; i < speakList.size(); i++) {
TrainSpeak trainSpeak = speakList.get(i);
if (i == speakList.size() - 1) {
speak += trainSpeak.getSpeakName();
} else {
speak += trainSpeak.getSpeakName() + ",";
}
}
}
result.put("1", train.getName());
result.put("2", train.getTrainUnit());
result.put("3", train.getTrainMaterial());
result.put("4", speak);
result.put("5", format.format(train.getStartTime()));
result.put("6", train.getPlace());
result.put("7", train.getTrainTarget());
// 考核方式
result.put("8", DictBizCache.getValue(DictBizEnum.ASSESSMENT_METHOD.getName(), train.getAssessmentMethod()));
// 培训主体内容
result.put("9", train.getContentSubject());
// 培训有效性评价
result.put("10", train.getTrainEvaluate());
// result.put("11", train.getRecordName());
// result.put("12", format.format(train.getRecordTime()));
// result.put("13", train.getEvaluateName());
// result.put("14", format.format(train.getEvaluateTime()));
}
String url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "trainUserLog");
XWPFDocument doc = null;
// FileOutputStream fos = null;
try {
doc = WordExportUtil.exportWord07(url, result);
// fos = new FileOutputStream("C://Users//AAA//Desktop//烁今//打印模板//检测任务书.docx");
String filename = "测试.docx";
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment;filename=12344.docx");
doc.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
} finally {
// if (null != doc) {
//// doc.close();
// try {
// doc.write(fos);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (null != fos) {
// try {
// fos.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
if (null != doc) {
try {
doc.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@Override
public void trainCheck(String id, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Train train = this.getById(id);
if (train != null) {
LambdaQueryWrapper<TrainSpeak> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TrainSpeak::getTrainId, id);
List<TrainSpeak> speakList = trainSpeakService.list(wrapper);
String speak = "";
if (CollectionUtils.isNotEmpty(speakList)) {
for (int i = 0; i < speakList.size(); i++) {
TrainSpeak trainSpeak = speakList.get(i);
if (i == speakList.size() - 1) {
speak += trainSpeak.getSpeakName();
} else {
speak += trainSpeak.getSpeakName() + ",";
}
}
}
result.put("1", train.getContent());
result.put("2", speak);
result.put("3", format.format(train.getStartTime()));
}
String url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "trainCheck");
XWPFDocument doc = null;
// FileOutputStream fos = null;
try {
doc = WordExportUtil.exportWord07(url, result);
// fos = new FileOutputStream("C://Users//AAA//Desktop//烁今//打印模板//检测任务书.docx");
String filename = "测试.docx";
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment;filename=12344.docx");
doc.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
} finally {
// if (null != doc) {
//// doc.close();
// try {
// doc.write(fos);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (null != fos) {
// try {
// fos.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
if (null != doc) {
try {
doc.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateTwo(Train train) {
train.setStatus(4);
LambdaQueryWrapper<TrainPerson> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TrainPerson::getTrainId, train.getId());
List<TrainPerson> personList = trainPersonService.list(wrapper);
if (CollectionUtils.isNotEmpty(personList)) {
for (TrainPerson trainPerson : personList) {
if ("1".equals(train.getAssessmentMethod())) {
trainPerson.setIsEvaluate(1);
} else {
trainPerson.setIsEvaluate(0);
}
}
trainPersonService.updateBatchById(personList);
}
return this.updateById(train);
}
}

@ -0,0 +1,110 @@
package org.springblade.system.user.service.impl;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.nacos.common.utils.CollectionUtils;
import lombok.AllArgsConstructor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.enums.DictBizEnum;
import org.springblade.system.user.entity.*;
import org.springblade.system.user.mapper.TrainYearMapper;
import org.springblade.system.user.service.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 培训计划服务实现类
*
* @author litao
* @since 2022-06-10
*/
@Service
@AllArgsConstructor
public class TrainYearServiceImpl extends BaseServiceImpl<TrainYearMapper, TrainYear> implements ITrainYearService {
@Override
public void trainYear(String id, HttpServletResponse response) {
Map<String, Object> result = new HashMap<>();
List<Map<String, Object>> resultList = new ArrayList<>();
TrainYear trainYear = this.getById(id);
result.put("1", trainYear.getYear());
result.put("2", trainYear.getUserStatusAnalysis());
List<Train> trains = JSON.parseArray(trainYear.getTrainJson(), Train.class);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
if (CollectionUtils.isNotEmpty(trains)) {
for (int i = 0; i < trains.size(); i++) {
Map<String, Object> map = new HashMap<>();
Train train = trains.get(i);
map.put("xuhao", i + 1);
map.put("time", format.format(train.getStartTime()));
map.put("content", train.getContent());
map.put("trainTarget", train.getTrainTarget());
map.put("trainDept", train.getTrainDept());
map.put("remark", train.getRemark());
resultList.add(map);
}
int count = 15 - trains.size();
if (count > 0) {
for (int i = 0; i < count; i++) {
Map<String, Object> map = new HashMap<>();
map.put("xuhao", trains.size() + i + 1);
map.put("time", "");
map.put("content", "");
map.put("trainTarget", "");
map.put("trainDept", "");
map.put("remark", "");
resultList.add(map);
}
}
}
result.put("list", resultList);
String url = DictBizCache.getKey(DictBizEnum.PRINT_URL.getName(), "trainYear");
XWPFDocument doc = null;
// FileOutputStream fos = null;
try {
doc = WordExportUtil.exportWord07(url, result);
// fos = new FileOutputStream("C://Users//AAA//Desktop//烁今//打印模板//检测任务书.docx");
String filename = "测试.docx";
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment;filename=12344.docx");
doc.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
} finally {
// if (null != doc) {
//// doc.close();
// try {
// doc.write(fos);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if (null != fos) {
// try {
// fos.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
if (null != doc) {
try {
doc.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}

@ -243,6 +243,10 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
if (user.getShowCap() != null && user.getShowCap() == 0) {
queryWrapper.like(User::getRoleId, "1432876315142520834");
}
List<Long> ids = new ArrayList<>();
ids.add(1530823299437965313L);
ids.add(1123598821738675201L);
queryWrapper.notIn(User::getId, ids);
IPage<User> pages = this.page(Condition.getPage(query), queryWrapper);
return UserWrapper.build().pageVO(pages);
}

Loading…
Cancel
Save