Commit 42bf5575 authored by 王晓倩's avatar 王晓倩

Merge remote-tracking branch 'origin/master'

parents 9ba4f77d d1e3491e
......@@ -27,7 +27,7 @@ target/
/target/
*.class
*.jar
# *.jar
*.log
*.zip
/logs/*
......
EWEPEPEOGMGTELIZJUGECKIUJDBCJTCNISGPBNHLJTJUBHEWGNAKGEGAIOHJDQAJGNCFDRFZJEDMJTIHCSIFAADFBNCKFPIAIYHDDNHPFDJQIJJMGEEJGDJDFOGJCSHDIRJFBGBVDVDJDNFLFWHHJHBKDYDREHBNGCDKJVELFZIZJABAICFCIDFLIYEFJDGCIMEVIHHCEAGMAVHRBTACDPBMCBCZBKHFIHDTAXCMJDICIKGRHZAHFDECHKHVHIEBCTAQATJEESFBFUDCJKIBDRCCAIDSHJDSAZJFCNGKAGHRHBJUAKFUALDJGUFXHVFBAPILFIAOEUGWHNDRHMHNJRFPITGQFSEWACDXCJIXDFIMAVBUGLISCYGOCYJBCFAUCYHAGCGLIPJRAPHUGJHQCSCTHDICBOARCADZCGJRDVAZIZFWFWHDEVFCJQGVHWDVHCIEJNCRDVJCBWEZBPGGHVAZIQHBENCUEQCXHBCFDIGYGZHDCFBGISAYBYAIEFEJETHPABITGCDRHGCAEVIBHPGFCFFSCZCDDKFCDECPHXIBGIHNEZAWEZFCDJEJJIBQEYDRBGDWJQFDGKHWBEBLEKCOIDBHDRAXGJHZJCGQIVHNFICVHLFEBBCMBQCVGLCLGVHZDHJSGUEKAWAYDPCMGDFSDUDLDFGAHNETDTIHENCIFWCHGDGRGQDRAXDPGTHFBEATBGFRBZGTIHGJJTBNEHGMBWGICFCREDIQIKEDBNGTDIDJIPIZBZFDHJCAIVDIATJFHXCYFVCGEVAHHAEVEXDWFLCPHQCRDCDEIIJRFBENAWFJFEHOHCBWEAFKERGSFGFHAVEOFIBODLEWBHDCGMJUIPFOETJTCTDXJGFVCQGJAQDREIEUIRBECCAVIPJGEXALIXFLGDJCEIIZIWAUBPEXBUDEENIMBUBBCOHRIYIMJBAEGQHDCYBKHZJDEUJMCPENIJDVIQELFHIPGDHXBWDDADHZFPFDDTFACVCBIFHYBVCCFLFQJLBWATIIHUDNJMGKDEGCJRHAFTEPGQGLCDCZGNCOEYBBFABMFWCRDFGXCKAMAVCNBJHAIXGEGLERCDDCHDERAGHYJCCBGAJNFVFBGNHQDMHRFJBDEEJOEOBMIVGWDEDMAGECBUICFQHQFAGSELDMJADIEZHFBAFLJUCHGRIAGBDYJLHHGXHSGBIXHJ
\ No newline at end of file
......@@ -66,6 +66,16 @@
<artifactId>artemis-http-client</artifactId>
<version>1.1.3</version>
</dependency>
<!--虹软 -->
<dependency>
<groupId>arcsoft</groupId>
<artifactId>arcsoft-sdk-face</artifactId>
<version>3.0.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/arcsoft_lib/arcsoft-sdk-face-3.0.0.0.jar</systemPath>
</dependency>
</dependencies>
<build>
......@@ -132,6 +142,7 @@
</resources>
</configuration>
</execution>
<execution>
<id>copy-sh</id>
<phase>package</phase>
......@@ -152,6 +163,29 @@
</resources>
</configuration>
</execution>
<execution>
<id>copy-arcsoft-lib</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.build.directory}/danger-manage-${project.version}/arcsoft_lib</outputDirectory>
<resources>
<resource>
<directory>arcsoft_lib</directory>
<excludes>
<exclude>
*.jar
</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-dist-jar</id>
<phase>package</phase>
......
package com.zehong.web.arcface.factory;
import com.arcsoft.face.EngineConfiguration;
import com.arcsoft.face.FaceEngine;
import com.arcsoft.face.enums.ErrorInfo;
import org.apache.commons.pool2.BasePooledObjectFactory;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author geng
* 人脸识别引擎初始化
*/
public class FaceEngineFactory extends BasePooledObjectFactory<FaceEngine> {
private static final Logger logger = LoggerFactory.getLogger(FaceEngineFactory.class);
private String appId;
private String sdkKey;
private String sdkLibPath;
private EngineConfiguration engineConfiguration;
public FaceEngineFactory(String sdkLibPath, String appId, String sdkKey, EngineConfiguration engineConfiguration) {
this.sdkLibPath = sdkLibPath;
this.appId = appId;
this.sdkKey = sdkKey;
this.engineConfiguration = engineConfiguration;
}
@Override
public FaceEngine create() throws Exception {
FaceEngine faceEngine = new FaceEngine(System.getProperty("user.dir") + sdkLibPath);
int activeCode = faceEngine.activeOnline(appId, sdkKey);
logger.info("faceEngineActiveCode:" + activeCode + "==========================");
if (activeCode != ErrorInfo.MOK.getValue() && activeCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
logger.error("引擎激活失败" + activeCode);
throw new Exception("引擎激活失败" + activeCode);
}
int initCode = faceEngine.init(engineConfiguration);
logger.info("faceEngineInitCode:" + initCode + "==========================");
if (initCode != ErrorInfo.MOK.getValue()) {
logger.error("引擎初始化失败" + initCode);
throw new Exception( "引擎初始化失败" + initCode);
}
return faceEngine;
}
@Override
public PooledObject<FaceEngine> wrap(FaceEngine faceEngine) {
return new DefaultPooledObject<>(faceEngine);
}
@Override
public void destroyObject(PooledObject<FaceEngine> p) throws Exception {
FaceEngine faceEngine = p.getObject();
int unInitCode = faceEngine.unInit();
logger.info("faceEngineUnInitCode:" + unInitCode + "==========================");
super.destroyObject(p);
}
}
package com.zehong.web.arcface.util;
import com.arcsoft.face.*;
import com.arcsoft.face.enums.DetectMode;
import com.arcsoft.face.enums.DetectOrient;
import com.arcsoft.face.toolkit.ImageInfo;
import com.zehong.web.arcface.factory.FaceEngineFactory;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author geng
* 人脸比对
*/
@Component
public class FaceEngineUtils {
private static final Logger logger = LoggerFactory.getLogger(FaceEngineUtils.class);
@Value("${config.arcface-sdk.sdk-lib-path}")
public String sdkLibPath;
@Value("${config.arcface-sdk.app-id}")
public String appId;
@Value("${config.arcface-sdk.sdk-key}")
public String sdkKey;
@Value("${config.arcface-sdk.detect-face-max-num}")
public Integer detectFaceMaxNum;
@Value("${config.arcface-sdk.detect-face-scale-val}")
public Integer detectFaceScaleVal;
@Value("${config.arcface-sdk.thread-pool-size}")
public Integer threadPoolSize;
private GenericObjectPool<FaceEngine> faceEngineGeneralPool;
@PostConstruct
public void init() {
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
poolConfig.setMaxIdle(threadPoolSize);
poolConfig.setMaxTotal(threadPoolSize);
poolConfig.setMinIdle(threadPoolSize);
poolConfig.setLifo(false);
//引擎配置
EngineConfiguration engineConfiguration = new EngineConfiguration();
engineConfiguration.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);
engineConfiguration.setDetectFaceOrientPriority(DetectOrient.ASF_OP_0_ONLY);
engineConfiguration.setDetectFaceMaxNum(detectFaceMaxNum);
engineConfiguration.setDetectFaceScaleVal(detectFaceScaleVal);
//功能配置
FunctionConfiguration functionConfiguration = new FunctionConfiguration();
functionConfiguration.setSupportFaceDetect(true);
functionConfiguration.setSupportFaceRecognition(true);
engineConfiguration.setFunctionConfiguration(functionConfiguration);
//底层库算法对象池
faceEngineGeneralPool = new GenericObjectPool(new FaceEngineFactory(sdkLibPath, appId, sdkKey, engineConfiguration), poolConfig);
}
/**
* 人脸识别
* @param imageInfo 人脸信息
* @return List<FaceInfo>
*/
public List<FaceInfo> detectFaces(ImageInfo imageInfo) {
FaceEngine faceEngine = null;
try {
faceEngine = faceEngineGeneralPool.borrowObject();
if (faceEngine == null) {
throw new Exception("获取引擎失败");
}
//人脸检测得到人脸列表
List<FaceInfo> faceInfoList = new ArrayList<>();
//人脸检测
int errorCode = faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
if (errorCode == 0) {
return faceInfoList;
} else {
logger.error("人脸检测失败,errorCode:" + errorCode);
}
} catch (Exception e) {
logger.error("人脸识别系统错误:", e);
} finally {
if (faceEngine != null) {
//释放引擎对象
faceEngineGeneralPool.returnObject(faceEngine);
}
}
return null;
}
/**
* 人脸比对
* @param imageInfo1 待比对图片
* @param imageInfo2 比对图片
* @return Integer
*/
public Integer compareFace(ImageInfo imageInfo1, ImageInfo imageInfo2) throws Exception {
List<FaceInfo> faceInfoList1 = detectFaces(imageInfo1);
List<FaceInfo> faceInfoList2 = detectFaces(imageInfo2);
if (CollectionUtils.isEmpty(faceInfoList1)) {
throw new Exception("照片1未检测到人脸");
}
if (CollectionUtils.isEmpty(faceInfoList2)) {
throw new Exception("照片2未检测到人脸");
}
byte[] feature1 = extractFaceFeature(imageInfo1, faceInfoList1.get(0));
byte[] feature2 = extractFaceFeature(imageInfo2, faceInfoList2.get(0));
FaceEngine faceEngine = null;
try {
faceEngine = faceEngineGeneralPool.borrowObject();
if (faceEngine == null) {
throw new Exception("获取引擎失败");
}
FaceFeature faceFeature1 = new FaceFeature();
faceFeature1.setFeatureData(feature1);
FaceFeature faceFeature2 = new FaceFeature();
faceFeature2.setFeatureData(feature2);
//提取人脸特征
FaceSimilar faceSimilar = new FaceSimilar();
int errorCode = faceEngine.compareFaceFeature(faceFeature1, faceFeature2, faceSimilar);
if (errorCode == 0) {
return plusHundred(faceSimilar.getScore());
} else {
logger.error("特征提取失败,errorCode:" + errorCode);
}
} catch (Exception e) {
logger.error("人脸比对系统错误:", e);
} finally {
if (faceEngine != null) {
//释放引擎对象
faceEngineGeneralPool.returnObject(faceEngine);
}
}
return null;
}
/**
* 人脸特征
* @param imageInfo 图片信息
* @return byte[]
*/
public byte[] extractFaceFeature(ImageInfo imageInfo, FaceInfo faceInfo) {
FaceEngine faceEngine = null;
try {
faceEngine = faceEngineGeneralPool.borrowObject();
if (faceEngine == null) {
throw new Exception("获取引擎失败");
}
FaceFeature faceFeature = new FaceFeature();
//提取人脸特征
int errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfo, faceFeature);
if (errorCode == 0) {
return faceFeature.getFeatureData();
} else {
logger.error("特征提取失败,errorCode:" + errorCode);
}
} catch (Exception e) {
logger.error("人脸特征系统错误:", e);
} finally {
if (faceEngine != null) {
//释放引擎对象
faceEngineGeneralPool.returnObject(faceEngine);
}
}
return null;
}
/**
* 百分比转化
* @param value 相似度
* @return int
*/
private int plusHundred(Float value) {
BigDecimal target = new BigDecimal(value);
BigDecimal hundred = new BigDecimal(100f);
return target.multiply(hundred).intValue();
}
}
package com.zehong.web.controller.arcfacecompare;
import com.arcsoft.face.toolkit.ImageFactory;
import com.arcsoft.face.toolkit.ImageInfo;
import com.zehong.web.arcface.util.FaceEngineUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.Map;
/**
* @author geng
* 人脸识别
*/
@RestController
@RequestMapping("/arcFace")
public class FaceCompareController {
private static final Logger logger = LoggerFactory.getLogger(FaceCompareController.class);
@Autowired
private FaceEngineUtils faceEngineUtil;
/**
* 图片比对
* @param file 待比对图片
* @param compareFile 比对图片
* @return Integer
*/
@PostMapping(value = "/compare")
public Map<String,Object> compare(@RequestParam(value = "file")MultipartFile file, @RequestParam(value = "compareFile")MultipartFile compareFile){
Map<String,Object> result = new HashMap<>(16);
try {
ImageInfo rgbData1 = ImageFactory.getRGBData(file.getBytes());
ImageInfo rgbData2 = ImageFactory.getRGBData(compareFile.getBytes());
result.put("code","0");
result.put("faceSimilar",faceEngineUtil.compareFace(rgbData1,rgbData2));
return result;
} catch (Exception e) {
result.put("code","1");
result.put("msg",e.getMessage());
logger.error("图片比对系统错误:" + e);
return result;
}
}
}
......@@ -47,6 +47,12 @@ public class TContractorPersonController extends BaseController
return getDataTable(list);
}
@GetMapping("/contractALlList")
public AjaxResult contractALlList(TContractorPerson tContractorPerson)
{
return AjaxResult.success(tContractorPersonService.selectTContractorPersonList(tContractorPerson));
}
/**
* 导出承包商人员信息列表
*/
......
package com.zehong.web.controller.system;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TTrainCourseBank;
import com.zehong.system.service.ITTrainCourseBankService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* bankController
*
* @author zehong
* @date 2022-12-14
*/
@RestController
@RequestMapping("/system/bank")
public class TTrainCourseBankController extends BaseController
{
@Autowired
private ITTrainCourseBankService tTrainCourseBankService;
/**
* 查询bank列表
*/
//@PreAuthorize("@ss.hasPermi('system:bank:list')")
@GetMapping("/list")
public TableDataInfo list(TTrainCourseBank tTrainCourseBank)
{
startPage();
List<TTrainCourseBank> list = tTrainCourseBankService.selectTTrainCourseBankList(tTrainCourseBank);
return getDataTable(list);
}
/**
* 导出bank列表
*/
//@PreAuthorize("@ss.hasPermi('system:bank:export')")
@Log(title = "bank", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TTrainCourseBank tTrainCourseBank)
{
List<TTrainCourseBank> list = tTrainCourseBankService.selectTTrainCourseBankList(tTrainCourseBank);
ExcelUtil<TTrainCourseBank> util = new ExcelUtil<TTrainCourseBank>(TTrainCourseBank.class);
return util.exportExcel(list, "bank数据");
}
/**
* 获取bank详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:bank:query')")
@GetMapping(value = "/{bankId}")
public AjaxResult getInfo(@PathVariable("bankId") Long bankId)
{
return AjaxResult.success(tTrainCourseBankService.selectTTrainCourseBankById(bankId));
}
/**
* 新增bank
*/
//@PreAuthorize("@ss.hasPermi('system:bank:add')")
@Log(title = "bank", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TTrainCourseBank tTrainCourseBank)
{
return toAjax(tTrainCourseBankService.insertTTrainCourseBank(tTrainCourseBank));
}
/**
* 修改bank
*/
//@PreAuthorize("@ss.hasPermi('system:bank:edit')")
@Log(title = "bank", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TTrainCourseBank tTrainCourseBank)
{
return toAjax(tTrainCourseBankService.updateTTrainCourseBank(tTrainCourseBank));
}
/**
* 删除bank
*/
//@PreAuthorize("@ss.hasPermi('system:bank:remove')")
@Log(title = "bank", businessType = BusinessType.DELETE)
@DeleteMapping("/{bankIds}")
public AjaxResult remove(@PathVariable Long[] bankIds)
{
return toAjax(tTrainCourseBankService.deleteTTrainCourseBankByIds(bankIds));
}
}
package com.zehong.web.controller.train;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.service.ITTrainCourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.service.ITTrainCourseService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
import java.util.List;
import java.util.Map;
/**
* 培训课程Controller
......@@ -137,4 +137,38 @@ public class TTrainCourseController extends BaseController
tTrainCourse.setIsDel(1);
return toAjax(tTrainCourseService.updateTTrainCourse(tTrainCourse));
}
/**
* 考试发布
* @param tTrainCourse
* @return
*/
@PostMapping(value = "testPublish")
public AjaxResult testPublish(@RequestBody TTrainCourse tTrainCourse){
return toAjax(tTrainCourseService.testPublish(tTrainCourse));
}
/**
* 考试统计接口
* @param statisticsTrainCourse 统计实体
* @return TableDataInfo
*/
@GetMapping(value = "statisticsTrainCourse")
public TableDataInfo statisticsTrainCourse(StatisticsTrainCourse statisticsTrainCourse){
startPage();
List<StatisticsTrainCourse> statisticsTrainCourses = tTrainCourseService.statisticsTrainCourse(statisticsTrainCourse);
return getDataTable(statisticsTrainCourses);
}
/**
* 根据考试查询人员考试详情
* @param courseId 考试id
* @return List<TTrainUserCourse>
*/
@GetMapping(value = "testPersonDetailByCourseId")
public TableDataInfo testPersonDetailByCourseId(@RequestParam(value = "courseId") Long courseId){
startPage();
List<TTrainUserCourse> persons = tTrainCourseService.testPersonDetailByCourseId(courseId);
return getDataTable(persons);
}
}
package com.zehong.web.controller.train;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.zehong.system.domain.vo.PlanVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -87,7 +89,9 @@ public class TTrainPlanController extends BaseController
{
TTrainPlan tTrainPlan = new TTrainPlan();
tTrainPlan.setPlanName(planVo.getPlanName());
return AjaxResult.success(tTrainPlanService.insertTTrainPlan(tTrainPlan,planVo.getPostIds()));
tTrainPlan.setPersonnelType(planVo.getPersonnelType());
List<Map<String,Object>> list = (List<Map<String,Object>>) JSON.parse(planVo.getPeopleList());
return AjaxResult.success(tTrainPlanService.insertTTrainPlan(tTrainPlan,list));
}
/**
......@@ -104,7 +108,9 @@ public class TTrainPlanController extends BaseController
TTrainPlan tTrainPlan = new TTrainPlan();
tTrainPlan.setPlanId(planVo.getPlanId());
tTrainPlan.setPlanName(planVo.getPlanName());
return toAjax(tTrainPlanService.updateTTrainPlan(tTrainPlan,planVo.getPostIds()));
tTrainPlan.setPersonnelType(planVo.getPersonnelType());
List<Map<String,Object>> list = (List<Map<String,Object>>) JSON.parse(planVo.getPeopleList());
return toAjax(tTrainPlanService.updateTTrainPlan(tTrainPlan,list));
}
/**
......
......@@ -73,13 +73,13 @@ spring:
# redis 配置
redis:
# 地址
host: 36.138.181.113
host: 127.0.0.1
# 端口,默认为6379
port: 6379
port: 6378
# 数据库索引
database: 1
# 密码
password: 1qaz2wsx3edc
password: Redis@2021
# 连接超时时间
timeout: 10s
lettuce:
......@@ -110,3 +110,14 @@ zehong:
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
#虹软人脸识别配置(windows配置)
config:
arcface-sdk:
#算法引擎路径 示例(Windows配置\danger-manage-admin\arcsoft_lib\WIN64,Linux配置/arcsoft_lib/LINUX64)
sdk-lib-path: \danger-manage-admin\arcsoft_lib\WIN64
app-id: C8vzXcY8iD7yGFCHweh1QcvJaV684GCPk2oCe4JC1rpZ
sdk-key: C8MFKCRxMAsBSDG5W5cL1x1YirGREoojZvFtBzKv3bAP
detect-face-max-num: 10
detect-face-scale-val: 32
thread-pool-size: 5
\ No newline at end of file
......@@ -21,9 +21,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:33060/danger_manage_area_a?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
password: zehong_/sjz!D
# 从库数据源
slave:
# 从数据源开关/默认关闭
......@@ -73,13 +73,13 @@ spring:
# redis 配置
redis:
# 地址
host: localhost
host: 127.0.0.1
# 端口,默认为6379
port: 6379
port: 6378
# 数据库索引
database: 0
# 密码
password:
password: Redis@2021
# 连接超时时间
timeout: 10s
lettuce:
......@@ -110,3 +110,15 @@ zehong:
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
#虹软人脸识别配置(linux配置)
config:
arcface-sdk:
#算法引擎路径 示例(Windows配置\danger-manage-admin\arcsoft_lib\WIN64,Linux配置/arcsoft_lib/LINUX64)
sdk-lib-path: /arcsoft_lib/LINUX64
app-id: 3ZM3ayaRriUPWzzy29QsqeynFcpmu9zMVXGjBrQ4rPkL
sdk-key: J1wqG4VVGJYLe5YYT2hQN3xHSqLEwrZJBBRQmuEXkZqc
detect-face-max-num: 10
detect-face-scale-val: 32
thread-pool-size: 5
\ No newline at end of file
......@@ -73,13 +73,13 @@ spring:
# redis 配置
redis:
# 地址
host: 36.138.181.113
host: 127.0.0.1
# 端口,默认为6379
port: 6379
port: 6378
# 数据库索引
database: 0
# 密码
password: 1qaz2wsx3edc
password: Redis@2021
# 连接超时时间
timeout: 10s
lettuce:
......
package com.zehong.system.domain;
public class StatisticsTrainCourse {
/**
* 课程id
*/
private Long courseId;
/**
* 课程名称
*/
private String courseName;
/**
* 发布时间
*/
private String releaseTime;
/**
* 考试类型
*/
private String dataKind;
/**
* 应考人数
*/
private String count;
/**
* 参考人数
*/
private String test;
/**
* 通过人数
*/
private String pass;
/**
* 通过率
*/
private String rate;
/**
* 发布开始时间
*/
private String releaseTimeBegin;
/**
* 发布结束时间
*/
private String releaseTimeEnd;
public Long getCourseId() {
return courseId;
}
public void setCourseId(Long courseId) {
this.courseId = courseId;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public String getReleaseTime() {
return releaseTime;
}
public void setReleaseTime(String releaseTime) {
this.releaseTime = releaseTime;
}
public String getDataKind() {
return dataKind;
}
public void setDataKind(String dataKind) {
this.dataKind = dataKind;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public String getReleaseTimeBegin() {
return releaseTimeBegin;
}
public void setReleaseTimeBegin(String releaseTimeBegin) {
this.releaseTimeBegin = releaseTimeBegin;
}
public String getReleaseTimeEnd() {
return releaseTimeEnd;
}
public void setReleaseTimeEnd(String releaseTimeEnd) {
this.releaseTimeEnd = releaseTimeEnd;
}
}
......@@ -61,9 +61,35 @@ public class TEmergencyDrill extends BaseEntity
@Excel(name = "评估")
private String assessment;
/**评价*/
private String evaluate;
/**措施*/
private String measures;
/** 删除 0否 1是 */
private Integer isDel;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getEvaluate() {
return evaluate;
}
public void setEvaluate(String evaluate) {
this.evaluate = evaluate;
}
public String getMeasures() {
return measures;
}
public void setMeasures(String measures) {
this.measures = measures;
}
public void setDrillId(Long drillId)
{
this.drillId = drillId;
......
......@@ -9,7 +9,7 @@ import com.zehong.common.core.domain.BaseEntity;
* 隐患排查库对象 t_hidden_library
*
* @author zehong
* @date 2022-07-13
* @date 2022-12-12
*/
public class THiddenLibrary extends BaseEntity
{
......@@ -18,14 +18,40 @@ public class THiddenLibrary extends BaseEntity
/** $column.columnComment */
private Long libraryId;
/** 部门id */
@Excel(name = "部门id")
private Long deptId;
private String deptName;
/** 风险点 */
@Excel(name = "风险点")
private String riskPoint;
/** 检查项目 */
@Excel(name = "检查项目")
private String inspectTerm;
/** 检查依据 */
@Excel(name = "检查依据")
private String inspectBasis;
/** 排查库标题 */
@Excel(name = "排查库标题")
private String libraryName;
/** 排查库内容 */
@Excel(name = "排查库内容")
/** 内容以及标准 */
@Excel(name = "内容以及标准")
private String libraryContent;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public void setLibraryId(Long libraryId)
{
this.libraryId = libraryId;
......@@ -35,6 +61,42 @@ public class THiddenLibrary extends BaseEntity
{
return libraryId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setRiskPoint(String riskPoint)
{
this.riskPoint = riskPoint;
}
public String getRiskPoint()
{
return riskPoint;
}
public void setInspectTerm(String inspectTerm)
{
this.inspectTerm = inspectTerm;
}
public String getInspectTerm()
{
return inspectTerm;
}
public void setInspectBasis(String inspectBasis)
{
this.inspectBasis = inspectBasis;
}
public String getInspectBasis()
{
return inspectBasis;
}
public void setLibraryName(String libraryName)
{
this.libraryName = libraryName;
......@@ -58,6 +120,10 @@ public class THiddenLibrary extends BaseEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("libraryId", getLibraryId())
.append("deptId", getDeptId())
.append("riskPoint", getRiskPoint())
.append("inspectTerm", getInspectTerm())
.append("inspectBasis", getInspectBasis())
.append("libraryName", getLibraryName())
.append("libraryContent", getLibraryContent())
.toString();
......
......@@ -20,6 +20,9 @@ public class THiddenTroubleAssessment extends BaseEntity
/** $column.columnComment */
private Long assessmentId;
private Long libraryId;
private Integer isXun;
/** 排查任务id */
@Excel(name = "排查任务id")
private Long workId;
......@@ -94,6 +97,59 @@ public class THiddenTroubleAssessment extends BaseEntity
private Integer updateType = 0;
private String riskPoint;
private String inspectTerm;
private String inspectBasis;
private String libraryContent;
public Long getLibraryId() {
return libraryId;
}
public void setLibraryId(Long libraryId) {
this.libraryId = libraryId;
}
public Integer getIsXun() {
return isXun;
}
public void setIsXun(Integer isXun) {
this.isXun = isXun;
}
public String getRiskPoint() {
return riskPoint;
}
public void setRiskPoint(String riskPoint) {
this.riskPoint = riskPoint;
}
public String getInspectTerm() {
return inspectTerm;
}
public void setInspectTerm(String inspectTerm) {
this.inspectTerm = inspectTerm;
}
public String getInspectBasis() {
return inspectBasis;
}
public void setInspectBasis(String inspectBasis) {
this.inspectBasis = inspectBasis;
}
public String getLibraryContent() {
return libraryContent;
}
public void setLibraryContent(String libraryContent) {
this.libraryContent = libraryContent;
}
public Integer getUpdateType() {
return updateType;
}
......
......@@ -75,6 +75,10 @@ public class THiddenTroubleWork extends BaseEntity
@Excel(name = "责任部门")
private String deptName;
private Long staffId;
private String staffName;
/** 任务进展 */
@Excel(name = "任务进展 ")
private Integer workStep;
......@@ -89,6 +93,22 @@ public class THiddenTroubleWork extends BaseEntity
private Integer limits = 0;
public Long getStaffId() {
return staffId;
}
public void setStaffId(Long staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public Integer getLimits() {
return limits;
}
......
......@@ -69,9 +69,24 @@ public class TMaterialInfo extends BaseEntity
@Excel(name = "手机号")
private String phone;
/**责任部门*/
private String deptName;
/** 0未删除 1已删除 */
private Integer isDelete;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public void setId(Long id)
{
this.id = id;
......
package com.zehong.system.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -67,6 +69,26 @@ public class TTrainCourse extends BaseEntity
@Excel(name = "0未删除 1已删除")
private Integer isDel;
/** 数据类型:0 培训,1 考试 */
@Excel(name = "数据类型:0 培训,1 考试")
private String dataKind;
/** 考试开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "考试开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date testStartTime;
/** 考试结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "考试结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date testEndTime;
/** 考试人员 */
@Excel(name = "考试人员")
private String testPersons;
private Integer personnelType;
public String getPlanName() {
return planName;
}
......@@ -75,6 +97,14 @@ public class TTrainCourse extends BaseEntity
this.planName = planName;
}
public Integer getPersonnelType() {
return personnelType;
}
public void setPersonnelType(Integer personnelType) {
this.personnelType = personnelType;
}
public void setCourseId(Long courseId)
{
this.courseId = courseId;
......@@ -183,6 +213,42 @@ public class TTrainCourse extends BaseEntity
{
return isDel;
}
public void setDataKind(String dataKind)
{
this.dataKind = dataKind;
}
public String getDataKind()
{
return dataKind;
}
public void setTestStartTime(Date testStartTime)
{
this.testStartTime = testStartTime;
}
public Date getTestStartTime()
{
return testStartTime;
}
public void setTestEndTime(Date testEndTime)
{
this.testEndTime = testEndTime;
}
public Date getTestEndTime()
{
return testEndTime;
}
public void setTestPersons(String testPersons)
{
this.testPersons = testPersons;
}
public String getTestPersons()
{
return testPersons;
}
@Override
public String toString() {
......@@ -200,6 +266,10 @@ public class TTrainCourse extends BaseEntity
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("isDel", getIsDel())
.append("dataKind", getDataKind())
.append("testStartTime", getTestStartTime())
.append("testEndTime", getTestEndTime())
.append("testPersons", getTestPersons())
.toString();
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* bank对象 t_train_course_bank
*
* @author zehong
* @date 2022-12-14
*/
public class TTrainCourseBank extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long bankId;
/** 所属部门 */
private Long deptId;
/** 题库名称 */
@Excel(name = "题库名称")
private String bankName;
/** 是否删除 0未删除 1删除 */
private Integer isDel;
public void setBankId(Long bankId)
{
this.bankId = bankId;
}
public Long getBankId()
{
return bankId;
}
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setBankName(String bankName)
{
this.bankName = bankName;
}
public String getBankName()
{
return bankName;
}
public void setIsDel(Integer isDel)
{
this.isDel = isDel;
}
public Integer getIsDel()
{
return isDel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("bankId", getBankId())
.append("deptId", getDeptId())
.append("bankName", getBankName())
.append("isDel", getIsDel())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
......@@ -26,6 +26,8 @@ public class TTrainPlan extends BaseEntity
@Excel(name = "计划名称")
private String planName;
private Integer personnelType;
/** 排序 */
@Excel(name = "排序")
private Integer sort;
......@@ -37,6 +39,14 @@ public class TTrainPlan extends BaseEntity
private List<PlanPostVo> postList;
public Integer getPersonnelType() {
return personnelType;
}
public void setPersonnelType(Integer personnelType) {
this.personnelType = personnelType;
}
public List<PlanPostVo> getPostList() {
return postList;
}
......
......@@ -45,6 +45,23 @@ public class TTrainUserCourse extends BaseEntity
@Excel(name = "创建人")
private String createUser;
/**人员名称**/
private String staffName;
/**人员部门**/
private String deptName;
private Integer personnelType;
public Integer getPersonnelType() {
return personnelType;
}
public void setPersonnelType(Integer personnelType) {
this.personnelType = personnelType;
}
public void setUserCourseId(Long userCourseId)
{
this.userCourseId = userCourseId;
......@@ -109,6 +126,22 @@ public class TTrainUserCourse extends BaseEntity
return createUser;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -8,7 +8,9 @@ public class PlanVo {
private String planName;
private Long[] postIds;
private Integer personnelType;
private Long[] postIds;
private String peopleList;
}
......@@ -2,6 +2,7 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.THiddenTroubleAssessment;
import org.apache.ibatis.annotations.Param;
/**
* 排查评估Mapper接口
......@@ -60,4 +61,6 @@ public interface THiddenTroubleAssessmentMapper
* @return 结果
*/
public int deleteTHiddenTroubleAssessmentByIds(Long[] assessmentIds);
public int inserts(@Param("workId")Long workId, @Param("ids")String[] ids);
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TTrainCourseBank;
/**
* bankMapper接口
*
* @author zehong
* @date 2022-12-14
*/
public interface TTrainCourseBankMapper
{
/**
* 查询bank
*
* @param bankId bankID
* @return bank
*/
public TTrainCourseBank selectTTrainCourseBankById(Long bankId);
/**
* 查询bank列表
*
* @param tTrainCourseBank bank
* @return bank集合
*/
public List<TTrainCourseBank> selectTTrainCourseBankList(TTrainCourseBank tTrainCourseBank);
/**
* 新增bank
*
* @param tTrainCourseBank bank
* @return 结果
*/
public int insertTTrainCourseBank(TTrainCourseBank tTrainCourseBank);
/**
* 修改bank
*
* @param tTrainCourseBank bank
* @return 结果
*/
public int updateTTrainCourseBank(TTrainCourseBank tTrainCourseBank);
/**
* 删除bank
*
* @param bankId bankID
* @return 结果
*/
public int deleteTTrainCourseBankById(Long bankId);
/**
* 批量删除bank
*
* @param bankIds 需要删除的数据ID
* @return 结果
*/
public int deleteTTrainCourseBankByIds(Long[] bankIds);
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.vo.UserCourseVo;
import org.apache.ibatis.annotations.Param;
......@@ -67,7 +69,7 @@ public interface TTrainCourseMapper
* @param userIds
* @return
*/
public int insertUserCourse(@Param("courseId") Long courseId,@Param("userIds") List<String> userIds);
public int insertUserCourse(@Param("courseId") Long courseId,@Param("userIds") List<String> userIds,@Param("personnelType")Integer personnelType);
/**
* 用户课程表
......@@ -75,4 +77,11 @@ public interface TTrainCourseMapper
* @return
*/
public List<UserCourseVo> userCourseList(@Param("userId")Long userId,@Param("type") Integer type);
/**
* 考试统计接口
* @param statisticsTrainCourse 统计实体
* @return List<StatisticsTrainCourse>
*/
List<StatisticsTrainCourse> statisticsTrainCourse(StatisticsTrainCourse statisticsTrainCourse);
}
......@@ -52,7 +52,7 @@ public interface TTrainPlanMapper
* @param postIds
* @return
*/
public int insetsPlanPost(@Param("planId") Long planId, @Param("postIds")Long[] postIds);
public int insetsPlanPost(@Param("planId") Long planId, @Param("list")List<Map<String,Object>> list);
/**
* 删除计划职位
......
......@@ -58,4 +58,11 @@ public interface TTrainUserCourseMapper
* @return 结果
*/
public int deleteTTrainUserCourseByIds(Long[] userCourseIds);
/**
* 根据考试查询人员考试详情
* @param courseId 考试id
* @return List<TTrainUserCourse>
*/
List<TTrainUserCourse> testPersonDetailByCourseId(Long courseId);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TTrainCourseBank;
/**
* bankService接口
*
* @author zehong
* @date 2022-12-14
*/
public interface ITTrainCourseBankService
{
/**
* 查询bank
*
* @param bankId bankID
* @return bank
*/
public TTrainCourseBank selectTTrainCourseBankById(Long bankId);
/**
* 查询bank列表
*
* @param tTrainCourseBank bank
* @return bank集合
*/
public List<TTrainCourseBank> selectTTrainCourseBankList(TTrainCourseBank tTrainCourseBank);
/**
* 新增bank
*
* @param tTrainCourseBank bank
* @return 结果
*/
public int insertTTrainCourseBank(TTrainCourseBank tTrainCourseBank);
/**
* 修改bank
*
* @param tTrainCourseBank bank
* @return 结果
*/
public int updateTTrainCourseBank(TTrainCourseBank tTrainCourseBank);
/**
* 批量删除bank
*
* @param bankIds 需要删除的bankID
* @return 结果
*/
public int deleteTTrainCourseBankByIds(Long[] bankIds);
/**
* 删除bank信息
*
* @param bankId bankID
* @return 结果
*/
public int deleteTTrainCourseBankById(Long bankId);
}
......@@ -3,7 +3,9 @@ package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.vo.UserCourseVo;
/**
......@@ -79,5 +81,26 @@ public interface ITTrainCourseService
* 考试
*/
public Map<String,Object> examination(Long userCourseId,String[] answers);
/**
* 考试发布
* @param tTrainCourse 考试实体
* @return int
*/
int testPublish( TTrainCourse tTrainCourse);
/**
* 考试统计接口
* @param statisticsTrainCourse 统计实体
* @return List<StatisticsTrainCourse>
*/
List<StatisticsTrainCourse> statisticsTrainCourse(StatisticsTrainCourse statisticsTrainCourse);
/**
* 根据考试查询人员考试详情
* @param courseId 考试id
* @return List<TTrainUserCourse>
*/
List<TTrainUserCourse> testPersonDetailByCourseId(Long courseId);
}
package com.zehong.system.service;
import java.util.List;
import java.util.Map;
import com.zehong.system.domain.TTrainPlan;
/**
......@@ -34,7 +36,7 @@ public interface ITTrainPlanService
* @param tTrainPlan 培训计划
* @return 结果
*/
public Long insertTTrainPlan(TTrainPlan tTrainPlan,Long[] postIds);
public Long insertTTrainPlan(TTrainPlan tTrainPlan,List<Map<String,Object>> list);
/**
* 修改培训计划
......@@ -42,7 +44,7 @@ public interface ITTrainPlanService
* @param tTrainPlan 培训计划
* @return 结果
*/
public int updateTTrainPlan(TTrainPlan tTrainPlan,Long[] postIds);
public int updateTTrainPlan(TTrainPlan tTrainPlan,List<Map<String,Object>> list);
/**
* 批量删除培训计划
......
......@@ -7,7 +7,9 @@ import java.util.List;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.THiddenTroubleAssessment;
import com.zehong.system.domain.TStaningBook;
import com.zehong.system.mapper.THiddenTroubleAssessmentMapper;
import com.zehong.system.mapper.TStaningBookMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,6 +33,8 @@ public class THiddenTroubleWorkServiceImpl implements ITHiddenTroubleWorkService
private THiddenTroubleWorkMapper tHiddenTroubleWorkMapper;
@Autowired
private TStaningBookMapper tStaningBookMapper;
@Autowired
private THiddenTroubleAssessmentMapper tHiddenTroubleAssessmentMapper;
private static Logger logger = LoggerFactory.getLogger(THiddenTroubleWorkServiceImpl.class);
/**
......@@ -80,22 +84,9 @@ public class THiddenTroubleWorkServiceImpl implements ITHiddenTroubleWorkService
{
tHiddenTroubleWork.setCreateTime(DateUtils.getNowDate());
int a = tHiddenTroubleWorkMapper.insertTHiddenTroubleWork(tHiddenTroubleWork);
if(tHiddenTroubleWork.getBookId()!=null&&(tHiddenTroubleWork.getWorkCycle()==1||tHiddenTroubleWork.getParentId()!=0L)){
TStaningBook book = tStaningBookMapper.selectTStaningBookById(tHiddenTroubleWork.getBookId());
if(book!=null){
if(book.getWorkId()==null){
book.setWorkId(tHiddenTroubleWork.getWorkId());
tStaningBookMapper.updateTStaningBook(book);
}else {
THiddenTroubleWork work = tHiddenTroubleWorkMapper.selectTHiddenTroubleWorkById(book.getWorkId());
if(work==null||work.getWorkStep()==4){
book.setWorkId(tHiddenTroubleWork.getWorkId());
tStaningBookMapper.updateTStaningBook(book);
}else {
return -2;
}
}
}
if(tHiddenTroubleWork.getWorkCycle()==1){
String[] ids = tHiddenTroubleWork.getContent().split(",");
tHiddenTroubleAssessmentMapper.inserts(tHiddenTroubleWork.getWorkId(),ids);
}
return a;
}
......@@ -214,26 +205,28 @@ public class THiddenTroubleWorkServiceImpl implements ITHiddenTroubleWorkService
work.setWorkStep(0);
work.setCreateTime(d);
if(work.getBookId()!=null){
TStaningBook b = tStaningBookMapper.selectTStaningBookById(work.getBookId());
//如果隐患存在,并绑定的任务已完成则生成新新任务,否则不生成
if(b!=null&&b.getWorkId()!=null){
THiddenTroubleWork w = tHiddenTroubleWorkMapper.selectTHiddenTroubleWorkById(b.getWorkId());
if(w.getWorkStep()==4){
int a = tHiddenTroubleWorkMapper.insertTHiddenTroubleWork(work);
b.setWorkId(work.getWorkId());
tStaningBookMapper.updateTStaningBook(b);
}else{
logger.info("===================任务进行中生成新排查任务失败");
}
}else {
int a = tHiddenTroubleWorkMapper.insertTHiddenTroubleWork(work);
if(b!=null){
b.setWorkId(work.getWorkId());
tStaningBookMapper.updateTStaningBook(b);
}
}
// TStaningBook b = tStaningBookMapper.selectTStaningBookById(work.getBookId());
// //如果隐患存在,并绑定的任务已完成则生成新新任务,否则不生成
// if(b!=null&&b.getWorkId()!=null){
// THiddenTroubleWork w = tHiddenTroubleWorkMapper.selectTHiddenTroubleWorkById(b.getWorkId());
// if(w.getWorkStep()==4){
// int a = tHiddenTroubleWorkMapper.insertTHiddenTroubleWork(work);
// b.setWorkId(work.getWorkId());
// tStaningBookMapper.updateTStaningBook(b);
// }else{
// logger.info("===================任务进行中生成新排查任务失败");
// }
// }else {
// int a = tHiddenTroubleWorkMapper.insertTHiddenTroubleWork(work);
// if(b!=null){
// b.setWorkId(work.getWorkId());
// tStaningBookMapper.updateTStaningBook(b);
// }
// }
}else {
tHiddenTroubleWorkMapper.insertTHiddenTroubleWork(work);
String[] ids = work.getContent().split(",");
tHiddenTroubleAssessmentMapper.inserts(work.getWorkId(),ids);
}
}
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TTrainCourseBankMapper;
import com.zehong.system.domain.TTrainCourseBank;
import com.zehong.system.service.ITTrainCourseBankService;
/**
* bankService业务层处理
*
* @author zehong
* @date 2022-12-14
*/
@Service
public class TTrainCourseBankServiceImpl implements ITTrainCourseBankService
{
@Autowired
private TTrainCourseBankMapper tTrainCourseBankMapper;
/**
* 查询bank
*
* @param bankId bankID
* @return bank
*/
@Override
public TTrainCourseBank selectTTrainCourseBankById(Long bankId)
{
return tTrainCourseBankMapper.selectTTrainCourseBankById(bankId);
}
/**
* 查询bank列表
*
* @param tTrainCourseBank bank
* @return bank
*/
@Override
public List<TTrainCourseBank> selectTTrainCourseBankList(TTrainCourseBank tTrainCourseBank)
{
return tTrainCourseBankMapper.selectTTrainCourseBankList(tTrainCourseBank);
}
/**
* 新增bank
*
* @param tTrainCourseBank bank
* @return 结果
*/
@Override
public int insertTTrainCourseBank(TTrainCourseBank tTrainCourseBank)
{
tTrainCourseBank.setCreateTime(DateUtils.getNowDate());
return tTrainCourseBankMapper.insertTTrainCourseBank(tTrainCourseBank);
}
/**
* 修改bank
*
* @param tTrainCourseBank bank
* @return 结果
*/
@Override
public int updateTTrainCourseBank(TTrainCourseBank tTrainCourseBank)
{
tTrainCourseBank.setUpdateTime(DateUtils.getNowDate());
return tTrainCourseBankMapper.updateTTrainCourseBank(tTrainCourseBank);
}
/**
* 批量删除bank
*
* @param bankIds 需要删除的bankID
* @return 结果
*/
@Override
public int deleteTTrainCourseBankByIds(Long[] bankIds)
{
return tTrainCourseBankMapper.deleteTTrainCourseBankByIds(bankIds);
}
/**
* 删除bank信息
*
* @param bankId bankID
* @return 结果
*/
@Override
public int deleteTTrainCourseBankById(Long bankId)
{
return tTrainCourseBankMapper.deleteTTrainCourseBankById(bankId);
}
}
package com.zehong.system.service.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.zehong.common.utils.DateUtils;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.domain.TTrainPlan;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.mapper.TTrainCourseMapper;
import com.zehong.system.mapper.TTrainCourseTopicMapper;
import com.zehong.system.mapper.TTrainPlanMapper;
import com.zehong.system.mapper.TTrainUserCourseMapper;
import com.zehong.system.service.ITTrainCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TTrainCourseMapper;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.service.ITTrainCourseService;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
/**
* 培训课程Service业务层处理
*
......@@ -62,7 +63,7 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
return 0;
}
List<String> userIds = tTrainPlanMapper.selectAlluserByplanId(course.getCourseType());
tTrainCourseMapper.insertUserCourse(courseId,userIds);
tTrainCourseMapper.insertUserCourse(courseId,userIds,course.getPersonnelType());
course.setStatus(1);
course.setReleaseTime(new Date());
return tTrainCourseMapper.updateTTrainCourse(course);
......@@ -88,6 +89,12 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
@Override
public Long insertTTrainCourse(TTrainCourse tTrainCourse)
{
if(tTrainCourse.getCourseType()!=null){
TTrainPlan p = tTrainPlanMapper.selectTTrainPlanById(tTrainCourse.getCourseType());
if(p!=null){
tTrainCourse.setPersonnelType(p.getPersonnelType());
}
}
tTrainCourse.setCreateTime(DateUtils.getNowDate());
tTrainCourseMapper.insertTTrainCourse(tTrainCourse);
return tTrainCourse.getCourseId();
......@@ -173,4 +180,46 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
map.put("topicNum",list.size());
return map;
}
/**
* 考试发布
* @param tTrainCourse 考试实体
* @return int
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int testPublish( TTrainCourse tTrainCourse){
//查询考试人员信息
TTrainCourse course = tTrainCourseMapper.selectTTrainCourseById(tTrainCourse.getCourseId());
if(course==null){
return 0;
}
//新增考试人员
List<JSONObject> personList = JSONObject.parseArray(course.getTestPersons(),JSONObject.class);
List<String> persons = personList.stream().map(item ->(String)item.get("staffId")).collect(Collectors.toList());
tTrainCourseMapper.insertUserCourse(tTrainCourse.getCourseId(),persons,tTrainCourse.getPersonnelType());
tTrainCourse.setStatus(1);
tTrainCourse.setReleaseTime(new Date());
return tTrainCourseMapper.updateTTrainCourse(tTrainCourse);
}
/**
* 考试统计接口
* @param statisticsTrainCourse 统计实体
* @return List<StatisticsTrainCourse>
*/
@Override
public List<StatisticsTrainCourse> statisticsTrainCourse(StatisticsTrainCourse statisticsTrainCourse){
return tTrainCourseMapper.statisticsTrainCourse(statisticsTrainCourse);
}
/**
* 根据考试查询人员考试详情
* @param courseId 考试id
* @return List<TTrainUserCourse>
*/
@Override
public List<TTrainUserCourse> testPersonDetailByCourseId(Long courseId){
return tTrainUserCourseMapper.testPersonDetailByCourseId(courseId);
}
}
......@@ -64,11 +64,11 @@ public class TTrainPlanServiceImpl implements ITTrainPlanService
*/
@Override
@Transactional
public Long insertTTrainPlan(TTrainPlan tTrainPlan,Long[] postIds)
public Long insertTTrainPlan(TTrainPlan tTrainPlan,List<Map<String,Object>> list)
{
tTrainPlan.setCreateTime(DateUtils.getNowDate());
int a = tTrainPlanMapper.insertTTrainPlan(tTrainPlan);
tTrainPlanMapper.insetsPlanPost(tTrainPlan.getPlanId(),postIds);
tTrainPlanMapper.insetsPlanPost(tTrainPlan.getPlanId(),list);
return tTrainPlan.getPlanId();
}
......@@ -80,11 +80,11 @@ public class TTrainPlanServiceImpl implements ITTrainPlanService
*/
@Override
@Transactional
public int updateTTrainPlan(TTrainPlan tTrainPlan,Long[] postIds)
public int updateTTrainPlan(TTrainPlan tTrainPlan,List<Map<String,Object>> list)
{
int a = tTrainPlanMapper.updateTTrainPlan(tTrainPlan);
tTrainPlanMapper.deletePlanPost(tTrainPlan.getPlanId());
tTrainPlanMapper.insetsPlanPost(tTrainPlan.getPlanId(),postIds);
tTrainPlanMapper.insetsPlanPost(tTrainPlan.getPlanId(),list);
return a;
}
......
......@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTEmergencyDrillVo">
select drill_id, drill_name, drill_address, drill_unit, drill_time, drill_type, drill_form, drill_objective, drill_people, drill_content, assessment, create_time, create_by, is_del from t_emergency_drill
select drill_id, drill_name, drill_address, drill_unit, drill_time, drill_type, drill_form, drill_objective, drill_people, drill_content, assessment, evaluate,measures,create_time, create_by, is_del from t_emergency_drill
</sql>
<select id="selectTEmergencyDrillList" parameterType="TEmergencyDrill" resultMap="TEmergencyDrillResult">
......@@ -89,6 +89,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="assessment != null">assessment = #{assessment},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="evaluate != null">evaluate = #{evaluate},</if>
<if test="measures != null">measures = #{measures},</if>
<if test="isDel != null">is_del = #{isDel},</if>
</trim>
where drill_id = #{drillId}
......
......@@ -6,18 +6,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="THiddenLibrary" id="THiddenLibraryResult">
<result property="libraryId" column="library_id" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="riskPoint" column="risk_point" />
<result property="inspectTerm" column="inspect_term" />
<result property="inspectBasis" column="inspect_basis" />
<result property="libraryName" column="library_name" />
<result property="libraryContent" column="library_content" />
</resultMap>
<sql id="selectTHiddenLibraryVo">
select library_id, library_name, library_content from t_hidden_library
SELECT h.library_id, h.dept_id, h.risk_point, h.inspect_term, h.inspect_basis, h.library_name, h.library_content ,
d.`dept_name`
FROM t_hidden_library h LEFT JOIN sys_dept d ON d.dept_id = h.dept_id
</sql>
<select id="selectTHiddenLibraryList" parameterType="THiddenLibrary" resultMap="THiddenLibraryResult">
<include refid="selectTHiddenLibraryVo"/>
<where>
<if test="libraryName != null and libraryName != ''"> and library_name like concat('%', #{libraryName}, '%')</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="riskPoint != null and riskPoint != ''"> and risk_point like concat('%', #{riskPoint}, '%')</if>
</where>
</select>
......@@ -29,20 +37,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertTHiddenLibrary" parameterType="THiddenLibrary" useGeneratedKeys="true" keyProperty="libraryId">
insert into t_hidden_library
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="libraryName != null and libraryName != ''">library_name,</if>
<if test="libraryContent != null and libraryContent != ''">library_content,</if>
<if test="deptId != null">dept_id,</if>
<if test="riskPoint != null">risk_point,</if>
<if test="inspectTerm != null">inspect_term,</if>
<if test="inspectBasis != null">inspect_basis,</if>
<if test="libraryName != null">library_name,</if>
<if test="libraryContent != null">library_content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="libraryName != null and libraryName != ''">#{libraryName},</if>
<if test="libraryContent != null and libraryContent != ''">#{libraryContent},</if>
<if test="deptId != null">#{deptId},</if>
<if test="riskPoint != null">#{riskPoint},</if>
<if test="inspectTerm != null">#{inspectTerm},</if>
<if test="inspectBasis != null">#{inspectBasis},</if>
<if test="libraryName != null">#{libraryName},</if>
<if test="libraryContent != null">#{libraryContent},</if>
</trim>
</insert>
<update id="updateTHiddenLibrary" parameterType="THiddenLibrary">
update t_hidden_library
<trim prefix="SET" suffixOverrides=",">
<if test="libraryName != null and libraryName != ''">library_name = #{libraryName},</if>
<if test="libraryContent != null and libraryContent != ''">library_content = #{libraryContent},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="riskPoint != null">risk_point = #{riskPoint},</if>
<if test="inspectTerm != null">inspect_term = #{inspectTerm},</if>
<if test="inspectBasis != null">inspect_basis = #{inspectBasis},</if>
<if test="libraryName != null">library_name = #{libraryName},</if>
<if test="libraryContent != null">library_content = #{libraryContent},</if>
</trim>
where library_id = #{libraryId}
</update>
......
......@@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="THiddenTroubleAssessment" id="THiddenTroubleAssessmentResult">
<result property="assessmentId" column="assessment_id" />
<result property="libraryId" column="library_id" />
<result property="isXun" column="is_xun" />
<result property="workId" column="work_id" />
<result property="checkFeedback" column="check_feedback" />
<result property="checkUrl" column="check_url" />
......@@ -23,6 +25,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="modifyBegin" column="modify_begin" />
<result property="modifyEnd" column="modify_end" />
<result property="modifyComplete" column="modify_complete" />
<result property="riskPoint" column="risk_point" />
<result property="inspectTerm" column="inspect_term" />
<result property="inspectBasis" column="inspect_basis" />
<result property="libraryContent" column="library_content" />
</resultMap>
<sql id="selectTHiddenTroubleAssessmentVo">
......@@ -30,9 +36,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectTHiddenTroubleAssessmentList" parameterType="THiddenTroubleAssessment" resultMap="THiddenTroubleAssessmentResult">
<include refid="selectTHiddenTroubleAssessmentVo"/>
SELECT a.`assessment_id`,a.library_id,a.is_xun,a.check_url,a.check_time,a.check_user,a.check_feedback,
l.risk_point,l.inspect_term,l.inspect_basis,l.library_content
FROM t_hidden_trouble_assessment a LEFT JOIN t_hidden_library l ON l.`library_id` = a.library_id
<where>
<if test="assessmentLevel != null "> and assessment_level = #{assessmentLevel}</if>
<if test="workId != null "> and work_id = #{workId}</if>
</where>
</select>
......@@ -121,4 +130,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{assessmentId}
</foreach>
</delete>
<insert id="inserts" >
insert into t_hidden_trouble_assessment (library_id,work_id) VALUES
<foreach collection="ids" item="item" index="index" separator=",">
(${item},#{workId})
</foreach>
</insert>
</mapper>
\ No newline at end of file
......@@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="workRange" column="work_range" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
<result property="staffId" column="staff_id" />
<result property="staffName" column="staff_name" />
<result property="workStep" column="work_step" />
<result property="content" column="content" />
<result property="createTime" column="create_time" />
......@@ -34,9 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTHiddenTroubleWorkList" parameterType="THiddenTroubleWork" resultMap="THiddenTroubleWorkResult">
SELECT tw.work_id, tw.parent_id, tw.book_id, tw.work_cycle, tw.work_name, tw.work_type, tw.work_form, tw.work_begin_time, tw.work_end_time,tw.finish_time,
tw.time_term, tw.work_range, tw.dept_id, tw.work_step, tw.content, tw.create_time, tw.create_by, tw.is_del,
d.dept_name,b.trouble_name
d.dept_name,b.trouble_name,u.`staff_name`,tw.`staff_id`
FROM t_hidden_trouble_work tw
LEFT JOIN sys_dept d ON d.dept_id = tw.dept_id
LEFT JOIN sys_user u ON u.`user_id` = tw.`staff_id`
LEFT JOIN t_staning_book b ON b.book_id = tw.book_id
<where>
<if test="parentId != null "> and tw.parent_id = #{parentId}</if>
......@@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="timeTerm != null">time_term,</if>
<if test="workRange != null">work_range,</if>
<if test="deptId != null">dept_id,</if>
<if test="staffId != null">staff_id,</if>
<if test="workStep != null">work_step,</if>
<if test="content != null">content,</if>
<if test="createTime != null">create_time,</if>
......@@ -95,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="timeTerm != null">#{timeTerm},</if>
<if test="workRange != null">#{workRange},</if>
<if test="deptId != null">#{deptId},</if>
<if test="staffId != null">#{staffId},</if>
<if test="workStep != null">#{workStep},</if>
<if test="content != null">#{content},</if>
<if test="createTime != null">#{createTime},</if>
......
......@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDelete" column="is_delete" />
<result property="deptName" column="dept_name" />
</resultMap>
<sql id="selectTMaterialInfoVo">
......@@ -28,10 +29,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectTMaterialInfoList" parameterType="TMaterialInfo" resultMap="TMaterialInfoResult">
<include refid="selectTMaterialInfoVo"/>
select d.dept_name,a.id, a.material_name, a.material_type, a.num, a.performance, a.purpose, a.validity_time, a.dept_id, a.longitude, a.latitude, a.address, a.contacts, a.phone, a.create_time, a.update_time, a.is_delete
from t_material_info a
LEFT JOIN sys_dept d ON d.`dept_id` = a.`dept_id`
<where>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null "> and material_type = #{materialType}</if>
<if test="materialName != null and materialName != ''"> and a.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialType != null "> and a.material_type = #{materialType}</if>
</where>
</select>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TTrainCourseBankMapper">
<resultMap type="TTrainCourseBank" id="TTrainCourseBankResult">
<result property="bankId" column="bank_id" />
<result property="deptId" column="dept_id" />
<result property="bankName" column="bank_name" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTTrainCourseBankVo">
select bank_id, dept_id, bank_name, is_del, create_by, create_time, update_by, update_time from t_train_course_bank
</sql>
<select id="selectTTrainCourseBankList" parameterType="TTrainCourseBank" resultMap="TTrainCourseBankResult">
<include refid="selectTTrainCourseBankVo"/>
<where>
<if test="bankName != null and bankName != ''"> and bank_name like concat('%', #{bankName}, '%')</if>
</where>
</select>
<select id="selectTTrainCourseBankById" parameterType="Long" resultMap="TTrainCourseBankResult">
<include refid="selectTTrainCourseBankVo"/>
where bank_id = #{bankId}
</select>
<insert id="insertTTrainCourseBank" parameterType="TTrainCourseBank" useGeneratedKeys="true" keyProperty="bankId">
insert into t_train_course_bank
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="bankName != null">bank_name,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="bankName != null">#{bankName},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTTrainCourseBank" parameterType="TTrainCourseBank">
update t_train_course_bank
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="bankName != null">bank_name = #{bankName},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where bank_id = #{bankId}
</update>
<delete id="deleteTTrainCourseBankById" parameterType="Long">
delete from t_train_course_bank where bank_id = #{bankId}
</delete>
<delete id="deleteTTrainCourseBankByIds" parameterType="String">
delete from t_train_course_bank where bank_id in
<foreach item="bankId" collection="array" open="(" separator="," close=")">
#{bankId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planName" column="plan_name" />
<result property="courseConent" column="course_conent" />
<result property="status" column="status" />
<result property="personnelType" column="personnel_type" />
<result property="releaseTime" column="release_time" />
<result property="enclosure" column="enclosure" />
<result property="video" column="video" />
......@@ -19,10 +20,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="isDel" column="is_del" />
<result property="dataKind" column="data_kind" />
<result property="testStartTime" column="test_start_time" />
<result property="testEndTime" column="test_end_time" />
<result property="testPersons" column="test_persons" />
</resultMap>
<resultMap id="StatisticsTrainCourseResult" type="StatisticsTrainCourse">
<result property="courseId" column="course_id" />
<result property="courseName" column="course_name" />
<result property="releaseTime" column="release_time" />
<result property="dataKind" column="data_kind" />
<result property="count" column="count" />
<result property="test" column="test" />
<result property="pass" column="pass" />
<result property="rate" column="rate" />
</resultMap>
<sql id="selectTTrainCourseVo">
select course_id, course_name, course_type, course_conent, status,release_time, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del from t_train_course
select course_id, course_name, course_type, course_conent, status,personnel_type, release_time, enclosure, video, qualified_num, topic_num, create_time, create_user, is_del, data_kind, test_start_time, test_end_time, test_persons from t_train_course
</sql>
<select id="selectTTrainCourseList" parameterType="TTrainCourse" resultMap="TTrainCourseResult">
......@@ -40,6 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="topicNum != null "> and c.topic_num = #{topicNum}</if>
<if test="createUser != null and createUser != ''"> and c.create_user = #{createUser}</if>
<if test="isDel != null "> and c.is_del = #{isDel}</if>
<if test="dataKind != null and dataKind != ''"> and data_kind = #{dataKind}</if>
<if test="testStartTime != null "> and test_start_time = #{testStartTime}</if>
<if test="testEndTime != null "> and test_end_time = #{testEndTime}</if>
<if test="testPersons != null and testPersons != ''"> and test_persons = #{testPersons}</if>
</where>
</select>
......@@ -55,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="courseType != null">course_type,</if>
<if test="courseConent != null">course_conent,</if>
<if test="status != null">status,</if>
<if test="personnelType != null">personnel_type,</if>
<if test="releaseTime != null">release_time,</if>
<if test="enclosure != null">enclosure,</if>
<if test="video != null">video,</if>
......@@ -63,12 +84,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if>
<if test="isDel != null">is_del,</if>
<if test="dataKind != null">data_kind,</if>
<if test="testStartTime != null">test_start_time,</if>
<if test="testEndTime != null">test_end_time,</if>
<if test="testPersons != null">test_persons,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="courseName != null">#{courseName},</if>
<if test="courseType != null">#{courseType},</if>
<if test="courseConent != null">#{courseConent},</if>
<if test="status != null">#{status},</if>
<if test="personnelType != null">#{personnelType},</if>
<if test="releaseTime != null">#{releaseTime},</if>
<if test="enclosure != null">#{enclosure},</if>
<if test="video != null">#{video},</if>
......@@ -77,6 +103,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if>
<if test="isDel != null">#{isDel},</if>
<if test="dataKind != null">#{dataKind},</if>
<if test="testStartTime != null">#{testStartTime},</if>
<if test="testEndTime != null">#{testEndTime},</if>
<if test="testPersons != null">#{testPersons},</if>
</trim>
</insert>
......@@ -87,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="courseType != null">course_type = #{courseType},</if>
<if test="courseConent != null">course_conent = #{courseConent},</if>
<if test="status != null">status = #{status},</if>
<if test="personnelType != null">personnel_type = #{personnelType},</if>
<if test="releaseTime != null">release_time = #{releaseTime},</if>
<if test="enclosure != null">enclosure = #{enclosure},</if>
<if test="video != null">video = #{video},</if>
......@@ -95,6 +126,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUser != null">create_user = #{createUser},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="dataKind != null">data_kind = #{dataKind},</if>
<if test="testStartTime != null">test_start_time = #{testStartTime},</if>
<if test="testEndTime != null">test_end_time = #{testEndTime},</if>
<if test="testPersons != null">test_persons = #{testPersons},</if>
</trim>
where course_id = #{courseId}
</update>
......@@ -110,9 +145,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<insert id="insertUserCourse">
INSERT INTO t_train_user_course(user_id,course_id,create_time) VALUES
INSERT INTO t_train_user_course(user_id,course_id,personnel_type,create_time) VALUES
<foreach collection="userIds" separator="," item="item">
(#{item},#{courseId},NOW())
(#{item},#{courseId},#{personnelType},NOW())
</foreach>
</insert>
<select id="userCourseList" resultType="com.zehong.system.domain.vo.UserCourseVo">
......@@ -123,7 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM t_train_user_course uc
LEFT JOIN t_train_course c ON c.`course_id` = uc.`course_id`
LEFT JOIN t_train_plan p ON p.`plan_id` = c.`course_type`
WHERE uc.user_id = #{userId}
WHERE uc.user_id = #{userId} and uc.personnel_type =1
<if test="type!=null and type == 1">
and uc.state !=2
</if>
......@@ -135,4 +170,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by uc.examination_time desc
</if>
</select>
<select id="statisticsTrainCourse" parameterType="StatisticsTrainCourse" resultMap="StatisticsTrainCourseResult">
SELECT
course.course_id,
course.course_name,
course.release_time,
course.data_kind,
COUNT(user.user_course_id)AS count,
SUM(case when user.state > 0 then 1 else 0 end)AS test,
SUM(case when user.state = 2 then 1 else 0 end)AS pass,
ROUND(SUM(case when user.state = 2 then 1 else 0 end)/COUNT(user.user_course_id)*100)AS rate
FROM
t_train_course course
INNER JOIN t_train_user_course user ON course.course_id = user.course_id
<where>
course.status = '1' AND course.is_del = '0' AND course.personnel_type = '1'
<if test="courseName != null and courseName != ''"> and course.course_name like concat('%', #{courseName}, '%')</if>
<if test="dataKind != null and dataKind != ''"> and course.data_kind = #{dataKind}</if>
<if test="releaseTimeBegin != null and releaseTimeBegin != '' and releaseTimeEnd != null and releaseTimeEnd != ''"> and course.release_time BETWEEN #{releaseTimeBegin} AND #{releaseTimeEnd}</if>
</where>
GROUP BY course.course_id
</select>
</mapper>
\ No newline at end of file
......@@ -8,12 +8,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planId" column="plan_id" />
<result property="planName" column="plan_name" />
<result property="sort" column="sort" />
<result property="personnelType" column="personnel_type" />
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
</resultMap>
<sql id="selectTTrainPlanVo">
select plan_id, plan_name, sort, create_time, create_user from t_train_plan
select plan_id, plan_name, sort, create_time,personnel_type, create_user from t_train_plan
</sql>
<select id="selectTTrainPlanList" parameterType="TTrainPlan" resultMap="TTrainPlanResult">
......@@ -36,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planId != null">plan_id,</if>
<if test="planName != null">plan_name,</if>
<if test="sort != null">sort,</if>
<if test="personnelType != null">personnel_type,</if>
<if test="createTime != null">create_time,</if>
<if test="createUser != null">create_user,</if>
</trim>
......@@ -43,14 +45,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="planId != null">#{planId},</if>
<if test="planName != null">#{planName},</if>
<if test="sort != null">#{sort},</if>
<if test="personnelType != null">#{personnelType},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createUser != null">#{createUser},</if>
</trim>
</insert>
<insert id="insetsPlanPost">
INSERT INTO t_train_plan_post(plan_id,post_id) VALUES
<foreach collection="postIds" separator="," item="item">
(#{planId},#{item})
<foreach collection="list" separator="," item="item">
(#{planId},#{item.staffId})
</foreach>
</insert>
......@@ -62,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="planName != null">plan_name = #{planName},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="personnelType != null">personnel_type = #{personnelType},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createUser != null">create_user = #{createUser},</if>
</trim>
......@@ -80,12 +84,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectTrainPostByPlanId" parameterType="Long" resultType="com.zehong.system.domain.vo.PlanPostVo">
SELECT p.`post_id` as postId,p.`post_name` as postName,IF(pp.`post_id` IS NULL,FALSE,TRUE) AS ischeck FROM sys_post p
LEFT JOIN t_train_plan_post pp ON ( p.`post_id` = pp.`post_id` AND pp.`plan_id` = #{planId} )
SELECT u.user_id AS postId, u.staff_name AS postName,TRUE AS ischeck FROM
t_train_plan_post p LEFT JOIN sys_user u ON u.`user_id` = p.`post_id`
WHERE p.`plan_id` = #{planId}
</select>
<select id="selectAlluserByplanId" resultType="java.lang.String">
SELECT user_id FROM sys_user_post
WHERE post_id IN (SELECT post_id FROM t_train_plan_post WHERE plan_id =#{planId})
GROUP BY user_id
SELECT post_id FROM t_train_plan_post WHERE plan_id =#{planId}
</select>
</mapper>
\ No newline at end of file
......@@ -9,14 +9,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="userId" column="user_id" />
<result property="courseId" column="course_id" />
<result property="state" column="state" />
<result property="personnelType" column="personnel_type" />
<result property="examinationTime" column="examination_time" />
<result property="examinationResult" column="examination_result" />
<result property="createTime" column="create_time" />
<result property="createUser" column="create_user" />
<result property="staffName" column="staff_name"/>
<result property="deptName" column="dept_name"/>
</resultMap>
<sql id="selectTTrainUserCourseVo">
select user_course_id, user_id, course_id, state, examination_time, examination_result, create_time, create_user from t_train_user_course
select user_course_id, user_id, course_id, state, examination_time, personnel_type,examination_result, create_time, create_user from t_train_user_course
</sql>
<select id="selectTTrainUserCourseList" parameterType="TTrainUserCourse" resultMap="TTrainUserCourseResult">
......@@ -42,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id,</if>
<if test="courseId != null">course_id,</if>
<if test="state != null">state,</if>
<if test="personnelType != null">personnel_type,</if>
<if test="examinationTime != null">examination_time,</if>
<if test="examinationResult != null">examination_result,</if>
<if test="createTime != null">create_time,</if>
......@@ -51,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">#{userId},</if>
<if test="courseId != null">#{courseId},</if>
<if test="state != null">#{state},</if>
<if test="personnelType != null">#{personnelType},</if>
<if test="examinationTime != null">#{examinationTime},</if>
<if test="examinationResult != null">#{examinationResult},</if>
<if test="createTime != null">#{createTime},</if>
......@@ -64,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">user_id = #{userId},</if>
<if test="courseId != null">course_id = #{courseId},</if>
<if test="state != null">state = #{state},</if>
<if test="personnelType != null">personnel_type = #{personnelType},</if>
<if test="examinationTime != null">examination_time = #{examinationTime},</if>
<if test="examinationResult != null">examination_result = #{examinationResult},</if>
<if test="createTime != null">create_time = #{createTime},</if>
......@@ -82,4 +88,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userCourseId}
</foreach>
</delete>
<select id="testPersonDetailByCourseId" parameterType="Long" resultMap="TTrainUserCourseResult">
SELECT
sys.staff_name,
d.dept_name,
train.examination_result,
train.state
FROM
t_train_user_course train
LEFT JOIN sys_user sys ON train.user_id = sys.user_id
left join sys_dept d on sys.dept_id = d.dept_id
WHERE train.course_id = #{courseId}
</select>
</mapper>
\ No newline at end of file
......@@ -9,6 +9,15 @@ export function listContractorPerson(query) {
})
}
//全部承包商人员信息列表
export function contractALlList(query) {
return request({
url: '/contractor/contractorPerson/contractALlList',
method: 'get',
params: query
})
}
// 查询承包商人员信息详细
export function getContractorPerson(id) {
return request({
......
......@@ -67,6 +67,15 @@ export function deleteLesson(query) {
})
}
//考试发布
export function testPublish(data) {
return request({
url: '/system/course/testPublish',
method: 'put',
data:data
})
}
......@@ -132,3 +141,21 @@ export function setAnswer(query) {
})
}
//统计
export function statisticsTrainCourse(query) {
return request({
url: '/system/course/statisticsTrainCourse',
method: 'get',
params: query
})
}
//成绩详情
export function testPersonDetailByCourseId(query) {
return request({
url: '/system/course/testPersonDetailByCourseId',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询bank列表
export function listBank(query) {
return request({
url: '/system/bank/list',
method: 'get',
params: query
})
}
// 查询bank详细
export function getBank(bankId) {
return request({
url: '/system/bank/' + bankId,
method: 'get'
})
}
// 新增bank
export function addBank(data) {
return request({
url: '/system/bank',
method: 'post',
data: data
})
}
// 修改bank
export function updateBank(data) {
return request({
url: '/system/bank',
method: 'put',
data: data
})
}
// 删除bank
export function delBank(bankId) {
return request({
url: '/system/bank/' + bankId,
method: 'delete'
})
}
// 导出bank
export function exportBank(query) {
return request({
url: '/system/bank/export',
method: 'get',
params: query
})
}
\ No newline at end of file
import request from '@/utils/request'
// 查询题库题目列表
export function listSubject(query) {
return request({
url: '/system/subject/list',
method: 'get',
params: query
})
}
// 查询题库题目详细
export function getSubject(subjectId) {
return request({
url: '/system/subject/' + subjectId,
method: 'get'
})
}
// 新增题库题目
export function addSubject(data) {
return request({
url: '/system/subject',
method: 'post',
data: data
})
}
// 修改题库题目
export function updateSubject(data) {
return request({
url: '/system/subject',
method: 'put',
data: data
})
}
// 删除题库题目
export function delSubject(subjectId) {
return request({
url: '/system/subject/' + subjectId,
method: 'delete'
})
}
// 导出题库题目
export function exportSubject(query) {
return request({
url: '/system/subject/export',
method: 'get',
params: query
})
}
\ No newline at end of file
......@@ -52,5 +52,11 @@ export function deletePlan(query) {
params: query
})
}
export function getPlan(query) {
return request({
url: '/system/plan/'+ query,
method: 'get',
})
}
......@@ -356,3 +356,84 @@
}
}
// text-Paper lession.vue table样式
.left-middle-table {
.el-table th.el-table__cell.is-leaf,
.el-table td.el-table__cell {
border: none
}
.has-gutter .el-table th.el-table__cell.is-leaf,
.el-table td.el-table__cell {
border-bottom: 1px solid #E5E6EB;
}
.el-table th.el-table__cell.is-leaf,
.el-table td.el-table__cell {
box-sizing: border-box;
}
.el-table--medium .el-table__cell:nth-child(1) {
padding: 0;
}
.el-table .el-table__header-wrapper th,
.el-table .el-table__fixed-header-wrapper th {
background-color: #F7F7F7;
}
.el-table--fit {
// height: 100%;
}
.el-table th.el-table__cell>.cell {
padding-left: 14px;
}
.el-table::before {
height: 0px;
}
// 表头的input样式
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
background-color: rgba(0, 0, 0, 0);
border-color: #C4C4C4;
}
.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{
background-color:#62656C !important;
}
// 内容的
// 改变对钩颜色
.el-checkbox__inner:after {
border-color: #62656C !important;
}
.el-checkbox__inner {
border: 1px solid #C4C4C4;
}
.el-checkbox__input.is-checked .el-checkbox__inner {
background-color: rgba(0, 0, 0, 0);
border-color: #C4C4C4;
}
.el-checkbox__input.is-checked .el-checkbox__inner {
border-color: #C4C4C4;
}
.el-checkbox__input.is-focus .el-checkbox__inner {
border-color: #C4C4C4;
}
.el-checkbox__inner:hover {
border-color: #C4C4C4;
}
}
\ No newline at end of file
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 15:23:58
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-21 16:56:26
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/Lesson-table.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div>
<el-table
v-loading="loading"
:data="nameList"
height="305"
@select="select"
@select-all="all"
ref="multipleTable"
>
<el-table-column type="selection"></el-table-column>
<el-table-column label="姓名" align="center" prop="staffName">
</el-table-column>
<el-table-column
label="所属部门"
align="center"
prop="deptName"
:formatter="formatter"
>
</el-table-column>
<el-table-column
label="岗位"
align="center"
prop="profession"
:formatter="formatter"
>
</el-table-column>
</el-table>
<!-- <div> -->
<el-pagination
:layout="'prev, pager, next'"
v-show="total > 0"
:total="total"
:current-page="queryParams.pageNum"
:page-sizes="[queryParams.pageSize]"
@current-change="currentChangeClick"
/>
<!-- </div> -->
</div>
</template>
<script>
import { listStaff } from "@/api/safetyManagement/staff";
export default {
name: "",
props: {
selectNameList: {
type: Array,
},
},
created() {
// this.listStaff();
},
data() {
return {
queryParams: {
pageNum: 1,
pageSize: 10,
deptId: null,
staffName: null,
},
total: 0,
nameList: [],
loading: false,
};
},
methods: {
listStaff() {
this.loading = true;
listStaff(this.queryParams).then((res) => {
this.total = res.total;
this.nameList = res.rows;
this.$nextTick((item) => {
this.selectNameList.forEach((item) => {
this.toggleSelection(item.staffId, true);
});
this.loading = false;
});
});
},
// toggleSelection(rows) {
// if (rows) {
// rows.forEach((row) => {
// this.$refs.multipleTable.toggleRowSelection(row);
// });
// } else {
// this.$refs.multipleTable.clearSelection();
// }
// },
select(all, row) {
this.$emit("selectOne", all, row);
},
all(all) {
console.log(all);
// true是全选,false是全清
let allSelect = false;
if (all.length == 0 || (all.length == 1 && [0] == undefined)) {
allSelect = false;
} else if (all.length > 1) {
allSelect = true;
}
this.$emit("selectAll", this.nameList, allSelect);
},
// 切换选项
toggleSelection(staffId, SeclctFlag = false) {
const item = this.nameList.find((item) => {
return item.staffId == staffId;
});
this.$refs.multipleTable.toggleRowSelection(item, SeclctFlag);
},
currentChangeClick(val) {
this.queryParams.pageNum = val;
this.listStaff();
},
formatter(row, column, cellValue, index) {
// console.log(row, column, cellValue, index);
if (!cellValue) return "-";
else return cellValue;
},
},
};
</script>
<style lang="scss" scoped>
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-12-19 17:39:55
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-21 17:36:34
* @FilePath: /danger-manage-web/src/views/educationPlanExam/textPaper/components/ChangePapel.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="changePeople-wrapper flex">
<div class="changePeople-left">
<div class="top-search flex">
<el-select
v-model="deptId"
filterable
placeholder="请选择"
size="mini"
style="width: 40%"
clearable
>
<el-option
v-for="item in searchList"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
>
</el-option>
</el-select>
<el-input
v-model="staffName"
size="mini"
placeholder="请输入内容"
suffix-icon="el-icon-date"
style="width: 48%"
>
</el-input>
<div>
<el-button @click="searchTable" size="mini">搜索</el-button>
</div>
</div>
<div class="left-middle-table">
<ChangPapelTable
ref="table"
:selectNameList.sync="selectNameList"
@selectOne="selectOne"
@selectAll="selectAll"
/>
</div>
<!-- <div class="bottom-text">共有3n人</div> -->
</div>
<div class="middle flex">
<div>>>></div>
</div>
<div class="changePeople-right flex">
<div class="people-card flex zzz">
<div
class="item flex"
v-for="item in selectNameList"
:key="item.staffId"
>
<div>{{ item.staffName }}</div>
<div class="close" @click="deleteName(item.staffId)">x</div>
</div>
</div>
<div class="bottom-text">已选择n人</div>
</div>
</div>
</template>
<script>
import ChangPapelTable from "./ChangPapelTable";
import { listDept } from "@/api/system/dept";
export default {
name: "changepeopel",
components: {
ChangPapelTable,
},
props: {
// 传进组件的已经被选择的人名
jsonSelectNameList: {
type: String,
default: null,
},
},
data() {
return {
selectNameList: [],
searchList: [],
deptId: null,
staffName: null,
};
},
created() {
listDept().then((res) => {
console.log(res);
this.searchList = res.data;
});
},
mounted() {},
watch: {
selectNameList() {
let json;
if (this.selectNameList.length == 0) {
json = null;
}
if (Array.isArray(this.selectNameList)) {
json = this.selectNameList.map((item) => {
return {
staffId: item.staffId,
staffName: item.staffName,
};
});
} else {
json = this.selectNameList;
}
this.$emit("getPeopleList", JSON.stringify(json));
},
},
methods: {
changeNameList(jsonSelectNameList) {
if (jsonSelectNameList) {
this.selectNameList = JSON.parse(jsonSelectNameList);
} else {
this.selectNameList = [];
}
this.$refs.table.listStaff();
},
searchTable() {
this.$refs.table.queryParams = {
pageNum: 1,
pageSize: 10,
deptId: this.deptId,
staffName: this.staffName,
};
this.$refs.table.listStaff();
},
deleteName(staffId) {
const index = this.selectNameList.findIndex((item) => {
return item.staffId == staffId;
});
if (index >= 0) {
console.log(index);
this.selectNameList.splice(index, 1);
this.$refs.table.toggleSelection(staffId);
}
},
addName(row) {
const index = this.selectNameList.findIndex((item) => {
// console.log(item.id)
return item.staffId == row.staffId;
});
console.log(index);
if (index >= 0) {
this.selectNameList.splice(index, 1);
} else {
this.selectNameList.push(row);
}
},
selectAll(all, allSelect) {
// console.log(all);
console.log(allSelect);
if (allSelect) {
all.forEach((item) => {
const index = this.selectNameList.findIndex((iten) => {
return iten.staffId == item.staffId;
});
if (index < 0) {
this.selectNameList.push(item);
}
});
} else {
all.forEach((item) => {
this.deleteName(item.staffId);
});
}
},
selectOne(all, row) {
this.addName(row);
// console.log(all,row)
},
},
};
</script>
<style lang="scss" scoped>
.changePeople-wrapper {
width: 100%;
height: 400px;
// background-color: red;
margin-top: 10px;
justify-content: space-between;
& > div {
flex-direction: column;
}
.changePeople-left,
.changePeople-right {
width: 415px;
height: 100%;
border: 1px solid #e5e6eb;
}
.middle {
align-items: center;
justify-content: center;
div{
color:#1890FF;
font-weight: 2000;
}
}
.changePeople-left {
padding: 14px 20px 11px 16px;
flex-direction: column;
.top-search {
margin-bottom: 12px;
justify-content: space-between;
}
.left-middle-table {
flex: 1;
// background: red;
}
.bottom-text {
padding-top: 10px;
font-size: 12px;
height: 20px;
line-height: 20px;
text-align: right;
color: #1890ff;
}
}
.changePeople-right {
flex-direction: column;
padding-top: 14px;
height: 100%;
.people-card {
flex-wrap: wrap;
align-content: flex-start;
width: 100%;
flex: 1;
height: 0;
padding-left: 11px;
overflow-y: scroll;
&::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
.item {
width: 70px;
height: 30px;
line-height: 30px;
padding-left: 10px;
padding-right: 5px;
margin-right: 10px;
color: #3d3d3d;
box-sizing: border-box;
margin-bottom: 10px;
box-sizing: border-box;
border: 1px solid #a3d3ff;
border-radius: 3px;
font-size: 12px;
position: relative;
justify-content: space-between;
}
.close {
cursor: pointer;
}
}
.bottom-text {
// padding-top: 10px;
padding-right: 10px;
font-size: 12px;
height: 20px;
line-height: 20px;
text-align: right;
color: #1890ff;
}
}
}
</style>
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-06-16 14:52:17
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-20 23:37:42
* @LastEditTime: 2022-12-15 14:39:18
* @FilePath: /danger-manage-web/src/main.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
......@@ -48,11 +48,14 @@ import VueVideoPlayer from 'vue-video-player'
// require videojs style
import 'video.js/dist/video-js.css'
// import 'vue-video-player/src/custom-theme.css'
Vue.use(VueVideoPlayer, /* {
options: global default options,
events: global videojs events
} */)
// require('video.js/dist/video-js.css')
// require('vue-video-player/src/custom-theme.css')
// Vue.use(VideoPlayer)
......
......@@ -175,7 +175,17 @@ export default {
methods: {
getQuestion() {
getQuestion({ courseId: this.courseId }).then((res) => {
// 如果是修改 就是原来的值,如果不是,就是总数+1
console.log(res)
if (this.topicId) {
res.rows.forEach((item, index) => {
if (item.topicId == this.topicId) {
this.questionNextNum = index+1;
}
});
} else {
this.questionNextNum = res.total + 1;
}
});
},
getLessonById(courseId) {
......@@ -249,7 +259,8 @@ export default {
this.save(3).then((res) => {
if (res) {
this.reset();
this.questionNextNum++;
// this.questionNextNum++;
this.getQuestion();
}
});
},
......
......@@ -2,7 +2,7 @@
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-09-28 17:48:07
* @LastEditTime: 2022-12-17 10:24:41
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
......
......@@ -70,10 +70,25 @@
<el-table v-loading="loading" :data="lessonsList">
<el-table-column label="课程标题" align="center" prop="courseName" />
<!-- <el-table-column label="课程类别" align="center" prop="planName">
<template v-slot="scope">
<div>
{{
courseOptions.filter(
(item) => item.planId == scope.row.courseType
)[0].planName
}}
</div>
</template>
</el-table-column> -->
<el-table-column label="课程类别" align="center" prop="courseType">
<template v-slot="scope">
<div>
{{
scope.row.courseType &&
courseOptions.filter(
(item) => item.planId == scope.row.courseType
)[0] &&
courseOptions.filter(
(item) => item.planId == scope.row.courseType
)[0].planName
......@@ -88,7 +103,12 @@
</el-table-column>
<el-table-column label="附件" align="center" prop="enclosure">
<template v-slot="{ row: { enclosure } }">
<a v-if="enclosure.indexOf('.txt')>=0" @click="downloadText(enclosure)" class="down-load">下载附件</a>
<a
v-if="enclosure && enclosure.indexOf('.txt') >= 0"
@click="downloadText(enclosure)"
class="down-load"
>下载附件</a
>
<a v-else :href="enclosure" class="down-load">下载附件</a>
</template>
</el-table-column>
......@@ -241,7 +261,7 @@ export default {
this.loading = true;
getLessons(this.queryParams)
.then((res) => {
// console.log(res);
console.log(res);
this.lessonsList = res.rows;
this.total = res.total;
})
......
<template>
<div ref="myBody" class="add-question flex">
<div class="text flex">
<div class="left">
目前录入题目是第<span>{{ questionNextNum }}</span
>道题
</div>
<div class="right">{{ courseName }}</div>
</div>
<el-form class="form flex" ref="form" :model="form" label-width="auto">
<!-- <div class="top flex"> -->
<div>
<el-form-item
label="题目内容"
prop="topicTitle"
:rules="{
required: true,
message: '必须输入题目内容',
trigger: 'blur',
}"
>
<el-input
type="textarea"
placeholder="多行输入"
resize="none"
rows="4"
v-model="form.topicTitle"
>
</el-input>
</el-form-item>
</div>
<div class="bottom">
<!-- <el-form-item label="选项1" prop="title">
<el-input v-model="form.title" placeholder="请输入"></el-input>
</el-form-item> -->
<el-form-item
v-for="(question, index) in form.questions"
:label="'选项' + (index + 1)"
:key="question.key"
:prop="'questions.' + index + '.value'"
:rules="
index === 0
? {
required: true,
message: '第一项不能为空不能为空',
trigger: 'blur',
}
: {}
"
>
<div class="add-select flex">
<el-input
type="textarea"
placeholder="多行输入"
style="flex: 1; margin-right: 10px"
rows="2"
v-model="question.value"
></el-input>
<div class="flex algin-items">
<div
@click="rightAnswerClick(index)"
class="right"
:class="{ active: answerNum === index }"
>
设为正确答案
</div>
<el-button
size="mini"
type="danger"
v-if="index > 0"
@click.prevent="removeDomain(question)"
>删除</el-button
>
</div>
</div>
</el-form-item>
<el-form-item
class="noAttr"
:label="`选项${form.questions.length + 1}`"
prop=""
>
<div class="add-select flex">
<el-input
type="textarea"
placeholder="多行输入"
resize="none"
rows="2"
v-model="addValue"
style="flex: 1; margin-right: 10px"
>
</el-input>
<div class="flex algin-items">
<div
@click="rightAnswerClick(form.questions.length)"
class="right"
:class="{ active: answerNum === form.questions.length }"
>
设为正确答案
</div>
<el-button
size="mini"
type="primary"
@click.prevent="add(addValue)"
>新增</el-button
>
</div>
</div>
</el-form-item>
</div>
</el-form>
</div>
</template>
<script>
// import {
// addQuestion,
// checkQuestion,
// changeQuestion,
// getQuestion,
// getLessonById,
// } from "@/api/educationPlanExam/lessonsProgram.js";
import { addSubject ,getSubject,listSubject,updateSubject} from "@/api/educationPlanExam/subject";
export default {
name: "AnswerLesson",
props: {
// visible: {
// type: Boolean,
// default: false,
// },
bankId: {
type: Number,
},
subjectId: {
type: Number,
},
},
components: {},
data() {
return {
form: {
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
},
answerNum: null,
addValue: "",
// 录入的是第几道题
questionNextNum: 1,
courseName: "",
};
},
created() {
// 如果存在就是修改
if (this.subjectId) {
getSubject(this.subjectId).then((res) => {
console.log('?',res.data);
const data = res.data;
this.form = {
topicTitle: data.topicTitle,
questions: JSON.parse(data.topicOption),
};
this.answerNum = data.answer;
});
}
// 查询是第几道题
this.getQuestion();
// 获取课程标题
// this.getLessonById(this.bankId);
},
methods: {
getQuestion() {
listSubject({ bankId: this.bankId }).then((res) => {
console.log(res)
// 如果是修改 就是原来的值,如果不是,就是总数+1
if (this.subjectId) {
res.rows.forEach((item, index) => {
if (item.subjectId == this.subjectId) {
this.questionNextNum = index+1;
}
});
} else {
this.questionNextNum = res.total + 1;
}
});
},
// getLessonById(bankId) {
// getLessonById(bankId).then((res) => {
// console.log(res);
// this.courseName = res.data.courseName;
// });
// },
addQuestion(data) {
// 如果是修改,就用修改的方法,如果是新增,就用新增的方法
if (this.subjectId) {
return updateSubject({ subjectId: this.subjectId, ...data });
} else {
return addSubject({ bankId: this.bankId, ...data });
}
},
rightAnswerClick(index) {
this.answerNum = index;
console.log(index);
},
// 删除选项
removeDomain(question) {
const index = this.form.questions.indexOf(question);
// 如果是正确答案,就让正确答案清空
if (this.answerNum === index) {
this.answerNum = null;
}
if (index >= 0) {
this.form.questions.splice(index, 1);
}
},
// 新增选项
add(addValue) {
this.form.questions.push({ value: addValue });
console.log();
},
save(num = 2) {
return new Promise((resove) => {
if (!this.answerNum && this.answerNum !== 0) {
this.$message({
message: "警告,请设置一个正确答案",
type: "warning",
});
return resove(false);
}
this.$refs.form.validate((valid) => {
if (valid) {
const data = {};
data.topicTitle = this.form.topicTitle;
data.topicOption = JSON.stringify(this.form.questions);
data.answer = this.answerNum;
this.addQuestion(data).then((res) => {
if (res.code == 200) {
// 把修改的这个归位,变成正常添加
this.$emit("update:subjectId", null);
this.$message({
message: "添加题目成功",
type: "success",
});
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.$parent.getList();
resove(true);
}
});
}
});
});
},
saveAndNext() {
this.save(3).then((res) => {
if (res) {
this.reset();
// this.questionNextNum++;
this.getQuestion();
}
});
},
reset() {
this.form = {
topicTitle: "",
questions: [{ value: "" }, { value: "" }, { value: "" }],
};
this.answerNum = null;
this.addValue = "";
},
},
};
</script>
<style lang="scss" scoped>
.add-question {
width: 100%;
height: 550px;
// overflow: hidden;
flex-direction: column;
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb;
.form {
flex: 1;
flex-direction: column;
height: 100%;
.bottom {
overflow-y: auto;
height: 330px;
box-sizing: border-box;
.algin-items {
align-items: center;
width: 200px;
}
.right {
display: inline-block;
width: 133px;
margin-right: 10px;
line-height: initial;
padding: 4px 0;
border: 1px solid #bbbbbb;
color: #101010;
font-size: 12px;
text-align: center;
border-radius: 4px;
box-sizing: border-box;
cursor: pointer;
&.active {
background-color: #0bab0c;
color: #ffffff;
}
&:hover {
background-color: rgba(11, 171, 12, 0.5);
color: #ffffff;
}
}
}
}
.text {
margin-top: 13px;
margin-bottom: 34px;
justify-content: space-between;
height: 28px;
.left {
line-height: 28px;
color: #101010;
font-size: 14px;
}
.right {
width: 411px;
line-height: 28px;
background: #1d84ff;
padding-right: 5px;
color: #fff;
text-align: right;
}
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:38:49
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 14:28:56
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/addLesson.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<el-dialog
class="add-lession"
:title="title"
:visible.sync="visible"
width="1000px"
:close-on-click-modal="false"
:close-on-press-escape="false"
:before-close="dialogCancel"
@closed="closeFinished"
destroy-on-close
>
<div v-if="visible" ref="myBody" class="body">
<transition name="fade" mode="out-in">
<component
:is="currentComponent"
:bankId.sync="bankId"
:subjectId.sync="subjectId"
ref="current"
></component>
</transition>
<!-- <Lesson ref='lesson'/> -->
<!-- <AddQuestion />
<QuestionList/> -->
</div>
<div slot="footer" class="dialog-footer">
<el-button
type="primary"
v-if="this.componentsNum == 1 || this.componentsNum == 3"
@click="save"
>保存</el-button
>
<el-button type="primary" @click="saveAndNext">{{
saveNextText
}}</el-button>
<el-button
v-if="this.componentsNum == 2"
type="primary"
@click="dialogCancel"
>{{ "确认" }}</el-button
>
<el-button @click="dialogCancel">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import Lesson from "./Lesson";
import AddQuestion from "./AddQuestion";
import QuestionList from "./QuestionList";
export default {
name: "AnswerLesson",
props: {
visible: {
type: Boolean,
default: false,
},
componentsNum: {
type: Number,
default: 1,
},
bankId: {
type: Number,
},
},
// components: {
// Lesson,
// AddQuestion,
// QuestionList,
// },
data() {
return {
title: "录入课程",
currentComponent: Lesson,
// 当前题目查看
subjectId: null,
};
},
watch: {
componentsNum: {
handler(num) {
if (num === 1) {
this.currentComponent = Lesson;
if (this.bankId) {
this.title = "修改课程";
} else {
this.title = "新增课程";
}
} else if (num === 2) {
this.currentComponent = QuestionList;
this.title = "题目列表";
} else {
this.currentComponent = AddQuestion;
if (this.subjectId) {
this.title = "修改题目";
} else {
this.title = "新增题目";
}
}
},
deep: true,
},
},
computed: {
saveNextText() {
let text;
if (this.componentsNum == 1) {
text = "保存并录入题目";
} else if (this.componentsNum == 2) {
text = "录入考题";
} else {
text = "保存并录入下一题";
}
return text;
},
},
methods: {
saveBody() {
this.startHeight = this.$refs.myBody.offsetHeight - 55 + "px";
},
closeFinished() {},
// 关闭之后
// 只保存
save() {
// this.answerClear();
this.$refs.current.save();
},
// 保存并录入
saveAndNext() {
this.$refs.current.saveAndNext();
},
// 隐藏与显示dialog
dialogCancel() {
this.$emit("update:visible", false);
},
// 把ID改变了
changeCourseId(bankId) {
this.$emit("update:bankId", bankId);
},
// 改变当前组件
componentsNumChange(num) {
this.$emit("update:componentsNum", num);
},
answerClear() {
this.answerArr = [];
this.changeCourseId(null);
},
},
};
</script>
<style lang="scss" scoped>
.body {
width: 100%;
height: 100%;
padding-right: 40px;
padding-left: 36px;
}
</style>
<template>
<div>
<el-upload
:action="uploadUrl"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
name="file"
:show-file-list="false"
:headers="headers"
style="display: none"
ref="upload"
v-if="this.uploadUrl"
>
</el-upload>
<div class="editor" ref="editor" :style="styles"></div>
</div>
</template>
<script>
import Quill from "quill";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
import { getToken } from "@/utils/auth";
export default {
name: "Editor",
props: {
/* 编辑器的内容 */
value: {
type: String,
default: "",
},
/* 高度 */
height: {
type: Number,
default: null,
},
/* 最小高度 */
minHeight: {
type: Number,
default: null,
},
/* 只读 */
readOnly: {
type: Boolean,
default: false,
},
/* 上传地址 */
uploadUrl: {
type: String,
default: "",
}
},
data() {
return {
headers: {
Authorization: "Bearer " + getToken()
},
Quill: null,
currentValue: "",
options: {
theme: "snow",
bounds: document.body,
debug: "warn",
modules: {
// 工具栏配置
toolbar: [
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
["blockquote", "code-block"], // 引用 代码块
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
[{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ size: ["small", false, "large", "huge"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
[{ align: [] }], // 对齐方式
["clean"], // 清除文本格式
["link", "image"] // 链接、图片、视频"video"
],
},
placeholder: "请输入内容",
readOnly: this.readOnly,
},
};
},
computed: {
styles() {
let style = {};
if (this.minHeight) {
style.minHeight = `${this.minHeight}px`;
}
if (this.height) {
style.height = `${this.height}px`;
}
return style;
},
},
watch: {
value: {
handler(val) {
if (val !== this.currentValue) {
this.currentValue = val === null ? "" : val;
if (this.Quill) {
this.Quill.pasteHTML(this.currentValue);
}
}
},
immediate: true,
},
},
mounted() {
this.init();
},
beforeDestroy() {
this.Quill = null;
},
methods: {
init() {
const editor = this.$refs.editor;
this.Quill = new Quill(editor, this.options);
// 如果设置了上传地址则自定义图片上传事件
if (this.uploadUrl) {
let toolbar = this.Quill.getModule("toolbar");
toolbar.addHandler("image", (value) => {
this.uploadType = "image";
if (value) {
this.$refs.upload.$children[0].$refs.input.click();
} else {
this.quill.format("image", false);
}
});
toolbar.addHandler("video", (value) => {
this.uploadType = "video";
if (value) {
this.$refs.upload.$children[0].$refs.input.click();
} else {
this.quill.format("video", false);
}
});
}
this.Quill.pasteHTML(this.currentValue);
this.Quill.on("text-change", (delta, oldDelta, source) => {
const html = this.$refs.editor.children[0].innerHTML;
const text = this.Quill.getText();
const quill = this.Quill;
this.currentValue = html;
this.$emit("input", html);
this.$emit("on-change", { html, text, quill });
});
this.Quill.on("text-change", (delta, oldDelta, source) => {
this.$emit("on-text-change", delta, oldDelta, source);
});
this.Quill.on("selection-change", (range, oldRange, source) => {
this.$emit("on-selection-change", range, oldRange, source);
});
this.Quill.on("editor-change", (eventName, ...args) => {
this.$emit("on-editor-change", eventName, ...args);
});
},
handleUploadSuccess(res, file) {
// 获取富文本组件实例
let quill = this.Quill;
// 如果上传成功
if (res.code == 200) {
// 获取光标所在位置
let length = quill.getSelection().index;
// 插入图片 res.url为服务器返回的图片地址
quill.insertEmbed(length, "image", res.url);
// 调整光标到最后
quill.setSelection(length + 1);
} else {
this.$message.error("图片插入失败");
}
},
handleUploadError() {
this.$message.error("图片插入失败");
},
},
};
</script>
<style>
.editor, .ql-toolbar {
white-space: pre-wrap !important;
line-height: normal !important;
}
.quill-img {
display: none;
}
.ql-snow .ql-tooltip[data-mode="link"]::before {
content: "请输入链接地址:";
}
.ql-snow .ql-tooltip.ql-editing a.ql-action::after {
border-right: 0px;
content: "保存";
padding-right: 0px;
}
.ql-snow .ql-tooltip[data-mode="video"]::before {
content: "请输入视频地址:";
}
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
content: "14px";
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="small"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="small"]::before {
content: "10px";
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="large"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="large"]::before {
content: "18px";
}
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="huge"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="huge"]::before {
content: "32px";
}
.ql-snow .ql-picker.ql-header .ql-picker-label::before,
.ql-snow .ql-picker.ql-header .ql-picker-item::before {
content: "文本";
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before {
content: "标题1";
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
content: "标题2";
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
content: "标题3";
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before {
content: "标题4";
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before {
content: "标题5";
}
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before,
.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before {
content: "标题6";
}
.ql-snow .ql-picker.ql-font .ql-picker-label::before,
.ql-snow .ql-picker.ql-font .ql-picker-item::before {
content: "标准字体";
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="serif"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="serif"]::before {
content: "衬线字体";
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="monospace"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="monospace"]::before {
content: "等宽字体";
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 10:59:44
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 14:36:14
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/Lession.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="form-wrapper">
<el-form
class="form"
ref="form"
:model="form"
label-width="auto"
:rules="rules"
>
<div class="top flex">
<el-form-item label="题库名称" prop="bankName">
<el-input style="width: 300px" v-model="form.bankName"></el-input>
</el-form-item>
<el-form-item
label="归属部门"
prop="deptId"
label-width="140px"
ref="treeItem"
>
<Treeselect
class="tree"
v-model="form.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择归属部门"
@open="treeOpen"
@close="treeClose"
@select="select"
/>
</el-form-item>
</div>
<!-- </div> -->
<!-- <el-form-item label="课程内容" prop="courseConent">
<Editor v-model="form.courseConent" :min-height="192" />
<el-input
v-show="false"
disabled
v-model="form.courseConent"
></el-input>
</el-form-item> -->
<!-- <div class="flex">
<el-form-item label="视频上传" v-if="!readOnly" prop="video">
<FileUpload
listType="picture"
@resFun="getFileInfoVideo"
@remove="listRemoveVideo"
:fileArr="fileListVideo"
:fileSize="500"
:fileType="['mp4']"
/>
<el-input v-show="false" disabled v-model="form.video"></el-input>
</el-form-item>
<el-form-item label="附件上传" v-if="!readOnly" prop="enclosure">
<FileUpload
listType="picture"
@resFun="getFileInfoFile"
@remove="listRemoveFile"
:fileArr="fileListFile"
/>
<el-input v-show="false" disabled v-model="form.enclosure"></el-input>
</el-form-item>
</div> -->
</el-form>
</div>
</template>
<script>
import Editor from "./Editor";
import FileUpload from "@/components/FileUpload";
import uploadfile from "@/assets/uploadfile.png";
// import { mapGetters } from "vuex";
// import {
// addLessons,
// getLessonById,
// changeLesson,
// } from "@/api/educationPlanExam/lessonsProgram";
import {
listBank,
addBank,
updateBank,
getBank,
} from "@/api/educationPlanExam/questionBank";
// 所有部门
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "",
props: {
bankId: {
type: Number,
},
},
components: {
Editor,
FileUpload,
Treeselect,
},
data() {
return {
form: {
bankName: "",
// courseType: "",
// courseConent: "",
// video: "",
// enclosure: "",
deptId: null,
},
// 归属部门列表
deptOptions: [],
fileListVideo: [],
fileListFile: [],
readOnly: false,
rules: {
bankName: [
{ required: true, trigger: "blur", message: "课程名称不能为空" },
],
deptId: [
{ required: true, trigger: "blur", message: "请选择所属部门" },
],
// courseType: [
// { required: true, trigger: "change", message: "课程类型不能为空" },
// ],
// courseConent: [
// { required: true, trigger: "blur", message: "课程内容不能为空" },
// ],
// video: [{ required: true, trigger: "blue", message: "视频不能为空" }],
// enclosure: [
// { required: true, trigger: "blur", message: "附件不能为空" },
// ],
},
};
},
computed: {
// 获取课程类型
// ...mapGetters(["courseOptions"]),
},
created() {
if (this.bankId) {
this.getLessonById();
}
// 归属部门列表
this.getTreeselect();
},
mounted() {},
methods: {
// 添加课程
addLessons(data) {
if (!this.bankId) {
console.log("添加");
return addBank(data);
} else {
console.log("修改");
return updateBank({ bankId: this.bankId, ...data });
}
},
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then((response) => {
this.deptOptions = response.data;
console.log(this.deptOptions);
});
},
// 当树形组件打开
treeOpen() {
document.querySelector(".vue-treeselect__control").style.borderColor = "";
},
// 当属性组件关闭
treeClose(a, b) {
if (!a) {
// 手动添加报红功能,没值的时候报红
document.querySelector(".vue-treeselect__control").style.borderColor =
"red";
this.save();
} else {
document.querySelector(".vue-treeselect__control").style.borderColor =
"";
this.$refs.treeItem.clearValidate();
}
},
select() {},
// 复现
getLessonById() {
getBank(this.bankId).then((res) => {
console.log("res", res);
if (res.code == 200) {
this.form = {
bankName: res.data.bankName,
deptId: res.data.deptId,
};
// const data = res.data;
// const { bankName, courseType, courseConent, video, enclosure } =
// data;
// this.form = {
// bankName,
// courseType,
// courseConent,
// video,
// enclosure,
// };
// this.fileListVideo = [
// {
// name: bankName + "视频",
// url: uploadfile,
// },
// ];
// this.fileListFile = [
// {
// name: bankName + "附件",
// url: uploadfile,
// },
// ];
}
});
},
getFileInfoVideo(res) {
this.form.video = res.url;
// this.form.videoName = res.fileName;
this.fileListVideo = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemoveVideo(e) {
this.fileListVideo = [];
this.form.video = "";
// this.form.videoName = null;
},
getFileInfoFile(res) {
this.form.enclosure = res.url;
// this.form.enclosureName = res.fileName;
this.fileListFile = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemoveFile(e) {
this.fileListFild = [];
this.form.enclosure = "";
// this.form.fileName = null;
},
save(num = 2) {
// 因为富文本编辑器会残留<p><br></p>,所以要清
// if (this.form.courseConent === "<p><br></p>") {
// this.form.courseConent = "";
// }
this.$refs.form.validate((valid) => {
if (valid) {
this.addLessons({ ...this.form }).then((res) => {
// 如果添加会传回来,就用传回来的,如果是修改本身就有,就用本身的
// console.log('res',res)
const bankId = this.bankId || res;
// if (res.code == 200) {
// 这样调比较纯函数一点
if (num == 2) {
this.$message({
message: "保存题库成功",
type: "success",
});
} else if (num == 3) {
this.$message({
message: "保存题库成功,请开始录入题目",
type: "success",
});
}
this.$parent.$parent.componentsNumChange(num);
this.$parent.$parent.changeCourseId(bankId);
this.$parent.$parent.$parent.getList();
return true;
// }
});
} else {
if (!this.form.deptId) {
document.querySelector(
".vue-treeselect__control"
).style.borderColor = "red";
} else {
document.querySelector(
".vue-treeselect__control"
).style.borderColor = "";
this.$refs.treeItem.clearValidate();
}
}
});
},
// 保存并进入题目
saveAndNext() {
this.save(3);
},
},
};
</script>
<style lang="scss" scoped>
.form-wrapper {
padding-top: 22px;
width: 100%;
height: 100px;
// overflow: hidden;
// padding-bottom: 10px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb;
.top {
width: 100%;
justify-content: space-between;
}
}
</style>
<!--
* @Author: 纪泽龙 jizelong@qq.com
* @Date: 2022-09-22 17:56:05
* @LastEditors: 纪泽龙 jizelong@qq.com
* @LastEditTime: 2022-12-17 14:28:57
* @FilePath: /danger-manage-web/src/views/lessonsProgram/components/QuestionList.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div ref="myBody" class="add-question flex">
<div class="text flex">
<div class="left">
目前有<span>{{ questionNum || 0 }}</span
>道题
<!-- <span class="warn">温馨提示:发布课程前需要进行考试设置</span> -->
</div>
<div class="right">{{ courseName }}</div>
</div>
<div class="table flex" v-loading="loading">
<div class="th flex">
<div class="left">序号</div>
<div class="middle">题目名称</div>
<div class="right">操作</div>
</div>
<div class="td-wrapper">
<div
v-for="(item, index) in questionList"
:key="item.subjectId"
class="td flex"
>
<div class="left">{{ index + 1 }}</div>
<div class="middle zzz">
{{ item.topicTitle }}
</div>
<div class="right">
<div>
<el-button
@click="edit(item.subjectId)"
icon="el-icon-edit"
type="text"
>修改</el-button
>
<el-button
@click="deleteLesson(item.subjectId)"
icon="el-icon-delete"
type="text"
>删除</el-button
>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="rightNum flex">
<div class="left">录入考题</div>
<div class="middle flex">
<div class="left-text">答对题目大于</div>
<div>
<el-input
v-model="rightNum"
style="width: 60px"
size="mini"
></el-input>
</div>
<div>为合格</div>
</div>
<div class="right">
<el-button
@click="saveRightNum"
icon="el-icon-check"
size="mini"
type="success"
>保存</el-button
>
</div>
</div> -->
</div>
</template>
<script>
import {
getQuestion,
deleteQuestion,
changeLesson,
getLessonById,
} from "@/api/educationPlanExam/lessonsProgram";
import { listSubject, delSubject } from "@/api/educationPlanExam/subject";
import { getBank } from "@/api/educationPlanExam/questionBank";
export default {
name: "AnswerLesson",
props: {
bankId: {
type: Number,
},
},
components: {},
data() {
return {
// 当前课程的第几题,调一遍接口
questionNum: null,
// 答对几道题
rightNum: 0,
questionList: [],
loading: false,
courseName: "",
};
},
// watch: {
// visible(newValue) {
// if (newValue) {
// this.$nextTick(() => {
// this.saveBody();
// });
// }
// },
// },
created() {
console.log("this.bankId", this.bankId);
if (this.bankId) {
this.getQuestion({ bankId: this.bankId });
// 获取只题目正确几题算过关
this.getLessonById(this.bankId);
}
},
methods: {
save() {
console.log("QuestionList");
},
saveAndNext() {
this.$parent.$parent.componentsNumChange(3);
},
getQuestion(bankId) {
console.log(bankId);
return listSubject(bankId).then((res) => {
console.log("题库res", res);
this.questionList = res.rows.map((item) => {
return {
subjectId: item.subjectId,
topicTitle: item.topicTitle,
};
});
this.questionNum = res.total;
return true;
});
},
getLessonById(bankId) {
getBank(bankId).then((res) => {
// console.log(res);
// this.rightNum = res.data.qualifiedNum;
this.courseName = res.data.bankName;
});
},
edit(subjectId) {
this.$emit("update:subjectId", subjectId);
this.$parent.$parent.componentsNumChange(3);
},
deleteLesson(subjectId) {
this.$confirm("请确定删除该题", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.loading = true;
return delSubject(subjectId);
})
.then((res) => {
if (res.code == 200) {
this.$message({
message: "删除成功",
type: "success",
});
}
return this.getQuestion({ bankId: this.bankId });
})
.finally(() => {
this.loading = false;
// 课程列表重置一下
this.$parent.$parent.$parent.getList();
});
},
saveRightNum() {
if (this.rightNum > this.questionList.length) {
this.$message({
message: "答对题目数应小于等于考试题目总数",
type: "warning",
});
return;
}
changeLesson({
bankId: this.bankId,
qualifiedNum: this.rightNum,
}).then((res) => {
if (res.code == 200) {
this.$message({
message: "答题合格数修改成功",
type: "success",
});
}
});
},
},
};
</script>
<style lang="scss" scoped>
.add-question {
width: 100%;
height: 550px;
// overflow: hidden;
flex-direction: column;
padding-bottom: 7px;
margin-bottom: 20px;
border-bottom: 1px solid #bbbbbb00;
.text {
margin-top: 13px;
margin-bottom: 32px;
justify-content: space-between;
height: 28px;
.left {
line-height: 28px;
color: #101010;
font-size: 14px;
.warn {
display: inline-flex;
font-size: 12px;
color: red;
margin-left: 10px;
}
}
.right {
width: 411px;
line-height: 28px;
background: #1d84ff;
padding-right: 5px;
color: #fff;
text-align: right;
}
}
.table {
flex: 1;
height: 0;
flex-direction: column;
.th {
width: 100%;
height: 70px;
line-height: 70px;
background: #f5f5f5;
color: #606266;
> div {
height: 100%;
}
.left {
width: 15%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 100px;
}
.right {
width: 25%;
text-align: center;
}
}
.td-wrapper {
flex: 1;
overflow-y: auto;
// 这样子元素才能有滚动条
.td {
height: 68px;
line-height: 68px;
box-sizing: border-box;
border-bottom: 1px solid #bbbbbb;
&:last-child {
border-bottom: none;
}
> div {
height: 100%;
}
.left {
width: 15%;
text-align: center;
}
.middle {
width: 60%;
padding-left: 10px;
}
.right {
width: 25%;
text-align: center;
}
}
}
}
.rightNum {
margin-top: 5px;
height: 55px;
box-sizing: border-box;
border: 1px solid #bbbbbb;
line-height: 55px;
> .left {
width: 140px;
background: #0bab0c;
font-size: 14px;
color: #fff;
text-align: center;
}
> .middle {
> div {
margin-right: 5px;
}
.left-text {
margin-left: 10px;
}
.middle {
margin-right: 20px;
}
}
.right {
margin-left: 20px;
}
// background: black;
}
}
</style>
<template>
<div class="testStat">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px">
<el-form-item label="考试名称" prop="courseName">
<el-input
v-model="queryParams.courseName"
placeholder="请输入课程名称"
clearable
size="small"
/>
</el-form-item>
<el-form-item label="类型" prop="dataKind">
<el-select v-model="queryParams.dataKind">
<el-option label="培训考试" value="0" />
<el-option label="随机考试" value="1" />
</el-select>
</el-form-item>
<el-form-item label="发布时间" prop="releaseTimeBegin">
<el-date-picker
v-model="releaseTime"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateFormat">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="search"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetClick"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="testStatData">
<el-table-column label="序号" width='100' align="center" prop="courseNum"/>
<el-table-column label="考试名称" align="center" prop="courseName"/>
<el-table-column label="发布时间" align="center" prop="releaseTime"/>
<el-table-column label="类型" align="center" prop="dataKind">
<template slot-scope="scope">
<span v-if="scope.row.dataKind == '0'">培训考试</span>
<span v-else>随机考试</span>
</template>
</el-table-column>
<el-table-column label="应参加人数" align="center" prop="count"/>
<el-table-column label="实际考试人数" align="center" prop="test"/>
<el-table-column label="合格人数" align="center" prop="pass"/>
<el-table-column label="合格率" align="center" prop="rate">
<template slot-scope="scope">
{{scope.row.rate}}%
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template v-slot="{ row: { courseId } }">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="courseDetail(courseId)"
>查看详情</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getTestList"
/>
<!--考试详情 -->
<el-dialog title="考试详情" :visible.sync="testStatDetailOpen" append-to-body :close-on-click-modal="false">
<el-table v-loading="loading" :data="testStatDetailData">
<el-table-column label="序号" width='100' align="center" prop="detailNum"/>
<el-table-column label="考试人员" align="center" prop="staffName"/>
<el-table-column label="所属部门" align="center" prop="deptName"/>
<el-table-column label="答对个数" align="center" prop="examinationResult"/>
<el-table-column label="考试结果" align="center" prop="state">
<template slot-scope="scope">
<span v-if="scope.row.state == 0">未考试</span>
<span v-if="scope.row.state == 1">不合格</span>
<span v-if="scope.row.state == 2">合格</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="totalDetail > 0"
:total="totalDetail"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getTestStatDetails"
/>
</el-dialog>
</div>
</template>
<script>
import {statisticsTrainCourse,testPersonDetailByCourseId} from "@/api/educationPlanExam/lessonsProgram.js";
export default {
name: "testStat",
data(){
return{
// 遮罩层
loading: false,
// 总条数
total: 0,
releaseTime: "",
queryParams:{
pageNum: 1,
pageSize: 10,
courseName: "",
dataKind: "",
releaseTimeBegin: "",
releaseTimeEnd: ""
},
testStatData:[],
testStatDetailOpen: false,
testStatDetailData: [],
totalDetail: 0,
queryDetailParams:{
pageNum: 1,
pageSize: 10,
courseId: ""
}
}
},
created(){
this.getTestList();
},
methods: {
getTestList(){
console.log("this.queryParams:",this.queryParams)
statisticsTrainCourse(this.queryParams).then(res=>{
this.testStatData = res.rows.map((item, index) => {
return {
courseNum:
index +
1 +
(this.queryParams.pageNum - 1) * this.queryParams.pageSize,
...item,
};
});
this.total = res.total;
}) .finally(() => {
this.loading = false;
});
},
dateFormat(picker){
this.queryParams.releaseTimeBegin = picker[0];
this.queryParams.releaseTimeEnd = picker[1];
},
search(){
this.getTestList();
},
resetClick(){
this.releaseTime = "";
this.queryParams={
pageNum: 1,
pageSize: 10,
courseName: "",
dataKind: "",
releaseTimeBegin: "",
releaseTimeEnd: ""
}
},
courseDetail(courseId){
this.testStatDetailOpen = true;
this.getTestStatDetails(courseId);
},
getTestStatDetails(courseId){
this.queryDetailParams.courseId = courseId;
testPersonDetailByCourseId(this.queryDetailParams).then(res =>{
this.testStatDetailData = res.rows.map((item, index) => {
return {
detailNum:
index +
1 +
(this.queryParams.pageNum - 1) * this.queryParams.pageSize,
...item,
};
});
this.totalDetail = res.total;
}) .finally(() => {
this.loading = false;
});
}
}
}
</script>
<style scoped lang="scss">
.testStat{
margin: 10px;
}
</style>
......@@ -93,7 +93,9 @@ export default {
methods: {
edit() {
// 编辑
this.$emit("edit", this.oldInfoData);
//console.log(this.infoData);
this.$parent.addClick(this.infoData);
//this.$emit("edit", this.oldInfoData);
},
save() {
if (this.infoData.planName == "") {
......@@ -177,7 +179,7 @@ export default {
transition: all 0.5s;
width: 93.2%;
max-width: 1600px;
height: 111px;
min-height: 111px;
border: 1px solid #cecece;
box-shadow: -4px 0px 0px 0px rgba(0, 0, 0, 0.1);
background: linear-gradient(
......@@ -196,6 +198,7 @@ export default {
height: 100%;
align-items: center;
justify-content: right;
margin-top: 25px;
.left-item {
transition: all 0.5s;
width: 200px;
......
......@@ -28,7 +28,7 @@
v-for="item in list"
:key="item.planId"
:infoData="item"
:personnelOptions="personnelOptions"
:personnelOptions="item.postIds"
@edit="edit"
@save="itemSave"
@deletePlan="deletePlan"
......@@ -60,16 +60,22 @@
</el-checkbox-group>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogSubmitForm">确 定</el-button>
<el-button @click="dialogCancel">取 消</el-button>
</div>
</el-dialog>
<Dia
ref="Dia"
:componentsNum.sync="componentsNum"
:bankId.sync="bankId"
:visible.sync="dilogFlag"
/>
</div>
</template>
<script>
import Dia from "./components/Dia";
import Item from "./components/Item";
import {
getPersonnel,
......@@ -91,7 +97,7 @@ const personnelOptions = [
export default {
name: "trainingProgram",
components: {
Item,
Item,Dia
},
data() {
return {
......@@ -106,6 +112,10 @@ export default {
planName: "",
postIds: [],
},
componentsNum: 2,
// 点击的id,如果是新增为空
bankId: null,
dilogFlag: false,
rules: {
planName: [
{
......@@ -143,17 +153,20 @@ export default {
});
},
getPlanList() {
this.dilogFlag = false;
return getPlanList().then((res) => {
console.log(res.data);
this.list = res.data.map((item) => {
return {
planId: item.planId,
planName: item.planName,
postIds: item.postList
postIds: item.postList,
postList: item.postList
.filter((item) => item.ischeck)
.map((item) => item.postId),
};
});
console.log(this.list);
});
},
addPlan(plan) {
......@@ -214,8 +227,18 @@ export default {
this.isActiveId = 999;
},
changeList() {},
addClick() {
this.addOpen = true;
addClick(form) {
this.$refs.Dia.title = "新增培训计划";
this.componentsNum = 2;
this.bankId = null;
this.dilogFlag = true;
if(form.planId!=undefined){
//console.log("=======")
this.$refs.Dia.title = "修改培训计划";
this.bankId = form.planId;
}
//this.addOpen = true;
},
dialogSubmitForm() {
this.$refs["form"].validate((valid) => {
......
......@@ -325,12 +325,6 @@
planTitle: [
{ required: true, message: "标题不能为空", trigger: "blur" }
],
planType: [
{ required: true, message: "预案类型不能为空", trigger: "blur" }
],
planLevel: [
{ required: true, message: "预案等级不能为空", trigger: "blur" }
]
}
};
},
......
......@@ -35,7 +35,7 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: process.env.VUE_APP_TARGET,
//target: `http://192.168.31.87:8908/dangerManage`,
// target: `http://192.168.2.2:8908/dangerManage`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment