Browse Source

新增票据模板浏览及站点编号唯一效验

zhongwei
段飞宇 1 year ago
parent
commit
f7d13453dd
  1. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java
  2. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
  3. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
  4. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
  5. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
  6. 0
      hzims-service/hzims-middle/src/main/resources/db/1.0.0.sql
  7. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  8. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java
  9. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  10. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  11. 20
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/controller/TicketMatterGroupController.java
  12. 10
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/ITicketMatterGroupService.java
  13. 375
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java
  14. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java
  15. 10
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java
  16. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  17. 0
      hzims-service/ticket/src/main/resources/db/1.0.0.sql

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java

@ -47,7 +47,7 @@ public class DefectProcessServiceImpl extends ProcessAbstractService {
log.info("已执行消缺工作流程环节操作~~~~");
return true;
}
log.error("未是否执行消缺工作流流程环节操作,请联系管理员~~~~");
log.error("未执行消缺工作流流程环节操作,请联系管理员~~~~");
return false;
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java

@ -50,7 +50,7 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
log.info("已执行水力机械工作票流程环节操作~~~~");
return true;
}
log.error("未是否执行水力机械工作票流程环节操作,请联系管理员~~~~");
log.error("未执行水力机械工作票流程环节操作,请联系管理员~~~~");
return false;
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java

@ -47,7 +47,7 @@ public class MaintenanceProcessServiceImpl extends ProcessAbstractService {
log.info("已执行日常维护流程环节操作~~~~");
return true;
}
log.error("未是否执行日常维护流程环节操作,请联系管理员~~~~");
log.error("未执行日常维护流程环节操作,请联系管理员~~~~");
return false;
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java

@ -55,7 +55,7 @@ public class OneTicketProcessServiceImpl extends ProcessAbstractService {
log.info("已执行工作票流程环节操作~~~~");
return true;
}
log.error("未是否执行工作票流程环节操作,请联系管理员~~~~");
log.error("未执行工作票流程环节操作,请联系管理员~~~~");
return false;
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java

@ -51,7 +51,7 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
log.info("已执行操作票流程环节操作~~~~");
return true;
}
log.error("未是否执行操作票流程环节操作,请联系管理员~~~~");
log.error("未执行操作票流程环节操作,请联系管理员~~~~");
return false;
}

0
hzims-service/hzims-middle/src/main/resources/db/newsql.sql → hzims-service/hzims-middle/src/main/resources/db/1.0.0.sql

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.maintenance.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@ -128,7 +129,10 @@ public class MaintenanceServiceImpl implements MaintenanceService {
OperMaintenanceTaskEntityVo standardTicketInfoVo = null;
try {
JSONObject jsonObject = JSONObject.parseObject(formData);
standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class);
standardTicketInfoVo = JSONObject.parseObject(jsonObject.getString("operMaintenanceTaskEntityVo"),
new TypeReference<OperMaintenanceTaskEntityVo>(){});
// standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo");
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class);
} catch (Exception e) {
log.error("获取表单出现异常了~~~~");
throw new IllegalArgumentException(e.getMessage());
@ -220,6 +224,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
/**
* 填充日常维护信息
*
* @param entity
* @param response
*/
@ -228,7 +233,9 @@ public class MaintenanceServiceImpl implements MaintenanceService {
//如果response.getHandleType() 是0使用户
entity.setFlowUserId(response.getUserId());
entity.setNextStepOperator(response.getNextStepOperator());
if (response.getNextStepOperator() != null) {
flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(response.getNextStepOperator()).concat("审批");
}
//如果taskId为空
String taskId = response.getTaskId();
if (StringUtils.isEmpty(taskId)) {
@ -319,7 +326,6 @@ public class MaintenanceServiceImpl implements MaintenanceService {
}
/**
* 开启一个流程实例
*
@ -344,10 +350,9 @@ public class MaintenanceServiceImpl implements MaintenanceService {
}
/**
* 推送日常维护任务消息
*
* @return void
* @Param taskEntity 日常维护任务
**/

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationController.java

@ -13,6 +13,7 @@ import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.StationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
@ -200,6 +201,7 @@ public class StationController extends BladeController {
List<StationEntity> list = mainSystemMonitoringService.classifyUserDataScopeType(null, null, Func.toStrList(type));*/
return R.data(list);
}
@ApiLog
@GetMapping("/getHomeStationList")
@ApiOperationSupport(order = 91)
@ -216,4 +218,15 @@ public class StationController extends BladeController {
return R.data(stationService.select(type, serveType));
}
/**
* 两票编号抬头唯一效验
*/
@ApiModelProperty("两票编号抬头唯一效验")
@GetMapping("/uniqueStationByStation")
public R uniqueStationByStation(@RequestParam(value = "signage") String signage) {
stationService.uniqueStationByStation(signage);
return R.success("两票编号抬头不存在,可以创建");
}
}

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -125,4 +125,13 @@ public interface IStationService extends BaseService<StationEntity> {
* @return 站点
*/
StationEntity getOne(StationEntity request);
/**
* 两票编号抬头唯一效验
* @param signage 站点编号
* @return
*/
void uniqueStationByStation(String signage);
}

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -692,4 +692,21 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
// stationEntityList.stream().map(StationEntity::getCode).forEach(code -> projectClient.delete());
// }
}
/**
* 两票编号抬头唯一效验
*
* @param signage 站点编号
* @return
*/
@Override
public void uniqueStationByStation(String signage) {
LambdaQueryWrapper<StationEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationEntity::getSignage, signage);
Integer count = baseMapper.selectCount(queryWrapper);
if (count > 0){
throw new ServiceException("两票编号抬头已存在");
}
}
}

20
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/controller/TicketMatterGroupController.java

@ -13,10 +13,7 @@ import com.hnac.hzims.ticket.library.vo.TicketMatterGroupVO;
import com.hnac.hzims.ticket.library.wrapper.TicketMatterGroupWrapper;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
@ -114,4 +111,19 @@ public class TicketMatterGroupController extends BladeController {
public void preview(@RequestParam("id") Long id, @RequestParam("type") String type , HttpServletResponse response) throws Exception {
service.preview(id, type, response);
}
/**
* 票据模板预览
*/
@GetMapping(value = "/newPreview/{id}/{type}/{status}")
@ApiOperationSupport(order = 70)
@ApiOperation(value = "票据模板预览")
public void newPreview(@ApiParam(name = "id",value = "编号") @PathVariable Long id,
@ApiParam(name = "type",value = "模板类型:2为工作票;1为操作票") @PathVariable Integer type,
@ApiParam(name = "status",value = "具体的模板") @PathVariable Integer status,
HttpServletResponse response){
service.newPreview(id, type,status, response);
}
}

10
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/ITicketMatterGroupService.java

@ -52,4 +52,14 @@ public interface ITicketMatterGroupService extends BaseService<TicketMatterGroup
* @param id
*/
void preview(Long id, String type, HttpServletResponse response) throws Exception;
/**
* 票据模板预览
* @param id 编号
* @param type 模板类型2为工作票1为操作票
* @param status 模板状态
* @param response
*/
void newPreview(Long id, Integer type, Integer status, HttpServletResponse response);
}

375
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java

@ -1,53 +1,60 @@
package com.hnac.hzims.ticket.library.service.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.constants.WorkTicketConstants;
import com.hnac.hzims.ticket.library.dto.TicketMatterGroupDTO;
import com.hnac.hzims.ticket.library.entity.TicketMatterGroupEntity;
import com.hnac.hzims.ticket.library.mapper.TicketMatterGroupMapper;
import com.hnac.hzims.ticket.library.service.ITicketMatterGroupService;
import com.hnac.hzims.ticket.library.vo.TicketMatterGroupVO;
import com.hnac.hzims.ticket.library.wrapper.TicketMatterGroupWrapper;
import com.hnac.hzims.ticket.standardTicket.service.OperationTicketService;
import com.hnac.hzims.ticket.standardTicket.utils.OperationWordHelper;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant;
import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger;
import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.utils.WordHelper;
import com.hnac.hzims.ticket.twoTicket.utils.WordMapUtils;
import com.hnac.hzims.ticket.twoTicket.vo.operation.StandardTicketInfoVo;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import com.hnac.hzims.ticket.utils.ExcelUtil;
import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.utils.WordUtils;
import com.hnac.hzims.ticket.workTicket.entity.TwoTicketMatterLibraryEntity;
import com.hnac.hzims.ticket.workTicket.entity.*;
import com.hnac.hzims.ticket.workTicket.service.ITwoTicketMatterLibraryService;
import com.hnac.hzims.ticket.workTicket.vo.*;
import com.hnac.hzims.ticket.workTicket.wrapper.TwoTicketMatterLibraryWrapper;
import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfCopy;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfWriter;
import com.spire.pdf.PdfNewDocument;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.http.entity.ContentType;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.oss.OssTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -71,6 +78,12 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
private final ITwoTicketMatterLibraryService twoTicketMatterLibraryService;
private final OperationTicketService operationTicketService;
private final TicketProcessService ticketProcessService;
@Override
public R<IPage<TicketMatterGroupVO>> queryList(TicketMatterGroupDTO req, Query query) {
LambdaQueryWrapper<TicketMatterGroupEntity> queryWrapper = this.getQueryWrapper(req);
@ -94,11 +107,9 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
libraryMap.forEach((type, list) -> {
if (ONE_TYPE.equals(type)) {
groupVO.setMatterLibraryListOne(TwoTicketMatterLibraryWrapper.build().listVO(list));
}
else if(TWO_TYPE.equals(type)){
} else if (TWO_TYPE.equals(type)) {
groupVO.setMatterLibraryListTwo(TwoTicketMatterLibraryWrapper.build().listVO(list));
}
else if(THREE_TYPE.equals(type)){
} else if (THREE_TYPE.equals(type)) {
groupVO.setMatterLibraryListThree(TwoTicketMatterLibraryWrapper.build().listVO(list));
}
});
@ -189,8 +200,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
//若为工作票
try {
params = this.completeWorkTicketData(new WorkTicketInfoVO());
}
catch(Exception e){
} catch (Exception e) {
throw new ServiceException("对象转换失败");
}
TicketMatterGroupVO groupVO = groupVOR.getData();
@ -206,8 +216,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
//第二种工作票
params.put("measures", libraryEntityList.stream().map(TwoTicketMatterLibraryEntity::getSafetyMeasure).collect(Collectors.joining(",")));
params.put("workTicketContentDtoList", Lists.newArrayList());
}
else if(TicketConstants.WordFileNameEnum.MECHANICAL_WORK.getType().equals(groupVO.getTicketType())) {
} else if (TicketConstants.WordFileNameEnum.MECHANICAL_WORK.getType().equals(groupVO.getTicketType())) {
//机械工作票
List<Map<String, Object>> mapList = libraryEntityList.stream().map(measure -> {
Map<String, Object> result = PdfUtils.objectToMap(measure);
@ -258,8 +267,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
}
}).collect(Collectors.toList()));
}
}
else if(TicketConstants.WordFileNameEnum.OPERATE.getType().equals(type)){
} else if (TicketConstants.WordFileNameEnum.OPERATE.getType().equals(type)) {
//若为操作票
try {
params = PdfUtils.objectToMap(new StandardTicketInfoVO());
@ -272,8 +280,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
index.getAndIncrement();
return map;
}).collect(Collectors.toList()));
}
catch (Exception e) {
} catch (Exception e) {
throw new ServiceException("对象转换失败");
}
}
@ -314,8 +321,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
Map<String, Object> workTicketInfoMap = new HashMap<>();
try {
workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO);
}
catch (Exception e) {
} catch (Exception e) {
log.info("转换对象失败!");
}
/**签发**/
@ -378,4 +384,315 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
workTicketInfoMap.put("membersConfirm", " ");
return workTicketInfoMap;
}
/**
* 票据模板预览
*
* @param id 编号
* @param type 模板类型2为工作票1为操作票
* @param status 模板状态
* @param response
*/
@Override
public void newPreview(Long id, Integer type, Integer status, HttpServletResponse response) {
String fileName = IdWorker.get32UUID() + ".docx";
// response.setContentType("application/octet-stream;charset=ISO8859-1");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=utf-8");
R<TicketMatterGroupVO> detail = this.detail(id);
if (!detail.isSuccess()) {
throw new ServiceException(detail.getMsg());
}
TicketMatterGroupVO groupVO = detail.getData();
if (groupVO == null) {
throw new ServiceException("查询数据不存在");
}
//判断票据类型是操操作票还是工作票
this.getTypeByStatus(type, status, groupVO, response, id);
}
/**
* 判断票据类型是操操作票还是工作票
*
* @param type 模板类型2为工作票1为操作票
* @param status 模板状态
* @param groupVO
* @param response
* @param id
*/
private void getTypeByStatus(Integer type, Integer status, TicketMatterGroupVO groupVO, HttpServletResponse response, Long id) {
Map<String, Object> result = new HashMap<>();
switch (type) {
//操作票
case 1:
getStandardTicket(result, status, groupVO, response);
break;
//工作票
case 2:
getWordTicket(result, status, groupVO, response, id);
break;
default:
throw new ServiceException("输入的模板类型不存在");
}
}
/**
* 工作票
*
* @param params
* @param groupVO
* @param response
* @param id
*/
@SneakyThrows
private void getWordTicket(Map<String, Object> params, Integer status, TicketMatterGroupVO groupVO,
HttpServletResponse response, Long id) {
WorkTicketInfoEntity workTicket = new WorkTicketInfoEntity();
//1. 工作对象
Map<String, Object> workTicketInfoMap = PdfUtils.objectToMapResult(workTicket, params);
ticketProcessService.getDataConversion(workTicketInfoMap, "isSafety", false);
//危险点分析与预控措施票 (true,展示附件,false,不展示附件)
ticketProcessService.getDataConversion(workTicketInfoMap, "isHazard", false);
//危险点分析与预控措施票 (true,展示附件,false,不展示附件)
ticketProcessService.getDataConversion(workTicketInfoMap, "isRailway", false);
//有限空间监测记录单(true,展示附件,false,不展示附件)
ticketProcessService.getDataConversion(workTicketInfoMap, "isLimited", false);
params.putAll(workTicketInfoMap);
//3. 工作票工作任务组
params.put("workTicketContentDtoList", new ArrayList<>());
//4. 工作票延期
params.putAll(PdfUtils.objectToMapResult(new WorkTicketDelayEntity(), params));
//5. 工作结束
params.putAll(PdfUtils.objectToMapResult(new WorkTicketFinish(), params));
//5. 工作票负责人变更;
params.putAll(PdfUtils.objectToMapResult(new WorkTicketPrincipalChangeEntity(), params));
params.put("matterLibraryListOne", new ArrayList<>());
params.put("matterLibraryListTwo", new ArrayList<>());
params.put("matterLibraryListThree", new ArrayList<>());
params.put("matterLibraryListFour", new ArrayList<>());
params.put("matterLibraryListFive", new ArrayList<>());
params.put("matterLibraryListFlow", new ArrayList<>());
params.put("matterLibraryListSeven", new ArrayList<>());
params.put("matterLibraryListEight", new ArrayList<>());
params.put("matterLibraryListNine", new ArrayList<>());
params.put("matterLibraryListTen", new ArrayList<>());
params.put("matterLibraryList", new ArrayList<>());
/** 获取安措 **/
List<TwoTicketMatterLibraryEntity> libraryEntityList = twoTicketMatterLibraryService.list(new LambdaQueryWrapper<TwoTicketMatterLibraryEntity>() {{
eq(TwoTicketMatterLibraryEntity::getMatterGroup, id);
orderByAsc(TwoTicketMatterLibraryEntity::getType);
orderByDesc(TwoTicketMatterLibraryEntity::getSort);
}});
if (TicketConstants.WordFileNameEnum.SECOND_WORK.getType().equals(groupVO.getTicketType())) {
//第二种工作票
params.put("measures", libraryEntityList.stream().map(TwoTicketMatterLibraryEntity::getSafetyMeasure).collect(Collectors.joining(",")));
params.put("workTicketContentDtoList", Lists.newArrayList());
} else if (TicketConstants.WordFileNameEnum.MECHANICAL_WORK.getType().equals(groupVO.getTicketType())) {
//机械工作票
List<Map<String, Object>> mapList = libraryEntityList.stream().map(measure -> {
Map<String, Object> result = PdfUtils.objectToMap(measure);
result.put("status", "");
result.put("measure", measure.getSafetyMeasure());
return result;
}).collect(Collectors.toList());
log.info("机械工作票安措:{}", JSON.toJSONString(mapList));
params.put("initMeasures", mapList);
}
//许可人确认安全措施,负责人确认安全措施
WordHelper.putMap(params, "principalName1", 10);
//负责人变更
WordHelper.putMap(params, "signerName2", 10);
WordHelper.putMap(params, "licensorName1", 10);
//延期
WordHelper.putMap(params, "principalName2", 10);
//许可人确认工作票终结
WordHelper.putMap(params, "principalName3", 10);
WordHelper.putMap(params, "licensorName2", 10);
WordMapUtils.newMapWithList("matterLibraryList", params, true, 4, null);
if (CollectionUtil.isNotEmpty(groupVO.getMatterLibraryListOne())) {
params.put("matterLibraryListOne", groupVO.getMatterLibraryListOne().stream().map(library -> {
try {
Map<String, Object> map = PdfUtils.objectToMap(library);
map.put("status", " ");
return map;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}).collect(Collectors.toList()));
}
if (CollectionUtil.isNotEmpty(groupVO.getMatterLibraryListTwo())) {
params.put("matterLibraryListTwo", groupVO.getMatterLibraryListTwo().stream().map(library -> {
try {
Map<String, Object> map = PdfUtils.objectToMap(library);
map.put("status", " ");
return map;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}).collect(Collectors.toList()));
}
if (CollectionUtil.isNotEmpty(groupVO.getMatterLibraryListThree())) {
params.put("matterLibraryListThree", groupVO.getMatterLibraryListThree().stream().map(library -> {
try {
Map<String, Object> map = PdfUtils.objectToMap(library);
map.put("status", " ");
return map;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}).collect(Collectors.toList()));
}
this.isMatterLibraryList(params);
Map<String, Object> resultMap = WordHelper.resultMap(params);
String workTicketStatus = WordMapUtils.getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME;
//Windows操作系统
if (os != null && os.toLowerCase().startsWith("windows")) {
String url = "template/" + workTicketStatus;
XWPFDocument doc = WordExportUtil.exportWord07(url, resultMap);
log.info("当前系统版本是:{}", os);
doc.write(response.getOutputStream());
} else {
String url = TicketConstant.TICKET_LIUNX_PATH + "/" + workTicketStatus;
XWPFDocument doc = WordExportUtil.exportWord07(url, resultMap);
//其它操作系统
log.info("当前系统版本是:{}", os);
ServletOutputStream outputStream = response.getOutputStream();
doc.write(outputStream);
}
}
/**
* 操作票
*
* @param workTicketInfoMap 返回的数据
* @param groupVO
* @param response
*/
@SneakyThrows
private void getStandardTicket(Map<String, Object> workTicketInfoMap, Integer status, TicketMatterGroupVO groupVO,
HttpServletResponse response) {
workTicketInfoMap.putAll(this.convertMap(new StandardTicketInfoVo()));
AtomicInteger index = new AtomicInteger(1);
List<Map<String, Object>> collect = groupVO.getMatterLibraryListOne().stream().map(library -> {
Map<String, Object> map = new HashMap<>();
map.put("index", index.get());
map.put("measure", library.getSafetyMeasure());
map.put("status", " ");
map.put("hello", "");
map.put("hello1", "");
map.put("operationTime", "");
index.getAndIncrement();
return map;
}).collect(Collectors.toList());
workTicketInfoMap.put("measureMapList", collect);
Map<String, Object> resultMap = OperationWordHelper.resultMap(workTicketInfoMap);
String workTicketStatus = this.getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME;
//Windows操作系统
if (os != null && os.toLowerCase().startsWith("windows")) {
String url = "template/" + workTicketStatus;
XWPFDocument doc = WordExportUtil.exportWord07(url, resultMap);
log.info("当前系统版本是:{}", os);
doc.write(response.getOutputStream());
} else {
String url = TicketConstant.TICKET_LIUNX_PATH + "/" + workTicketStatus;
XWPFDocument doc = WordExportUtil.exportWord07(url, resultMap);
//其它操作系统
log.info("当前系统版本是:{}", os);
ServletOutputStream outputStream = response.getOutputStream();
doc.write(outputStream);
}
}
/**
* 将查询的数据转换为map
*
* @param standardTicketInfoVo
* @return
*/
private Map<String, Object> convertMap(StandardTicketInfoVo standardTicketInfoVo) {
//1. 操作票装换map
Map<String, Object> result = new HashMap<>();
Map<String, Object> stringObjectMap = PdfUtils.objectToMapResult(standardTicketInfoVo, result);
result.putAll(stringObjectMap);
WordMapUtils.newMapWithList("measureMapList", result, false, 17, null);
return result;
}
/**
* 根据状态获取模板
*
* @param status
* @return
*/
public static String getWorkTicketStatus(Integer status) {
String pathName = null;
switch (status) {
case 1:
pathName = "电气第一种工作票模版.docx";
break;
case 2:
pathName = "电气第二种工作票模版.docx";
break;
case 3:
pathName = "水力机械工作票模版.docx";
break;
case 4:
pathName = "电气操作票.docx";
default:
pathName = "电气第一种工作票模版.docx";
}
return pathName;
}
/**
* 验证是否有数据
*
* @param workTicketInfoMap
*/
private void isMatterLibraryList(Map<String, Object> workTicketInfoMap) {
//1. 第一种工作票
//1.1 应断开断路器和隔离开关,包括填写前已断开断路器和隔离开关(注明编号)、应取熔断器(保险)
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.ONE.getConvertAttributes(), workTicketInfoMap, true, 6, "safetyMeasure", "status");
//1.2 应装设接地线、隔板、隔罩(注明确切地点),应合上接地刀闸(注明双重名称)
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.TWO.getConvertAttributes(), workTicketInfoMap, true, 3, "safetyMeasure", "status");
//1.3 应装设遮拦、应挂标识牌及防止二次回路误碰等措施(注明确实地点、名称)
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.THREE.getConvertAttributes(), workTicketInfoMap, true, 6, "safetyMeasure", "status");
//2. 第二种工作票
//2.1 应断开断路器和隔离开关,包括填写前已断开断路器和隔离开关(注明编号)、应取熔断器(保险)
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.SEVEN.getConvertAttributes(), workTicketInfoMap, true, 6, "safetyMeasure", "status");
//3. 水利机器工作票
//3.1 必须采取的安全措施
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.EIGHT.getConvertAttributes(), workTicketInfoMap, true, 8, "safetyMeasure", "status");
//3.2 检修工作要求检修人员自行执行的安全措施(由工作负责人填写)
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.NINE.getConvertAttributes(), workTicketInfoMap, true, 5, "safetyMeasure", "status");
//3.3 检修工作要求检修人员自行执行的安全措施(由工作负责人填写)
WordMapUtils.newMapWithList(WorkTicketConstants.WorkTicketMeasureTypeEnum.TEN.getConvertAttributes(), workTicketInfoMap, true, 5, "safetyMeasure", "status");
}
}

22
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java

@ -3,12 +3,12 @@ package com.hnac.hzims.ticket.standardTicket.service.impl;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
@ -39,8 +39,6 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.flow.core.entity.BladeFlow;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -50,7 +48,10 @@ import javax.servlet.http.HttpServletResponse;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -166,7 +167,9 @@ public class OperationTicketServiceImpl implements OperationTicketService {
StandardTicketInfoVo standardTicketInfoVo = null;
try {
JSONObject jsonObject = JSONObject.parseObject(formData);
standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, StandardTicketInfoVo.class);
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, StandardTicketInfoVo.class);
standardTicketInfoVo = JSONObject.parseObject(jsonObject.getString("standardTicketInfoVo"),
new TypeReference<StandardTicketInfoVo>(){});
} catch (Exception e) {
log.error("获取表单出现异常了~~~~");
e.printStackTrace();
@ -182,7 +185,8 @@ public class OperationTicketServiceImpl implements OperationTicketService {
//设置id
StandardTicketInfoEntity newStandardTicketInfoEntity = new StandardTicketInfoEntity();
BeanUtils.copyProperties(standardTicketInfoVo, newStandardTicketInfoEntity);
// BeanUtils.copyProperties(standardTicketInfoVo, newStandardTicketInfoEntity);
BeanUtil.copy(standardTicketInfoVo, newStandardTicketInfoEntity);
newStandardTicketInfoEntity.setId(id);
newStandardTicketInfoEntity.setCreateUser(standardTicketInfoEntity.getCreateUser());
//填充操作票信息
@ -258,9 +262,9 @@ public class OperationTicketServiceImpl implements OperationTicketService {
businessMessageDTO.setUserIds(userIds);
businessMessageDTO.setCreateUser(newStandardTicketInfoEntity.getCreateUser());
System.out.println("================================================");
System.out.println("businessMessageDTO = " + businessMessageDTO);
System.out.println("================================================");
log.info("================================================");
log.info("businessMessageDTO = " + businessMessageDTO);
log.info("================================================");
R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO);
if (!booleanR.isSuccess()) {
throw new ServiceException("消息推送失败");

10
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketProcessService.java

@ -4,6 +4,7 @@ import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 开票处理流程接口
@ -36,4 +37,13 @@ public interface TicketProcessService {
* @return
*/
void newPreview(Long ticketId, Integer status, HttpServletResponse response);
/**
* * value true转 false转
* @param dataConversion
* @param key
* @param value
*/
public void getDataConversion(Map<String, Object> dataConversion, String key, Object value);
}

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -1284,8 +1284,6 @@ public class TicketProcessServiceImpl implements TicketProcessService {
if (StringUtils.isNoneBlank(newValue)) {
dataConversion.put(key, BooleanUtils.toBoolean(newValue) ? "☑" : "□");
}
}
/**

0
hzims-service/ticket/src/main/resources/db/newsql.sql → hzims-service/ticket/src/main/resources/db/1.0.0.sql

Loading…
Cancel
Save