包头bug修复
This commit is contained in:
parent
07abd96925
commit
17d43bf689
@ -2,6 +2,9 @@ package com.zhgd.xmgl.modules.baotou.entity;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
|||||||
@ -47,24 +47,36 @@ public class WelderSkillExam implements Serializable {
|
|||||||
private java.lang.String originalCertificateValidityPeriod ;
|
private java.lang.String originalCertificateValidityPeriod ;
|
||||||
/**焊工作业证编号*/
|
/**焊工作业证编号*/
|
||||||
@ApiModelProperty(value="焊工作业证编号")
|
@ApiModelProperty(value="焊工作业证编号")
|
||||||
private java.lang.String welderWorkPermitNumber ;
|
private java.lang.String welderWorkPermitNumber;
|
||||||
/**焊工考核项目*/
|
/**
|
||||||
@ApiModelProperty(value="焊工考核项目")
|
* 焊工考核项目
|
||||||
private java.lang.String welderAssessmentItem ;
|
*/
|
||||||
/**现场考核日期*/
|
@ApiModelProperty(value = "焊工考核项目")
|
||||||
@ApiModelProperty(value="现场考核日期")
|
private java.lang.String welderAssessmentItem;
|
||||||
private java.lang.String onSiteAssessmentDate ;
|
/**
|
||||||
/**考核结果*/
|
* 现场考核日期
|
||||||
@ApiModelProperty(value="考核结果")
|
*/
|
||||||
private java.lang.String assessmentResult ;
|
@ApiModelProperty(value = "现场考核日期")
|
||||||
/**创建时间 yyyy-MM-dd HH:mm:ss*/
|
private java.lang.String onSiteAssessmentDate;
|
||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
/**
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
* 考核结果
|
||||||
@ApiModelProperty(value="创建时间 yyyy-MM-dd HH:mm:ss")
|
*/
|
||||||
private java.util.Date createTime ;
|
@ApiModelProperty(value = "考核结果")
|
||||||
/**更新时间 yyyy-MM-dd HH:mm:ss*/
|
private java.lang.String assessmentResult;
|
||||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
/**
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
* 创建时间 yyyy-MM-dd HH:mm:ss
|
||||||
@ApiModelProperty(value="更新时间 yyyy-MM-dd HH:mm:ss")
|
*/
|
||||||
private java.util.Date updateTime ;
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
|
||||||
|
private java.util.Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新时间 yyyy-MM-dd HH:mm:ss
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
|
||||||
|
private java.util.Date updateTime;
|
||||||
|
@ApiModelProperty(value = "焊工考核申请id")
|
||||||
|
private java.lang.Long requestId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,18 @@
|
|||||||
package com.zhgd.xmgl.modules.baotou.plan.controller;
|
package com.zhgd.xmgl.modules.baotou.plan.controller;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zhgd.annotation.OperLog;
|
import com.zhgd.annotation.OperLog;
|
||||||
import com.zhgd.jeecg.common.api.vo.Result;
|
import com.zhgd.jeecg.common.api.vo.Result;
|
||||||
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackPeriod;
|
import com.zhgd.xmgl.modules.baotou.plan.entity.*;
|
||||||
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanRecord;
|
import com.zhgd.xmgl.modules.baotou.plan.mapper.PlanRecordMapper;
|
||||||
import com.zhgd.xmgl.modules.baotou.plan.service.IPlanRecordService;
|
import com.zhgd.xmgl.modules.baotou.plan.service.*;
|
||||||
|
import com.zhgd.xmgl.modules.stuff.entity.StuffType;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@ -17,13 +21,13 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.simpleframework.xml.core.Validate;
|
import org.simpleframework.xml.core.Validate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,8 +42,42 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "进度计划编制相关Api")
|
@Api(tags = "进度计划编制相关Api")
|
||||||
public class PlanRecordController {
|
public class PlanRecordController {
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPlanRecordService planRecordService;
|
private IPlanRecordService planRecordService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanPbsService planPbsService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanMilestoneService planMilestoneService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private PlanRecordMapper planRecordMapper;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanFeedbackService planFeedbackService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanPeriodService planPeriodService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanFeedbackPeriodService planFeedbackPeriodService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanMilestoneValService planMilestoneValService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanCalendarTemplateService planCalendarTemplateService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanWorkCategoryService planWorkCategoryService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanChooseCategoryService planChooseCategoryService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IPlanFeedbackApprovalWorkService planFeedbackApprovalWorkService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
@ -59,7 +97,6 @@ public class PlanRecordController {
|
|||||||
return Result.success(planRecordService.queryPageList(param));
|
return Result.success(planRecordService.queryPageList(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
*
|
*
|
||||||
@ -154,6 +191,7 @@ public class PlanRecordController {
|
|||||||
@ApiOperation(value = "查询进度曲线", notes = "查询进度曲线", httpMethod = "GET")
|
@ApiOperation(value = "查询进度曲线", notes = "查询进度曲线", httpMethod = "GET")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "recordId", value = "计划编制id", paramType = "query", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "recordId", value = "计划编制id", paramType = "query", required = true, dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "pbsId", value = "进度PBSID(计划编制id和进度PBSID必传其中之一,都传以计划编制id为准)", paramType = "query", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "beginDate", value = "开始日期", paramType = "query", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "beginDate", value = "开始日期", paramType = "query", required = false, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "endDate", value = "结束日期", paramType = "query", required = false, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "year", value = "年份", paramType = "query", required = false, dataType = "String")
|
@ApiImplicitParam(name = "year", value = "年份", paramType = "query", required = false, dataType = "String")
|
||||||
@ -166,12 +204,81 @@ public class PlanRecordController {
|
|||||||
param.put("endDate", year + "-12" + "-31");
|
param.put("endDate", year + "-12" + "-31");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return Result.success(planRecordService.getPlanCurve(param));
|
String recordId = MapUtils.getString(param, "recordId");
|
||||||
|
if (StrUtil.isNotBlank(recordId)) {
|
||||||
|
return Result.success(planRecordService.getPlanCurve(param));
|
||||||
|
} else {
|
||||||
|
Long pbsId = MapUtils.getLong(param, "pbsId");
|
||||||
|
List<PlanPbs> planPbs = planPbsService.getChildren(pbsId);
|
||||||
|
List<Long> pbsIds = planPbs.stream().map(PlanPbs::getId).collect(Collectors.toList());
|
||||||
|
pbsIds.add(pbsId);
|
||||||
|
List<Map<String, Object>> rtList = new ArrayList<>();
|
||||||
|
List<PlanRecord> records = planRecordService.list(new LambdaQueryWrapper<PlanRecord>()
|
||||||
|
.eq(PlanRecord::getPbsId, pbsIds)
|
||||||
|
.eq(PlanRecord::getParentId, 0)
|
||||||
|
);
|
||||||
|
Map<Date, List<PlanFeedbackPeriod>> dateMap = new HashMap<>();
|
||||||
|
String projectSn = planPbs.get(0).getProjectSn();
|
||||||
|
List<PlanMilestone> milestones = planMilestoneService.list(new LambdaQueryWrapper<PlanMilestone>().eq(PlanMilestone::getProjectSn, projectSn));
|
||||||
|
PlanPeriod planPeriod = planPeriodService.getOne(new LambdaQueryWrapper<PlanPeriod>().eq(PlanPeriod::getProjectSn, projectSn));
|
||||||
|
List<PlanRecord> allPlanRecords = planRecordMapper.selectList(new LambdaQueryWrapper<PlanRecord>().eq(PlanRecord::getProjectSn, projectSn));
|
||||||
|
Map<Long, List<PlanRecord>> childrenMap = new HashMap<>();
|
||||||
|
for (PlanRecord record : records) {
|
||||||
|
childrenMap.put(record.getId(), this.getChildren(record, allPlanRecords));
|
||||||
|
}
|
||||||
|
for (PlanRecord record : records) {
|
||||||
|
List<PlanFeedbackPeriod> periods = planRecordService.getPlanSharesForCurve(param, record, milestones, planPeriod, allPlanRecords, childrenMap.get(record.getId()));
|
||||||
|
for (PlanFeedbackPeriod period : periods) {
|
||||||
|
List<PlanFeedbackPeriod> periodList = dateMap.get(period.getPeriodStart());
|
||||||
|
if (periodList == null) {
|
||||||
|
periodList = new ArrayList<>();
|
||||||
|
dateMap.put(period.getPeriodStart(), periodList);
|
||||||
|
}
|
||||||
|
periodList.add(period);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<PlanFeedbackPeriod> planShares = dateMap.entrySet().stream().map(o -> {
|
||||||
|
PlanFeedbackPeriod feedbackPeriod = new PlanFeedbackPeriod();
|
||||||
|
List<PlanFeedbackPeriod> list = o.getValue();
|
||||||
|
BigDecimal planYdz = BigDecimal.ZERO;
|
||||||
|
BigDecimal actualYdz = BigDecimal.ZERO;
|
||||||
|
for (PlanFeedbackPeriod period : list) {
|
||||||
|
planYdz = NumberUtil.add(planYdz, period.getPlanYdz());
|
||||||
|
actualYdz = NumberUtil.add(actualYdz, period.getActualYdz());
|
||||||
|
}
|
||||||
|
feedbackPeriod.setPlanYdz(NumberUtil.div(planYdz, list.size()));
|
||||||
|
feedbackPeriod.setActualYdz(NumberUtil.div(actualYdz, list.size()));
|
||||||
|
return feedbackPeriod;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(planShares)) {
|
||||||
|
BigDecimal p = new BigDecimal("0");
|
||||||
|
BigDecimal a = new BigDecimal("0");
|
||||||
|
for (PlanFeedbackPeriod feedbackPeriod : planShares) {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("time", DateUtil.formatDate(feedbackPeriod.getPeriodStart()));
|
||||||
|
map.put("plan", feedbackPeriod.getPlanYdz());
|
||||||
|
map.put("actual", feedbackPeriod.getActualYdz());
|
||||||
|
p = NumberUtil.add(p, feedbackPeriod.getPlanYdz());
|
||||||
|
a = NumberUtil.add(a, feedbackPeriod.getActualYdz());
|
||||||
|
map.put("planTotal", p);
|
||||||
|
map.put("actualTotal", a);
|
||||||
|
rtList.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.success(rtList);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Result.success(new ArrayList<>(), e.getMessage());
|
return Result.success(new ArrayList<>(), e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<PlanRecord> getChildren(PlanRecord st, List<PlanRecord> allList) {
|
||||||
|
return allList.stream()
|
||||||
|
.filter(m -> Objects.equals(m.getParentId(), st.getId()))
|
||||||
|
.peek(m -> m.setChildren(getChildren(m, allList)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
@OperLog(operModul = "进度计划编制管理", operType = "", operDesc = "查询项目里程碑")
|
@OperLog(operModul = "进度计划编制管理", operType = "", operDesc = "查询项目里程碑")
|
||||||
@ApiOperation(value = "查询项目里程碑", notes = "查询项目里程碑", httpMethod = "GET")
|
@ApiOperation(value = "查询项目里程碑", notes = "查询项目里程碑", httpMethod = "GET")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
|
|||||||
@ -43,12 +43,16 @@ public interface IPlanPbsService extends IService<PlanPbs> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void delete(String id);
|
void delete(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询进度PBS信息
|
* 根据id查询进度PBS信息
|
||||||
|
*
|
||||||
* @param id 进度PBS的id
|
* @param id 进度PBS的id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PlanPbs queryById(String id);
|
PlanPbs queryById(String id);
|
||||||
|
|
||||||
IPage<PlanPbs> queryTreePage(HashMap<String, Object> param);
|
IPage<PlanPbs> queryTreePage(HashMap<String, Object> param);
|
||||||
|
|
||||||
|
List<PlanPbs> getChildren(Long pbsId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.zhgd.xmgl.modules.baotou.plan.service;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackPeriod;
|
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanFeedbackPeriod;
|
||||||
|
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanMilestone;
|
||||||
|
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanPeriod;
|
||||||
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanRecord;
|
import com.zhgd.xmgl.modules.baotou.plan.entity.PlanRecord;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -72,7 +74,9 @@ public interface IPlanRecordService extends IService<PlanRecord> {
|
|||||||
|
|
||||||
List<PlanFeedbackPeriod> getPlanShares(Map<String, Object> param);
|
List<PlanFeedbackPeriod> getPlanShares(Map<String, Object> param);
|
||||||
|
|
||||||
|
List<PlanFeedbackPeriod> getPlanSharesForCurve(Map<String, Object> param, PlanRecord record, List<PlanMilestone> milestones, PlanPeriod planPeriod, List<PlanRecord> planRecords, List<PlanRecord> children);
|
||||||
|
|
||||||
List<Map<String, Object>> getPlanCurve(Map<String, Object> param);
|
List<Map<String, Object>> getPlanCurve(Map<String, Object> param);
|
||||||
|
|
||||||
HashMap<String ,Object> getProjectMilestone(HashMap<String, Object> param);
|
HashMap<String, Object> getProjectMilestone(HashMap<String, Object> param);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import com.zhgd.xmgl.modules.baotou.plan.service.IPlanRecordService;
|
|||||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
import com.zhgd.xmgl.util.ListUtils;
|
import com.zhgd.xmgl.util.ListUtils;
|
||||||
import com.zhgd.xmgl.util.MapBuilder;
|
|
||||||
import com.zhgd.xmgl.util.PageUtil;
|
import com.zhgd.xmgl.util.PageUtil;
|
||||||
import com.zhgd.xmgl.util.RefUtil;
|
import com.zhgd.xmgl.util.RefUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -190,4 +189,8 @@ public class PlanPbsServiceImpl extends ServiceImpl<PlanPbsMapper, PlanPbs> impl
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlanPbs> getChildren(Long pbsId) {
|
||||||
|
return baseMapper.getChildren(pbsId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -327,6 +327,46 @@ public class PlanRecordServiceImpl extends ServiceImpl<PlanRecordMapper, PlanRec
|
|||||||
return feedbackPeriods1;
|
return feedbackPeriods1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlanFeedbackPeriod> getPlanSharesForCurve(Map<String, Object> param, PlanRecord record, List<PlanMilestone> milestones, PlanPeriod planPeriod, List<PlanRecord> planRecords, List<PlanRecord> children) {
|
||||||
|
String beginDate = MapUtils.getString(param, "periodStart");
|
||||||
|
String endDate = MapUtils.getString(param, "periodEnd");
|
||||||
|
List<PlanFeedbackPeriod> feedbackPeriods;
|
||||||
|
//判断是否最后一级wbs,是的话需要显示里程碑
|
||||||
|
children = ObjectUtil.cloneByStream(children);
|
||||||
|
children.add(record);
|
||||||
|
List<PlanRecord> trees = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(children)), "id", "parentId", "children"), PlanRecord.class);
|
||||||
|
Map<Date, PlanFeedbackPeriod> map = this.getChildFeedbackPeriodMap(trees.get(0), planRecords, milestones, planPeriod);
|
||||||
|
feedbackPeriods = new ArrayList<>(map.values());
|
||||||
|
if (CollUtil.isNotEmpty(feedbackPeriods)) {
|
||||||
|
if (StrUtil.isNotBlank(beginDate)) {
|
||||||
|
feedbackPeriods = feedbackPeriods.stream().filter(o -> DateUtil.compare(DateUtil.parseDate(beginDate), o.getPeriodEnd()) <= 0).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(endDate)) {
|
||||||
|
feedbackPeriods = feedbackPeriods.stream().filter(o -> DateUtil.compare(DateUtil.parseDate(endDate), o.getPeriodStart()) >= 0).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//去掉里程碑
|
||||||
|
for (PlanFeedbackPeriod period : feedbackPeriods) {
|
||||||
|
period.setMilestoneVals(new ArrayList<>());
|
||||||
|
}
|
||||||
|
//多的周期要删除,少的周期要添加
|
||||||
|
List<PlanFeedbackPeriod> feedbackPeriods1 = new ArrayList<>();
|
||||||
|
List<PlanFeedbackPeriod> myPeriods = this.getCalFeedbackPeriods(record);
|
||||||
|
for (PlanFeedbackPeriod myPeriod : myPeriods) {
|
||||||
|
Optional<PlanFeedbackPeriod> first = feedbackPeriods.stream().filter(o -> DateUtil.compare(o.getPeriodStart(), myPeriod.getPeriodStart()) == 0).findFirst();
|
||||||
|
PlanFeedbackPeriod planFeedbackPeriod;
|
||||||
|
if (first.isPresent()) {
|
||||||
|
planFeedbackPeriod = first.get();
|
||||||
|
} else {
|
||||||
|
planFeedbackPeriod = myPeriod;
|
||||||
|
}
|
||||||
|
feedbackPeriods1.add(planFeedbackPeriod);
|
||||||
|
}
|
||||||
|
feedbackPeriods1 = feedbackPeriods1.stream().sorted((o1, o2) -> o1.getPeriodStart().compareTo(o2.getPeriodStart())).collect(Collectors.toList());
|
||||||
|
return feedbackPeriods1;
|
||||||
|
}
|
||||||
|
|
||||||
private List<PlanFeedbackPeriod> getCalFeedbackPeriods(PlanRecord record) {
|
private List<PlanFeedbackPeriod> getCalFeedbackPeriods(PlanRecord record) {
|
||||||
String recordId = String.valueOf(record.getId());
|
String recordId = String.valueOf(record.getId());
|
||||||
List<PlanFeedbackPeriod> feedbackPeriods = new ArrayList<>();
|
List<PlanFeedbackPeriod> feedbackPeriods = new ArrayList<>();
|
||||||
|
|||||||
@ -122,7 +122,7 @@ public class EngineerControllerCheckServiceImpl extends ServiceImpl<EngineerCont
|
|||||||
e.setDetailedList(FlowUtil.getJSONString(map, "detailedList"));
|
e.setDetailedList(FlowUtil.getJSONString(map, "detailedList"));
|
||||||
e.setRemarks(FlowUtil.getString(map, "remarks"));
|
e.setRemarks(FlowUtil.getString(map, "remarks"));
|
||||||
e.setPreparingUnit(FlowUtil.getPullDownLong(map, "preparingUnit"));
|
e.setPreparingUnit(FlowUtil.getPullDownLong(map, "preparingUnit"));
|
||||||
e.setIssuingUnit(FlowUtil.getPullDownLong(map, "issuingUnit"));
|
e.setIssuingUnit(FlowUtil.getLong(map, "issuingUnit"));
|
||||||
e.setDate(FlowUtil.getDate(map, "date"));
|
e.setDate(FlowUtil.getDate(map, "date"));
|
||||||
e.setRegionalProjectTeam(FlowUtil.getPullDownLong(map, "regionalProjectTeam"));
|
e.setRegionalProjectTeam(FlowUtil.getPullDownLong(map, "regionalProjectTeam"));
|
||||||
e.setRegionalProjectTeamReceiptDate(FlowUtil.getDate(map, "regionalProjectTeamReceiptDate"));
|
e.setRegionalProjectTeamReceiptDate(FlowUtil.getDate(map, "regionalProjectTeamReceiptDate"));
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
|||||||
import com.zhgd.xmgl.util.FlowUtil;
|
import com.zhgd.xmgl.util.FlowUtil;
|
||||||
import com.zhgd.xmgl.util.PageUtil;
|
import com.zhgd.xmgl.util.PageUtil;
|
||||||
import com.zhgd.xmgl.util.RefUtil;
|
import com.zhgd.xmgl.util.RefUtil;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -70,18 +71,63 @@ public class WelderAssessmentRequestServiceImpl extends ServiceImpl<WelderAssess
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(WelderAssessmentRequest welderAssessmentRequest) {
|
public void add(WelderAssessmentRequest request) {
|
||||||
welderAssessmentRequest.setId(null);
|
request.setId(null);
|
||||||
baseMapper.insert(welderAssessmentRequest);
|
baseMapper.insert(request);
|
||||||
|
this.addSkillExam(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后台添加焊工技能考核评定登记表
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
*/
|
||||||
|
private void addSkillExam(WelderAssessmentRequest request) {
|
||||||
|
List<WorkerInfo> workerInfoList = workerInfoService.list(new LambdaQueryWrapper<WorkerInfo>()
|
||||||
|
.eq(WorkerInfo::getProjectSn, request.getProjectSn()));
|
||||||
|
if (StrUtil.isNotBlank(request.getAssessmentPersonnel())) {
|
||||||
|
JSONArray ja = JSON.parseArray(request.getAssessmentPersonnel());
|
||||||
|
for (int i = 0; i < ja.size(); i++) {
|
||||||
|
JSONObject jo = ja.getJSONObject(i);
|
||||||
|
JSONArray detail = jo.getJSONArray("field9890898665453");
|
||||||
|
for (int j = 0; j < detail.size(); j++) {
|
||||||
|
JSONObject jo1 = detail.getJSONObject(j);
|
||||||
|
//筛选合格的
|
||||||
|
if (!Objects.equals(FlowUtil.getInteger(jo1, "field1125873837893"), 1)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Optional<WorkerInfo> op = workerInfoList.stream().filter(o -> o.getId().equals(MapUtils.getLong(jo, "field5383524265804"))).findFirst();
|
||||||
|
if (op.isPresent()) {
|
||||||
|
WorkerInfo workerInfo = op.get();
|
||||||
|
WelderSkillExam wse = new WelderSkillExam();
|
||||||
|
wse.setProjectSn(request.getProjectSn());
|
||||||
|
wse.setWelderName(workerInfo.getWorkerName());
|
||||||
|
wse.setGender(Objects.equals(workerInfo.getSex(), 1) ? "男" : "女");
|
||||||
|
wse.setWelderCertificateNumber(jo.getString("field1723198628254"));
|
||||||
|
wse.setWelderCertificateQualificationItem(jo1.getString("field1494098725099"));
|
||||||
|
wse.setOriginalCertificateValidityPeriod(jo.getString("field5004498659255"));
|
||||||
|
wse.setWelderWorkPermitNumber(jo.getString("field4547398747381"));
|
||||||
|
wse.setWelderAssessmentItem(jo1.getString("field4501024932536"));
|
||||||
|
wse.setOnSiteAssessmentDate(DateUtil.formatDate(DateUtil.parse(jo1.getString("field7688098758155"))));
|
||||||
|
wse.setAssessmentResult("合格");
|
||||||
|
wse.setRequestId(request.getId());
|
||||||
|
welderSkillExamService.add(wse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void edit(WelderAssessmentRequest welderAssessmentRequest) {
|
public void edit(WelderAssessmentRequest request) {
|
||||||
WelderAssessmentRequest oldWelderAssessmentRequest = baseMapper.selectById(welderAssessmentRequest.getId());
|
WelderAssessmentRequest oldWelderAssessmentRequest = baseMapper.selectById(request.getId());
|
||||||
if (oldWelderAssessmentRequest == null) {
|
if (oldWelderAssessmentRequest == null) {
|
||||||
throw new OpenAlertException("未找到对应实体");
|
throw new OpenAlertException("未找到对应实体");
|
||||||
}
|
}
|
||||||
baseMapper.updateById(welderAssessmentRequest);
|
baseMapper.updateById(request);
|
||||||
|
welderSkillExamService.remove(new LambdaQueryWrapper<WelderSkillExam>()
|
||||||
|
.eq(WelderSkillExam::getRequestId, request.getId()));
|
||||||
|
this.addSkillExam(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,6 +137,8 @@ public class WelderAssessmentRequestServiceImpl extends ServiceImpl<WelderAssess
|
|||||||
throw new OpenAlertException("未找到对应实体");
|
throw new OpenAlertException("未找到对应实体");
|
||||||
}
|
}
|
||||||
baseMapper.deleteById(id);
|
baseMapper.deleteById(id);
|
||||||
|
welderSkillExamService.remove(new LambdaQueryWrapper<WelderSkillExam>()
|
||||||
|
.eq(WelderSkillExam::getRequestId, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -149,6 +197,7 @@ public class WelderAssessmentRequestServiceImpl extends ServiceImpl<WelderAssess
|
|||||||
wse.setWelderAssessmentItem(jo1.getString("field4501024932536"));
|
wse.setWelderAssessmentItem(jo1.getString("field4501024932536"));
|
||||||
wse.setOnSiteAssessmentDate(DateUtil.formatDate(DateUtil.parse(jo1.getString("field7688098758155"))));
|
wse.setOnSiteAssessmentDate(DateUtil.formatDate(DateUtil.parse(jo1.getString("field7688098758155"))));
|
||||||
wse.setAssessmentResult("合格");
|
wse.setAssessmentResult("合格");
|
||||||
|
wse.setRequestId(e.getId());
|
||||||
welderSkillExamService.add(wse);
|
welderSkillExamService.add(wse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +218,14 @@ public class WelderAssessmentRequestServiceImpl extends ServiceImpl<WelderAssess
|
|||||||
JSONArray ja1 = ja.getJSONObject(i).getJSONArray("field9890898665453");
|
JSONArray ja1 = ja.getJSONObject(i).getJSONArray("field9890898665453");
|
||||||
count++;
|
count++;
|
||||||
for (int j = 0; j < ja1.size(); j++) {
|
for (int j = 0; j < ja1.size(); j++) {
|
||||||
if (Objects.equals(ja1.getJSONObject(j).getJSONArray("field1125873837893").getInteger(0), 1)) {
|
JSONObject jsonObject = ja1.getJSONObject(j);
|
||||||
|
Integer isPass;
|
||||||
|
if (jsonObject.get("field1125873837893") instanceof List) {
|
||||||
|
isPass = jsonObject.getJSONArray("field1125873837893").getInteger(0);
|
||||||
|
} else {
|
||||||
|
isPass = jsonObject.getInteger("field1125873837893");
|
||||||
|
}
|
||||||
|
if (Objects.equals(isPass, 1)) {
|
||||||
pass++;
|
pass++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ public class BaseMenu implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Excel(name = "优先级 越小越靠前", width = 15)
|
@Excel(name = "优先级 越小越靠前", width = 15)
|
||||||
@ApiModelProperty(value = "优先级 越小越靠前")
|
@ApiModelProperty(value = "优先级 越小越靠前")
|
||||||
private java.lang.Integer priority;
|
private java.lang.Double priority;
|
||||||
/**
|
/**
|
||||||
* 状态:0-禁用 1-启用
|
* 状态:0-禁用 1-启用
|
||||||
*/
|
*/
|
||||||
@ -104,7 +104,7 @@ public class BaseMenu implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "是否APP端显示该模块,1是,2否")
|
@ApiModelProperty(value = "是否APP端显示该模块,1是,2否")
|
||||||
private java.lang.Integer appShow;
|
private java.lang.Integer appShow;
|
||||||
|
|
||||||
@ApiModelProperty(value = "常用图标")
|
@ApiModelProperty(value = "常用图标")
|
||||||
private java.lang.String commonIcon;
|
private java.lang.String commonIcon;
|
||||||
|
|
||||||
|
|||||||
@ -179,7 +179,7 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
|||||||
@Override
|
@Override
|
||||||
public void saveBaseMenu(BaseMenu baseMenu) {
|
public void saveBaseMenu(BaseMenu baseMenu) {
|
||||||
if (baseMenu.getPriority() == null) {
|
if (baseMenu.getPriority() == null) {
|
||||||
baseMenu.setPriority(0);
|
baseMenu.setPriority(0D);
|
||||||
}
|
}
|
||||||
if (baseMenu.getStatus() == null) {
|
if (baseMenu.getStatus() == null) {
|
||||||
baseMenu.setStatus(1);
|
baseMenu.setStatus(1);
|
||||||
@ -196,7 +196,7 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
|||||||
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
throw new OpenAlertException(MessageUtil.get("notFindErr"));
|
||||||
}
|
}
|
||||||
if (baseMenu.getPriority() == null) {
|
if (baseMenu.getPriority() == null) {
|
||||||
baseMenu.setPriority(0);
|
baseMenu.setPriority(0D);
|
||||||
}
|
}
|
||||||
baseMenuMapper.updateById(baseMenu);
|
baseMenuMapper.updateById(baseMenu);
|
||||||
// 同步权限表里的信息
|
// 同步权限表里的信息
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
|
|||||||
import com.zhgd.mqtt.server.IMqttSender;
|
import com.zhgd.mqtt.server.IMqttSender;
|
||||||
import com.zhgd.redis.lock.RedisRepository;
|
import com.zhgd.redis.lock.RedisRepository;
|
||||||
import com.zhgd.xmgl.async.AsyncTower;
|
import com.zhgd.xmgl.async.AsyncTower;
|
||||||
|
import com.zhgd.xmgl.constant.Cts;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
import com.zhgd.xmgl.modules.basicdata.enums.SystemUserAccountTypeEnum;
|
import com.zhgd.xmgl.modules.basicdata.enums.SystemUserAccountTypeEnum;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||||
@ -27,10 +28,7 @@ import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
|
|||||||
import com.zhgd.xmgl.modules.project.enums.ProjectVideoConfigVideoTypeEnum;
|
import com.zhgd.xmgl.modules.project.enums.ProjectVideoConfigVideoTypeEnum;
|
||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectDevStatisticsMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectDevStatisticsMapper;
|
||||||
import com.zhgd.xmgl.modules.project.service.IProjectVideoConfigService;
|
import com.zhgd.xmgl.modules.project.service.IProjectVideoConfigService;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.*;
|
||||||
import com.zhgd.xmgl.util.RefUtil;
|
|
||||||
import com.zhgd.xmgl.util.TimeUtil;
|
|
||||||
import com.zhgd.xmgl.util.YsVideoUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -471,7 +469,8 @@ public class TowerServiceImpl extends ServiceImpl<TowerMapper, Tower> implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void offlineAlarm(Tower offlineTower) {
|
public void offlineAlarm(Tower offlineTower) {
|
||||||
List<SystemUser> systemUserList = systemUserService.list(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getSn, offlineTower.getProjectSn()));
|
// List<SystemUser> systemUserList = systemUserService.list(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getSn, offlineTower.getProjectSn()));
|
||||||
|
List<SystemUser> systemUserList = systemUserService.getSystemUsersBySn(new MapBuilder<String, Object>().put(Cts.SN, offlineTower.getProjectSn()).put(Cts.QUERY_TYPE, Cts.PROJECT_LEVEL).build());
|
||||||
log.debug("要推送-----" + (systemUserList == null ? 0 : systemUserList.size()) + "个人员 塔吊离线通知消息");
|
log.debug("要推送-----" + (systemUserList == null ? 0 : systemUserList.size()) + "个人员 塔吊离线通知消息");
|
||||||
asyncTower.sendOfflineAlarm(systemUserList, offlineTower, "有塔吊超过5分钟无数据,请注意。位置:" + offlineTower.getDevName(), "塔吊超过5分钟离线通知", "/pages");
|
asyncTower.sendOfflineAlarm(systemUserList, offlineTower, "有塔吊超过5分钟无数据,请注意。位置:" + offlineTower.getDevName(), "塔吊超过5分钟离线通知", "/pages");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.zhgd.xmgl.modules.exam.controller;
|
package com.zhgd.xmgl.modules.exam.controller;
|
||||||
|
|
||||||
import cn.afterturn.easypoi.word.WordExportUtil;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
@ -37,7 +36,6 @@ import io.swagger.annotations.ApiImplicitParams;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -47,8 +45,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -251,7 +247,7 @@ public class ExamWorkerController {
|
|||||||
String tempUrl = Fileutils.getExportTemplateFile("template/下载试卷模板.docx").getAbsolutePath();
|
String tempUrl = Fileutils.getExportTemplateFile("template/下载试卷模板.docx").getAbsolutePath();
|
||||||
// String tempUrl = "C:\\Users\\Administrator\\Desktop\\下载试卷模板.docx";
|
// String tempUrl = "C:\\Users\\Administrator\\Desktop\\下载试卷模板.docx";
|
||||||
//生成word文档流
|
//生成word文档流
|
||||||
EasyPoiUtil.exportNewLineWord(response, params, FileUtil.file(tempUrl));
|
EasyPoiUtil.exportNewLineWordAndPicForExam(response, params, FileUtil.file(tempUrl));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("导出试卷出现异常", e);
|
log.error("导出试卷出现异常", e);
|
||||||
@ -417,17 +413,17 @@ public class ExamWorkerController {
|
|||||||
JSONArray ja = JSON.parseArray(question.getPic());
|
JSONArray ja = JSON.parseArray(question.getPic());
|
||||||
if (CollUtil.isNotEmpty(ja)) {
|
if (CollUtil.isNotEmpty(ja)) {
|
||||||
//保存图片占位符
|
//保存图片占位符
|
||||||
// try {
|
try {
|
||||||
// String imageKey = "image" + i[0];
|
String imageKey = "image" + i[0];
|
||||||
// String url = ja.getJSONObject(0).getString("url");
|
String url = ja.getJSONObject(0).getString("url");
|
||||||
// String dest = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + "." + StrUtil.subAfter(url, ".", true);
|
String dest = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + "." + StrUtil.subAfter(url, ".", true);
|
||||||
// HttpUtil.downloadFile(url, dest);
|
HttpUtil.downloadFile(url, dest);
|
||||||
// imageMap.put(imageKey, EasyPoiUtil.imgFormatting(dest, 18, 18));
|
imageMap.put(imageKey, EasyPoiUtil.imgFormatting(dest, 18, 18));
|
||||||
// content.append("##" + imageKey + "##");
|
content.append("##" + imageKey + "##");
|
||||||
// params.put(imageKey, imageMap.get(imageKey));
|
params.put(imageKey, imageMap.get(imageKey));
|
||||||
// } catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// log.error("导出word添加题目和选项错误", e);
|
log.error("导出word添加题目和选项错误", e);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String selectOption = question.getSelectOption();
|
String selectOption = question.getSelectOption();
|
||||||
@ -442,8 +438,15 @@ public class ExamWorkerController {
|
|||||||
}
|
}
|
||||||
content.append(" ");
|
content.append(" ");
|
||||||
List<ExamQuestionOption> optionList = question.getOptionList();
|
List<ExamQuestionOption> optionList = question.getOptionList();
|
||||||
|
//判断选项过长需要换行
|
||||||
|
boolean newLine = optionList.stream().anyMatch(o -> (o.getOptionCode() + "、" + o.getOptionDesc()).length() > 26);
|
||||||
|
boolean first = true;
|
||||||
//遍历选项
|
//遍历选项
|
||||||
for (ExamQuestionOption option : optionList) {
|
for (ExamQuestionOption option : optionList) {
|
||||||
|
if (newLine && !first) {
|
||||||
|
content.append("\n ");
|
||||||
|
}
|
||||||
|
first = false;
|
||||||
content.append(option.getOptionCode()).append("、").append(option.getOptionDesc()).append(" ");
|
content.append(option.getOptionCode()).append("、").append(option.getOptionDesc()).append(" ");
|
||||||
}
|
}
|
||||||
content.append("\n");
|
content.append("\n");
|
||||||
|
|||||||
@ -37,8 +37,7 @@ public class FiletransferServiceImpl implements IFiletransferService {
|
|||||||
private ProjectFileAuthMapper projectFileAuthMapper;
|
private ProjectFileAuthMapper projectFileAuthMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void
|
public void uploadFile(HttpServletRequest request, UploadFileDTO uploadFileDTO) {
|
||||||
uploadFile(HttpServletRequest request, UploadFileDTO uploadFileDTO) {
|
|
||||||
UploadFile uploadFile = new UploadFile();
|
UploadFile uploadFile = new UploadFile();
|
||||||
uploadFile.setChunkNumber(uploadFileDTO.getChunkNumber());
|
uploadFile.setChunkNumber(uploadFileDTO.getChunkNumber());
|
||||||
uploadFile.setChunkSize(uploadFileDTO.getChunkSize());
|
uploadFile.setChunkSize(uploadFileDTO.getChunkSize());
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||||
import com.zhgd.xmgl.async.AsyncCommon;
|
import com.zhgd.xmgl.async.AsyncCommon;
|
||||||
|
import com.zhgd.xmgl.constant.Cts;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
|
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.DictionariesRecordMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.DictionariesRecordMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
|
||||||
@ -187,7 +188,7 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
|
|||||||
|
|
||||||
private void checkBindOther(VideoItem videoItem) {
|
private void checkBindOther(VideoItem videoItem) {
|
||||||
Long itemId = videoItem.getItemId();
|
Long itemId = videoItem.getItemId();
|
||||||
List<CarCamera> carCameras = carCameraMapper.selectList(new LambdaQueryWrapper<CarCamera>().eq(CarCamera::getAirtightVideoItemId, itemId).or().eq(CarCamera::getWashVideoItemId, itemId));
|
List<CarCamera> carCameras = carCameraMapper.selectList(new LambdaQueryWrapper<CarCamera>().eq(CarCamera::getAirtightVideoItemId, itemId).or().eq(CarCamera::getWashVideoItemId, itemId).last(Cts.IGNORE_DATA_SCOPE_CONDITION));
|
||||||
if (CollectionUtils.isNotEmpty(carCameras)) {
|
if (CollectionUtils.isNotEmpty(carCameras)) {
|
||||||
throw new OpenAlertException("删除失败,请先解绑车辆相机");
|
throw new OpenAlertException("删除失败,请先解绑车辆相机");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,102 +22,92 @@ import java.net.URLEncoder;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class EasyPoiUtil {
|
public class EasyPoiUtil {
|
||||||
// /**
|
/**
|
||||||
// * 导出word和图片
|
* 导出word和图片
|
||||||
// *
|
*
|
||||||
// * @param response
|
* @param response
|
||||||
// * @param params
|
* @param params
|
||||||
// * @param file
|
* @param file
|
||||||
// * @throws Exception
|
* @throws Exception
|
||||||
// */
|
*/
|
||||||
// public static void exportNewLineWordAndPic(HttpServletResponse response, Map<String, Object> params, File file) {
|
public static void exportNewLineWordAndPicForExam(HttpServletResponse response, Map<String, Object> params, File file) {
|
||||||
// XWPFDocument doc = null;
|
XWPFDocument doc = null;
|
||||||
// FileOutputStream tempFos = null;
|
FileOutputStream tempFos = null;
|
||||||
// try {
|
try {
|
||||||
// //导出临时文件
|
//导出临时文件
|
||||||
// doc = WordExportUtil.exportWord07(URLDecoder.decode(file.getPath(), "UTF-8"), params);
|
doc = WordExportUtil.exportWord07(URLDecoder.decode(file.getPath(), "UTF-8"), params);
|
||||||
// WordUtils.addBreakInCellForExam(doc.getParagraphs());
|
WordUtils.addBreakInCellForExam(doc.getParagraphs());
|
||||||
//
|
|
||||||
// //把######改成占位符{{}}
|
//把######改成占位符{{}}
|
||||||
// List<XWPFParagraph> paragraphs = doc.getParagraphs();
|
List<XWPFParagraph> paragraphs = doc.getParagraphs();
|
||||||
// Iterator<XWPFParagraph> itPara = paragraphs.iterator();
|
Iterator<XWPFParagraph> itPara = paragraphs.iterator();
|
||||||
// while (itPara.hasNext()) {
|
while (itPara.hasNext()) {
|
||||||
// XWPFParagraph paragraph = (XWPFParagraph) itPara.next();
|
XWPFParagraph paragraph = (XWPFParagraph) itPara.next();
|
||||||
// List<XWPFRun> run = paragraph.getRuns();
|
List<XWPFRun> run = paragraph.getRuns();
|
||||||
// for (int i = 0; i < run.size(); i++) {
|
for (int i = 0; i < run.size(); i++) {
|
||||||
// XWPFRun xwpfRun = run.get(i);
|
XWPFRun xwpfRun = run.get(i);
|
||||||
// String text = xwpfRun.getText(xwpfRun.getTextPosition());
|
String text = xwpfRun.getText(xwpfRun.getTextPosition());
|
||||||
// if (text.contains("##")) {
|
if (text.contains("##")) {
|
||||||
// String replacedText = text.replaceAll("##(.*?)##", "{{}}{{$1}}{{}}");
|
String replacedText = text.replaceAll("##(.*?)##", "{{}}{{$1}}{{}}");
|
||||||
//// xwpfRun.setText(replacedText,0);
|
// 清空当前 run 的文本
|
||||||
//// // 为剩余行创建新的 XWPFRun
|
xwpfRun.setText("", 0);
|
||||||
//// for (int j = 1; j < lines.length; j++) {
|
|
||||||
//// XWPFRun newRun = paragraph.insertNewRun(i + j); // 插入新的 XWPFRun
|
// 将替换后的文本拆分为多个部分,并设置蓝色字体
|
||||||
//// newRun.setText("{{}}"); // 设置新行的文本
|
String[] parts = replacedText.split("(?=\\{\\{)|(?<=\\}\\})");
|
||||||
//// // 复制原始 XWPFRun 的样式到新的 XWPFRun
|
for (String part : parts) {
|
||||||
//// newRun.setBold(run.isBold());
|
XWPFRun newRun = paragraph.insertNewRun(i++); // 插入新的 run
|
||||||
//// newRun.setItalic(run.isItalic());
|
newRun.setText(part);
|
||||||
//// newRun.setFontSize(run.getFontSize());
|
newRun.setFontSize(10);
|
||||||
//// newRun.setFontFamily(run.getFontFamily());
|
newRun.setFontFamily("宋体");
|
||||||
//// }
|
if (part.equals("{{}}")) {
|
||||||
// // 清空当前 run 的文本
|
newRun.setColor("0000FF"); // 设置蓝色字体
|
||||||
// xwpfRun.setText("", 0);
|
}
|
||||||
//
|
}
|
||||||
// // 将替换后的文本拆分为多个部分,并设置蓝色字体
|
}
|
||||||
// String[] parts = replacedText.split("(?=\\{\\{)|(?<=\\}\\})");
|
}
|
||||||
// for (String part : parts) {
|
}
|
||||||
// XWPFRun newRun = paragraph.insertNewRun(i++); // 插入新的 run
|
String tempName = IdUtil.randomUUID() + ".docx";
|
||||||
// newRun.setText(part);
|
String tempPath = PathUtil.getBasePath() + "/temp/" + tempName;
|
||||||
// if (part.equals("{{}}")) {
|
tempFos = new FileOutputStream(tempPath);
|
||||||
// newRun.setColor("0000FF"); // 设置蓝色字体
|
doc.write(tempFos);
|
||||||
// }
|
tempFos.close();
|
||||||
// }
|
doc.close();
|
||||||
// }
|
|
||||||
// }
|
//导出response
|
||||||
// }
|
doc = WordExportUtil.exportWord07(URLDecoder.decode(tempPath, "UTF-8"), params);
|
||||||
// String tempName = IdUtil.randomUUID() + ".docx";
|
//设置响应体内容类型
|
||||||
// String tempPath = PathUtil.getBasePath() + "/temp/" + tempName;
|
response.setContentType("application/octet-stream");
|
||||||
// tempFos = new FileOutputStream(tempPath);
|
//添加响应头
|
||||||
// doc.write(tempFos);
|
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("下载试卷.docx", "UTF-8"));
|
||||||
// tempFos.close();
|
//暴露新添加的响应头
|
||||||
// doc.close();
|
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
//
|
//将word文档流输出到输出流中
|
||||||
// //导出response
|
doc.write(response.getOutputStream());
|
||||||
// doc = WordExportUtil.exportWord07(URLDecoder.decode(tempPath, "UTF-8"), params);
|
//关闭流
|
||||||
// //设置响应体内容类型
|
doc.close();
|
||||||
// response.setContentType("application/octet-stream");
|
// FileUtil.del(tempPath);
|
||||||
// //添加响应头
|
} catch (Exception e) {
|
||||||
// response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("下载试卷.docx", "UTF-8"));
|
log.error("exportNewLineWord:", e);
|
||||||
// //暴露新添加的响应头
|
} finally {
|
||||||
// response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
if (doc != null) {
|
||||||
// //将word文档流输出到输出流中
|
try {
|
||||||
// doc.write(response.getOutputStream());
|
doc.close();
|
||||||
// //关闭流
|
} catch (IOException e) {
|
||||||
// doc.close();
|
e.printStackTrace();
|
||||||
//// FileUtil.del(tempPath);
|
}
|
||||||
// } catch (Exception e) {
|
}
|
||||||
// log.error("exportNewLineWord:", e);
|
if (tempFos != null) {
|
||||||
// } finally {
|
try {
|
||||||
// if (doc != null) {
|
tempFos.close();
|
||||||
// try {
|
} catch (IOException e) {
|
||||||
// doc.close();
|
e.printStackTrace();
|
||||||
// } catch (IOException e) {
|
}
|
||||||
// e.printStackTrace();
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// if (tempFos != null) {
|
|
||||||
// try {
|
|
||||||
// tempFos.close();
|
|
||||||
// } catch (IOException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出word
|
* 导出word
|
||||||
|
|||||||
@ -103,6 +103,10 @@ public class FlowUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Long getLong(Map map, String key) {
|
||||||
|
return MapUtils.getLong(map, key);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getPullDownManyStr(Map map, String key) {
|
public static String getPullDownManyStr(Map map, String key) {
|
||||||
return Optional.ofNullable(map.get(key)).map(o -> "".equals(o) ? null : StrUtil.join(",", o)).orElse(null);
|
return Optional.ofNullable(map.get(key)).map(o -> "".equals(o) ? null : StrUtil.join(",", o)).orElse(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,29 +89,32 @@ public class WordUtils {
|
|||||||
public static void addBreakInCellForExam(List<XWPFParagraph> paragraphs) {
|
public static void addBreakInCellForExam(List<XWPFParagraph> paragraphs) {
|
||||||
for (XWPFParagraph p : paragraphs) {
|
for (XWPFParagraph p : paragraphs) {
|
||||||
List<XWPFRun> runs = p.getRuns();
|
List<XWPFRun> runs = p.getRuns();
|
||||||
for (int i = 0; i < runs.size(); i++) {
|
if (runs.size() > 0) {
|
||||||
XWPFRun run = runs.get(i);
|
XWPFRun run = runs.get(0);
|
||||||
String text = run.getText(0); // 获取完整文本
|
String text = run.getText(0); // 获取完整文本
|
||||||
if (text != null && text.contains("\n")) {
|
if (text != null && text.contains("\n")) {
|
||||||
String[] lines = text.split("\n");
|
String[] lines = text.split("\n");
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
// 设置第一行文本
|
// 设置第一行文本
|
||||||
run.setText(lines[0], 0);
|
run.setText(lines[0], 0);
|
||||||
|
run.addBreak(); // 添加换行符
|
||||||
// 为剩余行创建新的 XWPFRun
|
// 为剩余行创建新的 XWPFRun
|
||||||
for (int j = 1; j < lines.length; j++) {
|
for (int j = 1; j < lines.length; j++) {
|
||||||
run.addBreak(); // 添加换行符
|
XWPFRun newRun = p.insertNewRun(j); // 插入新的 XWPFRun
|
||||||
XWPFRun newRun = p.insertNewRun(i + j); // 插入新的 XWPFRun
|
|
||||||
newRun.setText(lines[j]); // 设置新行的文本
|
newRun.setText(lines[j]); // 设置新行的文本
|
||||||
// 复制原始 XWPFRun 的样式到新的 XWPFRun
|
// 复制原始 XWPFRun 的样式到新的 XWPFRun
|
||||||
newRun.setBold(run.isBold());
|
newRun.setBold(run.isBold());
|
||||||
newRun.setItalic(run.isItalic());
|
newRun.setItalic(run.isItalic());
|
||||||
newRun.setFontSize(10);
|
newRun.setFontSize(10);
|
||||||
newRun.setFontFamily("宋体");
|
newRun.setFontFamily("宋体");
|
||||||
|
if (j != lines.length - 1) {
|
||||||
|
newRun.addBreak();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{{t1}}
|
{{t1}}
|
||||||
{{c1}}
|
{{c1}}
|
||||||
{{t2}}
|
{{t2}}
|
||||||
{{c2}}
|
{{c2}}
|
||||||
{{t3}}
|
{{t3}}
|
||||||
{{c3}}
|
{{c3}}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user