Commit b984a428 authored by litengwei's avatar litengwei

使用单位变更导出

parent 6fbcfbe4
......@@ -15,16 +15,22 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.io.*;
import java.net.URLEncoder;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationUnitServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationUnitDto;
......@@ -177,4 +183,30 @@ public class JgChangeRegistrationUnitController extends BaseController {
jgChangeRegistrationUnitServiceImpl.accept(jgInstallationNoticeDto,op);
return ResponseHelper.buildResponse(null);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/export")
@ApiOperation(httpMethod = "GET", value = "导出使用登记证", notes = "导出使用登记证")
public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr) throws IOException {
File file = jgChangeRegistrationUnitServiceImpl.exportUseRegistrationCertificate(sequenceNbr);
if(ValidationUtil.isEmpty(file)){
throw new BadRequest("使用登记证导出失败,请稍后重试!");
}
FileInputStream in = new FileInputStream(file);
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("使用登记证", "UTF-8") + ".pdf");
response.setHeader("content-Type", "application/msword");
response.setCharacterEncoding("utf-8");
OutputStream out = new BufferedOutputStream(response.getOutputStream());
int b = 0;
byte[] buffer = new byte[2048];
while ((b = in.read(buffer)) != -1) {
out.write(buffer, 0, b);
}
in.close();
out.flush();
out.close();
}
}
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationUnitDto;
......@@ -15,11 +16,11 @@ import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationUnitService;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.jg.flc.api.fegin.WorkFlowFeignService;
import com.yeejoin.amos.boot.module.ymt.api.entity.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.UseInfo;
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.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -42,12 +43,14 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.time.LocalDate;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -112,6 +115,16 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
@Autowired
private JgChangeRegistrationNameEqMapper jgChangeRegistrationNameEqMapper;
@Autowired
private IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired
private IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired
private IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired
ICommonService commonService;
......@@ -672,4 +685,88 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
}
return null;
}
/**
* 导出使用登记证
*
* @param sequenceNbr
*/
public File exportUseRegistrationCertificate(String sequenceNbr) {
Map<String, Object> exportParamsMap = new HashMap<>();
//查询移装变更详情
JgChangeRegistrationUnit transfer = this.getById(sequenceNbr);
LambdaQueryWrapper<JgChangeRegistrationUnitEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgChangeRegistrationUnitEq::getUnitChangeRegistrationId,transfer.getSequenceNbr());
JgChangeRegistrationUnitEq jgChangeRegistrationUnitEq = JgChangeRegistrationUnitEqMapper.selectOne(queryWrapper);
if (ValidationUtil.isEmpty(transfer) || ValidationUtil.isEmpty(jgChangeRegistrationUnitEq)) {
throw new BadRequest("使用登记证导出失败,请稍后重试!");
}
//是否废弃
exportParamsMap.put("isInvalid", jgChangeRegistrationUnitEq.getIsInvalid());
//登记机关
exportParamsMap.put("receiveOrgName", transfer.getReceiveOrgName());
//使用登记证编号
exportParamsMap.put("useRegistrationCode", transfer.getUseRegistCode());
//使用单位名称
exportParamsMap.put("useUnitName", transfer.getUseUnitName());
//监管码
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord,jgChangeRegistrationUnitEq.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
exportParamsMap.put("supervisoryCode", tzsJgOtherInfo.getSupervisoryCode());
//发证日期(当前时间)
LocalDate today = LocalDate.now();
exportParamsMap.put("giveOutYear", today.getYear());
exportParamsMap.put("giveOutMonth", today.getMonthValue());
exportParamsMap.put("giveOutDay", today.getDayOfMonth());
//设备使用地址
//查询设备注册信息
IdxBizJgRegisterInfo registerInfo = idxBizJgRegisterInfoService.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", jgChangeRegistrationUnitEq.getEquId()));
if(!ValidationUtil.isEmpty(registerInfo)){
//设备种类、类别、品种
String equList = registerInfo.getEquList();//设备种类
String equCategory = registerInfo.getEquCategory();//设备类别
String equDefine = registerInfo.getEquDefine();//设备品种
List<EquipmentCategory> categoryList0 = commonService.getEquipmentCategoryList(equList, null);
List<EquipmentCategory> categoryList1 = commonService.getEquipmentCategoryList(equCategory, null);
List<EquipmentCategory> categoryList2 = commonService.getEquipmentCategoryList(equDefine, null);
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(categoryList1)) {
exportParamsMap.put("equList", categoryList0.get(0).getName());
}
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(categoryList1)) {
exportParamsMap.put("equCategory", categoryList1.get(0).getName());
}
if (org.apache.commons.collections.CollectionUtils.isNotEmpty(categoryList2)) {
exportParamsMap.put("equDefine", categoryList2.get(0).getName());
}
//设备代码
exportParamsMap.put("equCode", registerInfo.getEquCode());
}
//单位内部编码
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(jgChangeRegistrationUnitEq.getEquId());
if(!ValidationUtil.isEmpty(useInfo)){
exportParamsMap.put("useInnerCode", useInfo.getUseInnerCode());
String fullAddress="";
String province = useInfo.getProvinceName();
String city = useInfo.getCityName();
String county = useInfo.getCountyName();
String street = useInfo.getStreetName();
String address = useInfo.getAddress();
fullAddress = province + city + county + street + address;
exportParamsMap.put("fullAddress", fullAddress);
}
IdxBizJgFactoryInfo factoryInfo = idxBizJgFactoryInfoService.getOneData(jgChangeRegistrationUnitEq.getEquId());
//产品编号(出厂编号)
if(!ValidationUtil.isEmpty(factoryInfo)){
exportParamsMap.put("factoryNum", factoryInfo.getFactoryNum());
}
//调用生成使用登记证
return commonService.generateCertificateReport(exportParamsMap);
}
}
\ No newline at end of file
......@@ -455,7 +455,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="default" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -603,8 +603,8 @@
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -642,7 +642,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -795,17 +795,24 @@
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体"/>
<w:b/>
<w:bCs/>
<w:i w:val="0"/>
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:color w:val="262626" w:themeColor="text1" w:themeTint="D9"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
<w14:textFill>
<w14:solidFill>
<w14:schemeClr w14:val="tx1">
<w14:lumMod w14:val="85000"/>
<w14:lumOff w14:val="15000"/>
</w14:schemeClr>
</w14:solidFill>
</w14:textFill>
</w:rPr>
</w:pPr>
<w:r>
......@@ -842,7 +849,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -853,6 +860,7 @@
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
<w:bookmarkStart w:id="0" w:name="_GoBack"/>
<w:r>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
......@@ -966,6 +974,14 @@
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
<w14:textFill>
<w14:solidFill>
<w14:schemeClr w14:val="tx1">
<w14:lumMod w14:val="85000"/>
<w14:lumOff w14:val="15000"/>
</w14:schemeClr>
</w14:solidFill>
</w14:textFill>
</w:rPr>
</w:pPr>
<w:r>
......@@ -995,16 +1011,15 @@
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体"/>
<w:b/>
<w:bCs/>
<w:i w:val="0"/>
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:color w:val="262626" w:themeColor="text1" w:themeTint="D9"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -1042,7 +1057,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -1087,8 +1102,8 @@
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:szCs w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -1118,6 +1133,7 @@
</w:p>
</w:tc>
</w:tr>
<w:bookmarkEnd w:id="0"/>
<w:tr>
<w:tblPrEx>
<w:tblBorders>
......@@ -1136,7 +1152,7 @@
</w:tblCellMar>
</w:tblPrEx>
<w:trPr>
<w:trHeight w:val="794" w:hRule="exact"/>
<w:trHeight w:val="1007" w:hRule="exact"/>
<w:jc w:val="center"/>
</w:trPr>
<w:tc>
......@@ -1149,7 +1165,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -1195,7 +1211,8 @@
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -1301,7 +1318,8 @@
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -1340,7 +1358,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="黑体" w:hAnsi="黑体" w:eastAsia="黑体"
w:cs="黑体"/>
......@@ -1350,7 +1368,8 @@
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -1788,7 +1807,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="黑体" w:hAnsi="黑体" w:eastAsia="黑体"
w:cs="黑体"/>
......@@ -1798,7 +1817,8 @@
<w:iCs w:val="0"/>
<w:color w:val="BEBEBE"/>
<w:kern w:val="0"/>
<w:sz w:val="24"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
<w:lang w:val="en-US" w:eastAsia="zh-CN"/>
</w:rPr>
</w:pPr>
......@@ -2243,7 +2263,7 @@
</w:tblCellMar>
</w:tblPrEx>
<w:trPr>
<w:trHeight w:val="794" w:hRule="exact"/>
<w:trHeight w:val="654" w:hRule="exact"/>
<w:jc w:val="center"/>
</w:trPr>
<w:tc>
......@@ -2256,7 +2276,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -2341,7 +2361,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="黑体" w:hAnsi="黑体" w:eastAsia="黑体"
w:cs="黑体"/>
......@@ -2448,7 +2468,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:eastAsia="宋体"
w:cs="宋体"/>
......@@ -2651,7 +2671,7 @@
</w:tblCellMar>
</w:tblPrEx>
<w:trPr>
<w:trHeight w:val="794" w:hRule="exact"/>
<w:trHeight w:val="639" w:hRule="exact"/>
<w:jc w:val="center"/>
</w:trPr>
<w:tc>
......@@ -2749,7 +2769,7 @@
<w:p>
<w:pPr>
<w:spacing w:line="240" w:lineRule="auto"/>
<w:jc w:val="center"/>
<w:jc w:val="left"/>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="黑体" w:hAnsi="黑体" w:eastAsia="黑体"
w:cs="黑体"/>
......
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