Commit 42d830ce authored by suhuiguang's avatar suhuiguang

1.车用气瓶套打初始代码提交

parent 7b52038d
...@@ -178,7 +178,7 @@ public class JgVehicleInformationController extends BaseController { ...@@ -178,7 +178,7 @@ public class JgVehicleInformationController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/export") @GetMapping(value = "/export")
@ApiOperation(httpMethod = "GET", value = "导出车用气瓶使用登记证", notes = "导出车用气瓶使用登记证") @ApiOperation(httpMethod = "GET", value = "导出车用气瓶使用标志、使用登记证", notes = "普打、套打")
public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr, public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr,
@RequestParam(value = "printType", defaultValue = "0") String printType) { @RequestParam(value = "printType", defaultValue = "0") String printType) {
jgVehicleInformationServiceImpl.exportVehicleUseRegistrationCertificate(sequenceNbr, response, printType); jgVehicleInformationServiceImpl.exportVehicleUseRegistrationCertificate(sequenceNbr, response, printType);
......
...@@ -69,20 +69,6 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck { ...@@ -69,20 +69,6 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
/** /**
* 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行) * 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行)
* *
* @param records 设备唯一标识
* @param companyCode 登录人的公司代码
*/
@Override
public void delDataForCheckEquipRepeatUsed(List<String> records, String companyCode) {
RBucket<Set<String>> rBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = rBucket.get();
equipListOfUsed = equipListOfUsed.stream().filter(record -> !records.contains(record)).collect(Collectors.toSet());
rBucket.set(equipListOfUsed);
}
/**
* 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行)
*
* @param records 设备唯一标识 * @param records 设备唯一标识
* @param redisKey key * @param redisKey key
*/ */
...@@ -97,12 +83,30 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck { ...@@ -97,12 +83,30 @@ public abstract class BaseEquipUsedCheckService implements IEquipUsedCheck {
return rBucket.get(); return rBucket.get();
} }
/**
* 删除流程中的数据,释放redis空间(异常处理及驳回到发起节点、撤回到发起节点、完成时时进行)
*
* @param records 设备唯一标识
* @param companyCode 登录人的公司代码
*/
@Override
public void delDataForCheckEquipRepeatUsed(List<String> records, String companyCode) {
RBucket<Set<String>> rBucket = getRedisClient().getBucket(this.getFlowingEquipRedisKey(companyCode, getApplyBizType()));
Set<String> equipListOfUsed = rBucket.get();
if(equipListOfUsed != null){
equipListOfUsed = equipListOfUsed.stream().filter(record -> !records.contains(record)).collect(Collectors.toSet());
rBucket.set(equipListOfUsed);
}
}
private void delRedisData(List<String> records, String redisKey, RedissonClient redissonClient) { private void delRedisData(List<String> records, String redisKey, RedissonClient redissonClient) {
RBucket<Set<String>> rBucket = redissonClient.getBucket(redisKey); RBucket<Set<String>> rBucket = redissonClient.getBucket(redisKey);
Set<String> equipListOfUsed = rBucket.get(); Set<String> equipListOfUsed = rBucket.get();
equipListOfUsed = equipListOfUsed.stream().filter(record -> !records.contains(record)).collect(Collectors.toSet()); if(equipListOfUsed != null){
rBucket.set(equipListOfUsed); equipListOfUsed = equipListOfUsed.stream().filter(record -> !records.contains(record)).collect(Collectors.toSet());
rBucket.set(equipListOfUsed);
}
} }
public abstract RedissonClient getRedisClient(); public abstract RedissonClient getRedisClient();
......
...@@ -856,15 +856,6 @@ public class CommonServiceImpl implements ICommonService { ...@@ -856,15 +856,6 @@ public class CommonServiceImpl implements ICommonService {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
// // 上传pdf至文件服务器
// String url = this.uploadFile(pdfFile);
// 删除临时文件
// try {
// Files.deleteIfExists(pdfFile.toPath());
// } catch (IOException e) {
// log.error("删除临时文件失败:{}", e);
// }
try { try {
byte[] bytes = file2byte(pdfFile); byte[] bytes = file2byte(pdfFile);
...@@ -906,7 +897,6 @@ public class CommonServiceImpl implements ICommonService { ...@@ -906,7 +897,6 @@ public class CommonServiceImpl implements ICommonService {
// 生成二维码,之前为设备监管码,调整为申请单号 // 生成二维码,之前为设备监管码,调整为申请单号
String qrCode = ImageUtils.generateQRCode((String) map.getOrDefault("applyNo", ""), 100, 100); String qrCode = ImageUtils.generateQRCode((String) map.getOrDefault("applyNo", ""), 100, 100);
map.put("supervisoryCode", qrCode); // 监管二维码 代码优化 map.put("supervisoryCode", qrCode); // 监管二维码 代码优化
this.fillParamValueToPdf(map, response, "templates/use-registration-model.pdf", "套打使用登记证.pdf", 12.0f); this.fillParamValueToPdf(map, response, "templates/use-registration-model.pdf", "套打使用登记证.pdf", 12.0f);
} }
...@@ -948,7 +938,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -948,7 +938,7 @@ public class CommonServiceImpl implements ICommonService {
* @param printFileName 生成文件名称 * @param printFileName 生成文件名称
* @param textSize 字体大小 * @param textSize 字体大小
*/ */
private void fillParamValueToPdf(Map<String, Object> map, HttpServletResponse response, String pathResource, String printFileName, float textSize) { void fillParamValueToPdf(Map<String, Object> map, HttpServletResponse response, String pathResource, String printFileName, float textSize) {
// 读取资源文件夹下的模板 // 读取资源文件夹下的模板
ClassPathResource resource = new ClassPathResource(pathResource); ClassPathResource resource = new ClassPathResource(pathResource);
...@@ -1834,7 +1824,7 @@ public class CommonServiceImpl implements ICommonService { ...@@ -1834,7 +1824,7 @@ public class CommonServiceImpl implements ICommonService {
} }
@Override @Override
public void fightUseFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) { public void fightUseFlagGenerate(UseFlagParamDto useFlagParamDto, HttpServletResponse response) {
Objects.requireNonNull(useFlagParamDto, "参数不能为空"); Objects.requireNonNull(useFlagParamDto, "参数不能为空");
String printFileName = "套打使用登记标志.pdf"; String printFileName = "套打使用登记标志.pdf";
......
...@@ -163,7 +163,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -163,7 +163,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
* @param auditPassDate 通过时间 * @param auditPassDate 通过时间
* @param exportParamsMap 参数map * @param exportParamsMap 参数map
*/ */
public static void getAuditPassedDate(Date auditPassDate, Map<String, Object> exportParamsMap) { static void getAuditPassedDate(Date auditPassDate, Map<String, Object> exportParamsMap) {
LocalDate today; LocalDate today;
if (ValidationUtil.isEmpty(auditPassDate)) { if (ValidationUtil.isEmpty(auditPassDate)) {
// 发证日期为空取当前时间 // 发证日期为空取当前时间
......
...@@ -31,6 +31,7 @@ import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest; ...@@ -31,6 +31,7 @@ import com.yeejoin.amos.boot.module.jg.biz.config.LocalBadRequest;
import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService; import com.yeejoin.amos.boot.module.jg.biz.service.ICmWorkflowService;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
...@@ -52,6 +53,7 @@ import org.redisson.api.RedissonClient; ...@@ -52,6 +53,7 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -130,6 +132,12 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -130,6 +132,12 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
private Map<String, Object> fillingMediumMap; private Map<String, Object> fillingMediumMap;
private static final String[] DEFAULT_KEYS = {
"useRegistrationCode", "useUnitName", "fullAddress", "equList", "equipDefine",
"equipCode", "equipCategory", "useInnerCode", "factoryNum", "giveOutYear",
"giveOutMonth", "giveOutDay"
};
/** /**
* 新增(提交)车用气瓶 * 新增(提交)车用气瓶
...@@ -950,11 +958,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -950,11 +958,6 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
populateEquipmentInformation(registerInfoList, exportParamsMap); populateEquipmentInformation(registerInfoList, exportParamsMap);
} }
//IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(vehicleInformationEqList.get(0).getEquId());
//if (useInfo != null && useInfo.getUseInnerCode() != null) {
// exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode());
//}
List<IdxBizJgUseInfo> userInfoList = idxBizJgUseInfoService.list(new QueryWrapper<IdxBizJgUseInfo>().in("RECORD", vehicleInformationEqList.stream() List<IdxBizJgUseInfo> userInfoList = idxBizJgUseInfoService.list(new QueryWrapper<IdxBizJgUseInfo>().in("RECORD", vehicleInformationEqList.stream()
.map(JgVehicleInformationEq::getEquId) .map(JgVehicleInformationEq::getEquId)
.filter(Objects::nonNull) .filter(Objects::nonNull)
...@@ -984,25 +987,45 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform ...@@ -984,25 +987,45 @@ public class JgVehicleInformationServiceImpl extends BaseService<JgVehicleInform
this.generateReport(vehicleInformation, printType, exportParamsMap, response); this.generateReport(vehicleInformation, printType, exportParamsMap, response);
} }
private void generatePdfPrint(Map<String, Object> map, HttpServletResponse response) {
// 设置默认值
Arrays.stream(DEFAULT_KEYS).forEach(key -> map.computeIfAbsent(key, k -> ""));
// 生成二维码,之前为设备监管码,调整为申请单号
String qrCode = ImageUtils.generateQRCode((String) map.getOrDefault("applyNo", ""), 100, 100);
map.put("supervisoryCode", qrCode);
commonService.fillParamValueToPdf(map, response, "templates/use-registration-model-vehicle.pdf", "套打使用登记证.pdf", 12.0f);
}
private void generateReport(JgVehicleInformation vehicleInformation, String printType, Map<String, Object> exportParamsMap, HttpServletResponse response) { private void generateReport(JgVehicleInformation vehicleInformation, String printType, Map<String, Object> exportParamsMap, HttpServletResponse response) {
switch (printType) { switch (printType) {
case "0": case "0":
// 使用登记证-普通打印--
commonService.generateCertificateReport(exportParamsMap, response); commonService.generateCertificateReport(exportParamsMap, response);
break; break;
case "1": case "1":
commonService.generatePdfPrint(exportParamsMap, response); // 使用登记证-套打--
this.generatePdfPrint(exportParamsMap, response);
break; break;
case "2": case "2":
// 使用标志-普通打印--
commonService.useFlagGenerate(buildUseFlagParam(vehicleInformation, exportParamsMap), response); commonService.useFlagGenerate(buildUseFlagParam(vehicleInformation, exportParamsMap), response);
break; break;
case "3": case "3":
commonService.fightUseFlagGenerate(buildUseFlagParam(vehicleInformation, exportParamsMap), response); // 使用标志-套打--
commonService.fightUseFlagGenerate(this.setProductNameWithStatic(vehicleInformation, exportParamsMap), response);
break; break;
default: default:
throw new BadRequest("Invalid print type"); throw new BadRequest("Invalid print type");
} }
} }
private UseFlagParamDto setProductNameWithStatic(JgVehicleInformation vehicleInformation, Map<String, Object> exportParamsMap) {
UseFlagParamDto useFlagParamDto = buildUseFlagParam(vehicleInformation, exportParamsMap);
useFlagParamDto.setEquipDefine("车用气瓶");
return useFlagParamDto;
}
private void populateEquipmentInformation(List<IdxBizJgRegisterInfo> registerInfoList, Map<String, Object> exportParamsMap) { private void populateEquipmentInformation(List<IdxBizJgRegisterInfo> registerInfoList, Map<String, Object> exportParamsMap) {
Optional<IdxBizJgRegisterInfo> optionalRegisterInfo = registerInfoList.stream().findFirst(); Optional<IdxBizJgRegisterInfo> optionalRegisterInfo = registerInfoList.stream().findFirst();
if (optionalRegisterInfo.isPresent()) { if (optionalRegisterInfo.isPresent()) {
......
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