Commit c21a9092 authored by chenzhao's avatar chenzhao

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_tzs_register
parents bf2f86ee be5d8941
......@@ -145,23 +145,17 @@ public class ControllerAop {
// 验证token有效性,防止token失效
AgencyUserModel userModel;
try {
// StopWatch stopWatch = new StopWatch();
// stopWatch.start("1");
String authToken = RedisKey.buildReginKey(RequestContext.getExeUserId(), token);
if (redisUtils.hasKey(authToken)) {
logger.info("登录命中缓存 ,直接返回!!===========>");
return;
}
// stopWatch.stop();
// logger.info("get auth token count time===========> {}", stopWatch.getTotalTimeSeconds());
// stopWatch.start("2");
// FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
// userModel = agencyUserModel.getResult();
// if (userModel == null) {
// throw new Exception("无法获取用户信息");
// }
// RequestContext.setExeUserId(userModel.getUserId());
// logger.info("get me count time===========> {}", stopWatch.getTotalTimeSeconds());
FeignClientResult<AgencyUserModel> agencyUserModel = Privilege.agencyUserClient.getme();
userModel = agencyUserModel.getResult();
if (userModel == null) {
throw new Exception("无法获取用户信息");
}
RequestContext.setExeUserId(userModel.getUserId());
} catch (Exception e) {
// 删除失效token缓存
logger.info("catch pattern before==========>" + pattern);
......@@ -169,8 +163,8 @@ public class ControllerAop {
logger.info("catch pattern after==========>" + pattern);
throw new RuntimeException(e.getMessage());
}
// saveUserRedis(userModel, token);
saveUserRedis();
saveUserRedis(userModel, token);
// saveUserRedis();
} else {
throw new AuthException("请求未包含认证信息.");
}
......
......@@ -30,7 +30,7 @@ import java.util.Objects;
*/
public class BizCustomDateSerializer extends JsonSerializer<Date> {
private List<String> customFields = Arrays.asList("acceptDate", "expiryDate","applicationDate","noticeDate","installStartDate","handleDate");
private List<String> customFields = Arrays.asList("acceptDate", "expiryDate","applicationDate","noticeDate","installStartDate","handleDate","auditPassDate","applyDate");
public BizCustomDateSerializer()
{
......
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -52,6 +54,7 @@ public class JgChangeRegistrationNameDto extends BaseDto {
private String createUserId;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createDate;
@ApiModelProperty(value = "创建人")
......@@ -84,4 +87,16 @@ public class JgChangeRegistrationNameDto extends BaseDto {
@ApiModelProperty(value = "任务发起人id")
private String promoter;
/**
* 流程状态
*/
@TableField("instance_status")
private String instanceStatus;
private List<String> roleIds;
// 区分监管和企业
private String type;
}
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yeejoin.amos.boot.module.jg.api.common.BizCustomDateSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -31,6 +34,8 @@ public class JgChangeRegistrationUnitDto extends BaseDto {
private String applyNo;
@ApiModelProperty(value = "申请日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date applyDate;
@ApiModelProperty(value = "办理状态")
......@@ -46,6 +51,8 @@ public class JgChangeRegistrationUnitDto extends BaseDto {
private String receiveCompanyCode;
@ApiModelProperty(value = "终审通过时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date auditPassDate;
@ApiModelProperty(value = "备注")
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
*
......@@ -75,4 +76,8 @@ public class JgEnableDisableDto extends BaseDto {
@ApiModelProperty(value = "申请类型(1启用,0停用)")
private String applyType;
private List<String> roleIds;
private String type;
}
package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -39,7 +40,8 @@ public class JgEquipTransferDto extends BaseDto {
private String applyStatusDesc;
@ApiModelProperty(value = "申请日期")
private Date applyDate;
@JsonFormat(pattern = "yyyy-MM-dd")
private String applyDate;
@ApiModelProperty(value = "施工单位统一信用代码")
private String installUnitCreditCode;
......
......@@ -244,6 +244,7 @@ public class JgInstallationNoticeDto extends BaseDto {
private String equAddress;
@ApiModelProperty(value = "办理日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date handleDate;
......
......@@ -136,4 +136,10 @@ public class JgChangeRegistrationName extends BaseEntity {
@TableField("promoter")
private String promoter;
/**
* 流程状态
*/
@TableField("instance_status")
private String instanceStatus;
}
......@@ -2,7 +2,10 @@ package com.yeejoin.amos.boot.module.jg.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jg.api.common.BizCustomDateSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
......@@ -38,6 +41,8 @@ public class JgChangeRegistrationUnit extends BaseEntity {
* 申请日期
*/
@TableField("apply_date")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date applyDate;
/**
......@@ -68,6 +73,8 @@ public class JgChangeRegistrationUnit extends BaseEntity {
* 终审通过时间
*/
@TableField("audit_pass_date")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date auditPassDate;
/**
......
......@@ -143,26 +143,5 @@ public class JgEquipTransfer extends BaseEntity {
private String instanceRoles;
@TableField(exist = false)
private String equCategory;
@TableField(exist = false)
private String equDefine;
@TableField(exist = false)
private String factoryNum;
@TableField(exist = false)
private String equRegisterCode;
@TableField(exist = false)
private String supervisoryCode;
@TableField(exist = false)
private String useInnerCode;
@TableField(exist = false)
private String concatenatedAddress;
@TableField(exist = false)
private String processAdvice;
}
......@@ -391,6 +391,7 @@ public class JgInstallationNotice extends BaseEntity {
private String equAddress;
@TableField("handle_date")
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonSerialize(using = BizCustomDateSerializer.class)
private Date handleDate;
......
......@@ -49,6 +49,15 @@ public enum WorkFlowStatusEnum {
CHANGE_REEXAMINE("三级受理", "changeReexamine", "三级待受理", "", ""),
/**
* 更名变更登记流程
*/
UNIT_RENAME_SUBMIT("使用单位提交", "unitRenameSubmit", "使用单位待提交", "一级受理已驳回", "使用单位已撤回"),
UNIT_RENAME_RECEIVE("一级受理", "unitRenameReceive", "一级待受理", "二级受理已驳回", "一级受理已撤回"),
UNIT_RENAME_PRELIMINARY("二级受理", "unitRenamePreliminary", "二级待受理", "三级受理已驳回", "二级受理已撤回"),
UNIT_RENAME_REEXAMINE("三级受理", "unitRenameReexamine", "三级待受理", "", ""),
/**
* 移装变更登记流程
*/
TRANSFER_SUBMIT("使用单位提交", "transferSubmit", "使用单位待提交", "一级受理已驳回", "使用单位已撤回"),
......@@ -59,10 +68,18 @@ public enum WorkFlowStatusEnum {
/**
* 使用单位更登记流程
*/
UNITCHANGE_SUBMIT("使用单位提交", "unitChangeSubmit", "使用单位待提交", "一级受理已驳回", "使用单位提交已撤回"),
UNITCHANGE_SUBMIT("使用单位提交", "unitChangeSubmit", "使用单位待提交", "一级受理已驳回", "使用单位已撤回"),
UNITCHANGE_RECEIVE("一级受理", "unitChangeReceive", "一级待受理", "二级受理已驳回", "一级受理已撤回"),
UNITCHANGE_PRELIMINARY("二级受理", "unitChangePreliminary", "二级待受理", "三级受理已驳回", "二级受理已撤回"),
UNITCHANGE_REEXAMINE("三级受理", "unitChangeReexamine", "三级待受理","","");
UNITCHANGE_REEXAMINE("三级受理", "unitChangeReexamine", "三级待受理","",""),
/**
* 停用启用流程
*/
ENABLE_SUBMIT("使用单位提交", "enableSubmit", "待提交", "已驳回", "已撤回"),
ENABLE_RECEIVE("监管受理", "enableReceive", "待受理", "", "");
private final String name;
......
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationNameEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/**
* Mapper 接口
......@@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface JgChangeRegistrationNameEqMapper extends BaseMapper<JgChangeRegistrationNameEq> {
@Update ("update tzs_jg_change_registration_name_eq set is_invalid = 1 where equ_id = #{equipId} and name_change_registration_id != #{currentDocumentId} ")
void updateEquipIsVaildByEquipIdAndCurrentDocumentId(@Param ("equipId")String equipId, @Param("currentDocumentId")String currentDocumentId);
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationName;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
......@@ -16,4 +19,10 @@ import java.util.Map;
public interface JgChangeRegistrationNameMapper extends BaseMapper<JgChangeRegistrationName> {
List<Map<String, Object>> getEquipInfoByOrgCode(@Param("code") String code);
void deleteByChangeRegistrationId(@Param("changeRegistrationId") Long changeRegistrationId);
void deleteHistoryInfoById(@Param("code") String code);
Page<Map<String, Object>> getListPage(@Param("page") Page<Map<String, Object>> page, @Param("dto") JgChangeRegistrationNameDto dto, @Param("roleIds") List<String> roleIds, @Param("orgCode") String orgCode);
}
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationUnitEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/**
* 单位变更登记设备关系表 Mapper 接口
......@@ -10,5 +12,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2023-12-22
*/
public interface JgChangeRegistrationUnitEqMapper extends CustomBaseMapper<JgChangeRegistrationUnitEq> {
@Update ("update tzs_jg_change_registration_unit_eq set is_invalid = 1 where equ_id = #{equipId} and unit_change_registration_id != #{currentDocumentId} ")
void updateEquipIsVaildByEquipIdAndCurrentDocumentId(@Param ("equipId")String equipId, @Param("currentDocumentId")String currentDocumentId);
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* Mapper 接口
......@@ -11,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface JgEnableDisableMapper extends BaseMapper<JgEnableDisable> {
Page<Map<String, Object>> pageList(@Param("page") Page<Map<String, Object>> page, @Param("dto") JgEnableDisableDto dto);
Map<String, Object> getDetail(@Param("sequenceNbr") Long sequenceNbr);
}
......@@ -2,9 +2,7 @@ package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEquipTransferDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEquipTransfer;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -17,7 +15,7 @@ import java.util.Map;
* @date 2023-12-20
*/
public interface JgEquipTransferMapper extends CustomBaseMapper<JgEquipTransfer> {
Page<JgEquipTransfer> queryForPage(Page<JgEquipTransfer> page, @Param("param") JgEquipTransferDto model, @Param("type") String type, @Param("companyCode") String companyCode);
Page<JgEquipTransferDto> queryForPage(Page<JgEquipTransferDto> page, @Param("param") JgEquipTransferDto model, @Param("type") String type, @Param("companyCode") String companyCode);
void updatePromoter(@Param("id")Long id);
......
package com.yeejoin.amos.boot.module.jg.api.service;
/**
* 更名变更登记接口类
*
* @author system_generator
* @date 2023-12-25
*/
public interface IJgChangeRegistrationNameService {
}
......@@ -7,6 +7,8 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationTransferDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransfer;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.Map;
/**
......@@ -30,4 +32,6 @@ public interface IJgChangeRegistrationTransferService extends IService<JgChangeR
void flowExecute(Long sequenceNbr, String instanceId, String operate, String comment, boolean update);
void revocation(String instanceId);
void exportUseRegistrationCertificate(String sequenceNbr, HttpServletResponse response);
}
......@@ -59,11 +59,4 @@ public interface IJgChangeRegistrationUnitService {
*/
void saveNotice(String submitType, JgChangeRegistrationUnitDto model, ReginParams reginParams);
/**
* 打印告知单
*
* @param sequenceNbr 主键
* @return pdf文件路径
*/
String generateInstallationNoticeReport(Long sequenceNbr);
}
......@@ -25,7 +25,7 @@ public interface IJgEquipTransferService extends IService<JgEquipTransfer> {
* @param type 类型:enterprise-企业端、supervision-监管端
* @return 设备移交分页列表
*/
Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransfer> page, JgEquipTransferDto dto, String type, ReginParams reginParams);
Page<JgEquipTransferDto> queryForJgEquipTransferPage(Page<JgEquipTransferDto> page, JgEquipTransferDto dto, String type, ReginParams reginParams);
/**
* 根据sequenceNbr查询
......@@ -34,12 +34,4 @@ public interface IJgEquipTransferService extends IService<JgEquipTransfer> {
* @return 设备移交详情
*/
Map<String, Object> queryBySequenceNbr(Long sequenceNbr);
/**
* 保存设备移交接口
* @param submitType 按钮类型
* @param dto dto
* @param selectedOrgInfo reginParams
*/
void saveEquipTransfer(String submitType, Map<String, JgEquipTransferDto> dto, ReginParams selectedOrgInfo);
}
......@@ -28,4 +28,5 @@ public interface IJgTransferNoticeService extends IService<JgTransferNotice> {
void saveNotice(String submitType, Map<String, JgTransferNoticeDto> model, ReginParams reginParams);
String generateTransferNoticeReport(Long sequenceNbr);
}
......@@ -14,4 +14,57 @@
WHERE
USE_UNIT_CREDIT_CODE = #{code}
</select>
<delete id="deleteByChangeRegistrationId">
delete from tzs_jg_change_registration_name_eq where name_change_registration_id = #{changeRegistrationId}
</delete>
<select id="getListPage" resultType="java.util.Map">
select ur.sequence_nbr as sequenceNbr,
ur.instance_id as instanceId,
ur.audit_status as auditStatus,
ur.apply_no as applyNo,
DATE_FORMAT(ur.rec_date,'%Y-%m-%d') as recDate,
DATE_FORMAT(ur.create_date,'%Y-%m-%d') as createDate,
DATE_FORMAT(ur.audit_pass_date,'%Y-%m-%d') as auditPassDate,
ur.receive_org_code as receiveOrgCode,
ur.receive_org_name as receiveOrgName,
ur.receive_company_code as receiveCompanyCode,
ur.use_unit_name as useUnitName,
ur.new_use_unit_name AS newUseUnitName,
ur.promoter,
ur.next_executor_ids as nextExecutorIds
from tzs_jg_change_registration_name ur
<where>
and ur.is_delete = 0
<if test="dto.auditStatus != null and dto.auditStatus != ''">
and ur.audit_status = #{dto.auditStatus}
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
and ur.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.createDate != null">
AND ur.create_date >= #{dto.createDate}
</if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
AND ur.receive_org_code = #{dto.receiveOrgCode}
</if>
<if test="roleIds != null and dto.type == 'supervision'">
<foreach collection='roleIds' item='role' open='and (' close=')' separator='or'>
ur.instance_status like concat('%',#{role},'%')
</foreach>
</if>
<if test="dto.type == 'supervision'">
AND ur.receive_org_code = #{orgCode}
</if>
<if test="dto.type == 'enterprise' ">
and ur.use_unit_credit_code = #{orgCode}
</if>
</where>
order by ur.rec_date desc
</select>
<delete id="deleteHistoryInfoById">
delete from tzs_jg_registration_history where current_document_id = #{code}
</delete>
</mapper>
......@@ -19,6 +19,7 @@
crt.promoter,
crt.rec_date as recDate,
crt.instance_id as instanceId,
crt.use_registration_code as useRegistrationCode,
use.USE_UNIT_NAME as useUnitName,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory,
jri.PRODUCT_NAME as productName,
......
......@@ -10,11 +10,16 @@
isn.use_unit_name AS useUnitName,
isn.receive_org_name AS receiveOrgName,
isn.new_use_unit_name AS newUseUnitName,
isn.equ_address AS equAddress,
isn.product_name_b AS productNameB,
isn.equ_code_b AS equCodeB,
isn.use_inner_code AS useInnerCode,
isn.use_regist_code AS useRegistCode,
isn.apply_date AS applyDate,
isn.status AS status,
isn.instance_id AS instanceId,
isn.promoter,
isn.next_execute_ids AS nextExecuteIds,
isn.next_executor_ids AS nextExecutorIds,
isn.instance_status AS instanceStatus,
isn.audit_pass_date AS auditPassDate,
isn.equ_type AS equType
......@@ -27,17 +32,20 @@
AND isn.apply_no LIKE CONCAT('%', #{param.applyNo}, '%')
</if>
<if test="param.receiveOrgCode != null and param.receiveOrgCode != ''">
AND isn.receive_org_credit_code = #{param.receiveOrgCreditCode}
AND isn.receive_org_code = #{param.receiveOrgCode}
</if>
<if test="param.useUnitName != null and param.useUnitName != ''">
AND isn.use_unit_credit_code = #{param.useUnitName}
AND isn.use_unit_code = #{param.useUnitName}
</if>
<if test="param.status != null and param.status != ''">
AND isn.status = #{param.status}
</if>
<if test="param.equCodeB != null and param.equCodeB != ''">
AND isn.equ_code_b = #{param.equCodeB}
</if>
</if>
<if test="type == 'supervision'">
AND isn.receive_org_credit_code = #{orgCode}
AND isn.receive_org_code = #{orgCode}
AND isn.instance_id is not null
</if>
<if test="type == 'enterprise'">
......@@ -50,22 +58,17 @@
</if>
</where>
ORDER BY
isn.create_date DESC
isn.create_date DESC, isn.apply_no DESC
</select>
<select id="queryEquipInformation" resultType="java.util.Map">
select
isn.sequence_nbr AS sequenceNbr,
isn.apply_no AS applyNo,
isn.use_unit_name AS useUnitName,
isn.use_unit_credit_code AS useUnitName,
isn.new_use_unit_credit_code AS useUnitName,
isn.new_use_unit_name AS useUnitName,
isn.receive_org_name AS receiveOrgName,
isn.receive_org_code AS receiveOrgCode,
isn.change_certificate AS changeCertificate,
isn.remark AS remark,
isn.equ_register_code AS equRegisterCode,
isn.equ_code_b AS equRegisterCode,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
......@@ -99,7 +102,7 @@
ei.address AS address
FROM
tzs_jg_change_registration_unit isn
LEFT JOIN tzs_jg_change_registration_unit_eq re ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN tzs_jg_change_registration_unit_eq re ON re.unit_change_registration_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
LEFT JOIN idx_biz_jg_design_info di ON di.record = re.equ_id
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
......
......@@ -2,4 +2,76 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgEnableDisableMapper">
<select id="pageList" resultType="java.util.Map">
SELECT jed.sequence_nbr as sequenceNbr,
jed.apply_no as applyNo,
date_format(jed.apply_date, '%Y-%m-%d') as applyDate,
CASE
when
jed.apply_type = 1 then '停用'
else '启用' end as applyType,
jri.USE_ORG_CODE as useOrgCode,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory,
(SELECT name from tz_equipment_category where code = jri.EQU_DEFINE) as equDefine,
jri.PRODUCT_NAME as productName,
use.USE_UNIT_NAME as useUnitName,
jed.receive_org_name as receiveOrgName,
concat(use."PROVINCE_NAME", '-', use."CITY_NAME", '-', use."COUNTY_NAME", '-', use."STREET_NAME", '-', use."ADDRESS") as address,
use."USE_INNER_CODE" as useInnerCode,
jed.audit_status as auditStatus,
date_format(jed.audit_pass_date, '%Y-%m-%d') as auditPassDate,
jed.instance_id as instanceId,
jed.execute_sequence as executeSequence,
jed.next_executor_ids as nextExecutorIds,
jed.promoter
FROM tzs_jg_enable_disable jed
LEFT JOIN tzs_jg_enable_disable_eq jede on jed.sequence_nbr = jede.enable_disable_apply_id
LEFT JOIN idx_biz_jg_register_info jri on jede.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on jri.RECORD = use.RECORD
<where>
<if test="dto.applyNo != null and dto.applyNo != '' ">
and jed.apply_no like concat('%',#{dto.applyNo},'%')
</if>
<if test="dto.auditStatus != null and dto.auditStatus != '' ">
and jed.audit_status = #{dto.auditStatus}
</if>
<if test="dto.type == 'enterprise'">
and jed.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
<if test="dto.type == 'supervision'">
and jed.receive_org_code = #{dto.useUnitCreditCode}
</if>
<if test="dto.receiveOrgCode != null and dto.receiveOrgCode != ''">
and jed.receive_org_code = #{dto.receiveOrgCode}
</if>
<if test="dto.applyType != null and dto.applyType != ''">
and jed.apply_type = #{dto.applyType}
</if>
<if test="dto.roleIds != null and dto.type == 'supervision'">
<foreach collection='dto.roleIds' item='role' open='and (' close=')' separator='or'>
execute_sequence like concat('%',#{role},'%')
</foreach>
</if>
</where>
order by jed.rec_date desc
</select>
<select id="getDetail" resultType="java.util.Map">
SELECT jed.sequence_nbr as sequenceNbr,
concat(jed.receive_org_code,'_',jed.receive_org_name) as receiveOrgCode,
concat(use."PROVINCE_NAME", use."CITY_NAME", use."COUNTY_NAME", use."ADDRESS",
use.STREET_NAME) as fullAddress,
jri.EQU_CODE as equCode,
jed.apply_type as applyType,
jed.remark,
use.RECORD as record,
jfi.FACTORY_NUM as factoryNum
FROM tzs_jg_enable_disable jed
LEFT JOIN tzs_jg_enable_disable_eq jede on jed.sequence_nbr = jede.enable_disable_apply_id
LEFT JOIN idx_biz_jg_register_info jri on jede.equ_id = jri.RECORD
LEFT JOIN idx_biz_jg_use_info use on jri.RECORD = use.RECORD
LEFT JOIN idx_biz_jg_factory_info jfi on jri.RECORD = jfi.RECORD
where jed.sequence_nbr = #{sequenceNbr}
</select>
</mapper>
......@@ -5,14 +5,14 @@
</update>
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgEquipTransfer">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgEquipTransferDto">
select
jet.sequence_nbr AS sequenceNbr,
jet.apply_no AS applyNo,
jet.use_unit_credit_code AS useUnitCreditCode,
jet.use_unit_name AS useUnitName,
jet.apply_status AS applyStatus,
jet.apply_date AS applyDate,
date_format(jet.apply_date,'%Y-%m-%d') as applyDate,
jet.install_unit_credit_code AS installUnitCreditCode,
jet.equip_num AS equipNum,
jet.install_unit_name AS installUnitName,
......@@ -74,11 +74,14 @@
<if test="param.useUnitName != null and param.useUnitName != ''">
AND jet.use_unit_name LIKE CONCAT('%', #{param.useUnitName}, '%')
</if>
<if test="param.installUnitName != null and param.installUnitName != ''">
AND jet.install_unit_name LIKE CONCAT('%', #{param.installUnitName}, '%')
<if test="param.installUnitCreditCode != null and param.installUnitCreditCode != ''">
AND jet.install_unit_credit_code = #{param.installUnitCreditCode}
</if>
<if test="param.factoryNum != null and param.factoryNum != ''">
AND fi.factory_num LIKE CONCAT('%', #{param.factoryNum}, '%')
</if>
<if test="param.applyStatus != null and param.applyStatus != ''">
AND jet.apply_status = #{param.applyStatus}
<if test="param.applyDate != null and param.applyDate != ''">
AND date_format(jet.apply_date, '%Y-%m-%d') = #{param.applyDate}
</if>
</if>
<if test="type == 'useUnit'">
......
......@@ -106,7 +106,8 @@
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ei.legal_person AS safetyManager,
ei.legal_phone AS safetyManagerPhone,
ei.address AS address
ei.address AS address,
ei.use_code AS useCode
FROM
tzs_jg_installation_notice isn
LEFT JOIN tzs_jg_installation_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
......
......@@ -104,7 +104,8 @@
ei.legal_phone AS safetyManagerPhone,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
ei.ADDRESS AS useUnitAddress
ei.ADDRESS AS useUnitAddress,
ei.use_code AS useCode
FROM tzs_jg_maintain_notice isn
LEFT JOIN tzs_jg_maintain_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = re.equ_id
......
......@@ -133,9 +133,6 @@
<if test="contractDto.useUnitName != '' and contractDto.useUnitName != null">
and use_unit_name like concat('%',#{contractDto.useUnitName},'%')
</if>
<if test="contractDto.status != '' and contractDto.status != null">
and status not like concat('%',#{contractDto.status},'%')
</if>
<if test="contractDto.useUnitCode != '' and contractDto.useUnitCode != null">
and use_unit_code = #{contractDto.useUnitCode}
</if>
......
......@@ -125,7 +125,8 @@
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ei.legal_person AS safetyManager,
ei.legal_phone AS safetyManagerPhone,
ei.ADDRESS AS useUnitAddress
ei.ADDRESS AS useUnitAddress,
ei.use_code AS useCode
FROM
tzs_jg_reform_notice isn
LEFT JOIN tzs_jg_reform_notice_eq re ON re.equip_transfer_id = isn.sequence_nbr
......
......@@ -129,7 +129,8 @@
ui.PROVINCE_NAME AS useUnitProvinceName,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
ui.ADDRESS AS useUnitAddress
ui.ADDRESS AS useUnitAddress,
ei.use_code AS useCode
FROM
tzs_jg_transfer_notice tjtn
LEFT JOIN tzs_jg_transfer_notice_eq re ON re.equip_transfer_id = tjtn.sequence_nbr
......@@ -138,6 +139,7 @@
LEFT JOIN idx_biz_jg_factory_info fi ON fi.record = re.equ_id
LEFT JOIN idx_biz_jg_inspection_detection_info idi ON idi.record = re.equ_id
LEFT JOIN idx_biz_jg_use_info ui ON ui.record = re.equ_id
LEFT JOIN tz_base_enterprise_info ei ON ei.use_code = tjtn.use_unit_credit_code
WHERE
tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.dto.JgScrapCancelDto;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.*;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationNameServiceImpl;
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 org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationNameDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 更名变更登记
*
* @author system_generator
* @date 2023-12-25
*/
@RestController
@Api(tags = "更名变更登记Api")
@RequestMapping(value = "/jg-change-registration-name")
public class JgChangeRegistrationNameController extends BaseController {
@Autowired
JgChangeRegistrationNameServiceImpl jgChangeRegistrationNameService;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增/新增并提交", notes = "新增/新增并提交")
public ResponseModel<Object> save(@RequestParam String submitType, @RequestBody Map<String, JSONObject> model) {
jgChangeRegistrationNameService.save(submitType, model);
return ResponseHelper.buildResponse("ok");
}
/**
* 根据sequenceNbr更新
*
* @param model 安装告知
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/updateInfo")
@ApiOperation(httpMethod = "POST", value = "编辑API", notes = "编辑API")
public ResponseModel<JgChangeRegistrationNameDto> updateInfo(@RequestParam String submitType,
@RequestBody Map<String, Object> model,
@RequestParam(value = "op", required = false) String op) {
JgChangeRegistrationNameDto dto = BeanUtil.mapToBean(((LinkedHashMap) model.get("jgRegistrationInfo")), JgChangeRegistrationNameDto.class, true);
if (Objects.isNull(dto)) {
throw new IllegalArgumentException("参数jgRegistrationInfo不能为空");
}
Object o = ((LinkedHashMap<?, ?>) model.get("jgRegistrationInfo")).get("changeCertificateList");
dto.setChangeCertificateList((List<Map<String, Object>>) o);
return ResponseHelper.buildResponse(jgChangeRegistrationNameService.updateInfo(submitType, dto, op));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/deleteMessage")
@ApiOperation(httpMethod = "POST", value = "单个删除", notes = "单个删除")
public ResponseModel<Object> deleteMessage(@RequestParam("id") Long id) {
List<Long> ids = Collections.singletonList(id);
jgChangeRegistrationNameService.deleteBatch(ids);
return ResponseHelper.buildResponse("ok");
}
/**
* 撤回
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/withdraw")
@ApiOperation(httpMethod = "POST", value = "撤回", notes = "撤回")
public ResponseModel<Object> revocation(@RequestBody JSONObject map) {
jgChangeRegistrationNameService.revocation(String.valueOf(map.get("instanceId")));
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
LinkedHashMap model1 = (LinkedHashMap) map.get("model");
LinkedHashMap jgRegistrationInfoMap = (LinkedHashMap) model1.get("jgRegistrationInfo");
JgChangeRegistrationNameDto jgScrapCancelDto = JSON.parseObject(JSON.toJSONString(jgRegistrationInfoMap), JgChangeRegistrationNameDto.class);
jgChangeRegistrationNameService.flowExecute(Long.valueOf(String.valueOf(jgScrapCancelDto.getSequenceNbr())), jgScrapCancelDto.getInstanceId(), String.valueOf(map.get("operate")), String.valueOf(map.get("opinion")));
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "列表全部数据查询", notes = "列表全部数据查询")
@PostMapping(value = "/getList")
public ResponseModel<Page<Map<String, Object>>> getList(JgChangeRegistrationNameDto dto,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size) {
Page<Map<String, Object>> page = new Page<>(current, size);
return ResponseHelper.buildResponse(jgChangeRegistrationNameService.getList(dto, page, dto.getRoleIds()));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/details")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个详情", notes = "根据sequenceNbr查询单个详情")
public ResponseModel<Map<String, Object>> selectOne(@RequestParam(required = false, value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgChangeRegistrationNameService.queryBySequenceNbr(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表筛选办理状态下拉", notes = "列表筛选办理状态下拉")
@GetMapping(value = "/getAuditStatusList")
public ResponseModel<List<Map<String, String>>> getAuditStatusList(@RequestParam(value = "code") String code) {
return ResponseHelper.buildResponse(WorkFlowStatusEnum.getInfoList(code));
}
}
......@@ -128,4 +128,12 @@ public class JgChangeRegistrationReformController extends BaseController {
map.put("useUnitName", selectedOrgInfo.getCompany().getCompanyName());
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "打印历史数据", notes = "打印历史数据")
@GetMapping(value = "/printHistoryData")
public ResponseModel<Map<String, Object>> printHistoryData(@RequestParam("currentDocumentId") String currentDocumentId,@RequestParam(value = "equipId",required = false) String equipId) {
return ResponseHelper.buildResponse(jgChangeRegistrationReformServiceImpl.getDetail(currentDocumentId,equipId));
}
}
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.netflix.ribbon.proxy.annotation.Http;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.Map;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationTransferServiceImpl;
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.JgChangeRegistrationTransferDto;
......@@ -145,4 +152,11 @@ public class JgChangeRegistrationTransferController extends BaseController {
return ResponseHelper.buildResponse(jgChangeRegistrationTransferService.queryListForPage(page,params));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/export")
@ApiOperation(httpMethod = "GET", value = "导出使用登记证", notes = "导出使用登记证")
public void exportImageZip(HttpServletResponse response, @RequestParam("sequenceNbr") String sequenceNbr){
jgChangeRegistrationTransferService.exportUseRegistrationCertificate(sequenceNbr, response);
}
}
......@@ -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;
......@@ -70,15 +76,13 @@ public class JgChangeRegistrationUnitController extends BaseController {
@PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新单位变更", notes = "根据sequenceNbr更新单位变更")
public ResponseModel<JgChangeRegistrationUnitDto> updateBySequenceNbrJgInstallationNotice(@RequestParam String submitType, @RequestBody Map<String, Object> model, @RequestParam(value = "op", required = false) String op) {
JgChangeRegistrationUnitDto installationInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("changeRegisInfo")), JgChangeRegistrationUnitDto.class, true);
if (Objects.isNull(installationInfo)) {
JgChangeRegistrationUnitDto jgChangeRegistrationUnitDto = BeanUtil.mapToBean(((LinkedHashMap) model.get("changeRegisInfo")), JgChangeRegistrationUnitDto.class, true);
if (Objects.isNull(jgChangeRegistrationUnitDto)) {
throw new IllegalArgumentException("参数installationInfo不能为空");
}
// Object o = ((LinkedHashMap<?, ?>) model.get("installationInfo")).get("proxyStatementAttachment");
// Object o1 = ((LinkedHashMap<?, ?>) model.get("installationInfo")).get("installContractAttachment");
// installationInfo.setProxyStatementAttachmentList((List<Map<String, Object>>) o);
// installationInfo.setInstallContractAttachmentList((List<Map<String, Object>>) o1);
return ResponseHelper.buildResponse(jgChangeRegistrationUnitServiceImpl.updateInstallationNotice(submitType,installationInfo, op));
Object o = ((LinkedHashMap<?, ?>) model.get("changeRegisInfo")).get("changeCertificateList");
jgChangeRegistrationUnitDto.setChangeCertificateList((List<Map<String, Object>>) o);
return ResponseHelper.buildResponse(jgChangeRegistrationUnitServiceImpl.updateInstallationNotice(submitType,jgChangeRegistrationUnitDto, op));
}
/**
......@@ -145,16 +149,6 @@ public class JgChangeRegistrationUnitController extends BaseController {
}
/**
* 生成告知单
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "单位变更列表全部数据查询", notes = "单位变更列表全部数据查询")
@GetMapping(value = "/generate-report")
public ResponseModel<String> generateReport(@RequestParam("sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgChangeRegistrationUnitServiceImpl.generateInstallationNoticeReport(sequenceNbr));
}
/**
* 撤销
*
* @return
......@@ -163,7 +157,7 @@ public class JgChangeRegistrationUnitController extends BaseController {
@PostMapping(value = "/cancel")
@ApiOperation(httpMethod = "POST", value = "单位变更撤销", notes = "单位变更撤销")
public ResponseModel<JgChangeRegistrationUnitDto> cancel(@RequestBody Map<String, Object> model) {
JgChangeRegistrationUnitDto installationInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("installationInfo")), JgChangeRegistrationUnitDto.class, true);
JgChangeRegistrationUnitDto installationInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("changeRegisInfo")), JgChangeRegistrationUnitDto.class, true);
if (Objects.isNull(installationInfo)) {
throw new IllegalArgumentException("参数installationInfo不能为空");
}
......@@ -181,12 +175,21 @@ public class JgChangeRegistrationUnitController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "单位变更受理", notes = "单位变更受理")
public ResponseModel<JgChangeRegistrationUnitDto> accept(@RequestBody Map<String, Object> model, String op) {
// TODO 受理单位变更流程
LinkedHashMap model1 = (LinkedHashMap)model.get("model");
LinkedHashMap model1 = (LinkedHashMap)model.get("changeRegisInfo");
String opinion = (String)model.get("opinion");
LinkedHashMap installationInfo = (LinkedHashMap)model1.get("installationInfo");
LinkedHashMap installationInfo = (LinkedHashMap)model1.get("changeRegisInfo");
JgChangeRegistrationUnitDto jgInstallationNoticeDto = JSON.parseObject(JSON.toJSONString(installationInfo), JgChangeRegistrationUnitDto.class);
jgInstallationNoticeDto.setProcessAdvice(opinion);
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 {
jgChangeRegistrationUnitServiceImpl.exportUseRegistrationCertificate(sequenceNbr, response);
}
}
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEnableDisable;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgEnableDisableServiceImpl;
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 org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgEnableDisableDto;
......@@ -18,8 +26,6 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
*
*
* @author system_generator
* @date 2023-12-25
*/
......@@ -37,80 +43,55 @@ public class JgEnableDisableController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<JgEnableDisableDto> save(@RequestBody JgEnableDisableDto model) {
model = jgEnableDisableServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<Object> save(@RequestBody JSONObject map) {
jgEnableDisableServiceImpl.saveOrUpdate(map);
return ResponseHelper.buildResponse("ok");
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<JgEnableDisableDto> updateBySequenceNbrJgEnableDisable(@RequestBody JgEnableDisableDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.updateWithModel(model));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "使用登记设备关系表分页查询", notes = "使用登记设备关系表分页查询")
public ResponseModel<Page<Map<String, Object>>> page(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
JgEnableDisableDto dto) {
Page<Map<String, Object>> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.pageList(page, dto));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.removeById(sequenceNbr));
@PostMapping(value = "/flowExecute")
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgEnableDisableServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))), String.valueOf(map.get("instanceId")), String.valueOf(map.get("operate")), String.valueOf(map.get("comment")));
return ResponseHelper.buildResponse("ok");
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<JgEnableDisableDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<JgEnableDisableDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<JgEnableDisableDto> page = new Page<JgEnableDisableDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.queryForJgEnableDisablePage(page));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/withdraw")
@ApiOperation(httpMethod = "POST", value = "撤回", notes = "撤回")
public ResponseModel<Object> withdraw(@RequestBody JSONObject map) {
jgEnableDisableServiceImpl.withdraw(String.valueOf(map.get("instanceId")));
return ResponseHelper.buildResponse("ok");
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<JgEnableDisableDto>> selectForList() {
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.queryForJgEnableDisableList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/deleteMessage")
@ApiOperation(httpMethod = "DELETE", value = "删除", notes = "删除")
public ResponseModel<Object> deleteMessage(@RequestParam("sequenceNbr") Long sequenceNbr) {
jgEnableDisableServiceImpl.deleteMessage(sequenceNbr);
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/detail")
@ApiOperation(httpMethod = "GET", value = "详情", notes = "详情")
public ResponseModel<Object> detail(@RequestParam("sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgEnableDisableServiceImpl.getDetail(sequenceNbr));
}
}
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.yeejoin.amos.boot.module.jg.api.common.BaseException;
import com.yeejoin.amos.boot.module.jg.api.entity.JgEquipTransfer;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
......@@ -109,13 +108,13 @@ public class JgEquipTransferController extends BaseController {
* @return Page
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "设备移交分页查询", notes = "设备移交分页查询")
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST", value = "设备移交分页查询", notes = "设备移交分页查询")
public ResponseModel<Page<JgEquipTransferDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@ApiParam(value = "类型:useUnit-使用单位、installUnit-施工单位", required = true) @RequestParam(value = "type", defaultValue = "useUnit") String type,
@RequestBody(required = false) JgEquipTransferDto dto) {
Page<JgEquipTransfer> page = new Page<>(current, size);
Page<JgEquipTransferDto> page = new Page<>(current, size);
return ResponseHelper.buildResponse(jgEquipTransferServiceImpl.queryForJgEquipTransferPage(page, dto, type, getSelectedOrgInfo()));
}
......@@ -132,7 +131,7 @@ public class JgEquipTransferController extends BaseController {
String companyCode = companyModels.get(0).getCompanyCode();
String companyName = companyModels.get(0).getCompanyName();
Map<String, Object> map = new HashMap<>();
if("个人主体".equals(companyType)){
if ("个人主体".equals(companyType)) {
map.put("useUnitName", companyName.split("_")[1]);
map.put("useUnitCreditCode", companyCode.split("_")[1]);
map.put("companyType", "person");
......
......@@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.JgMaintenanceContractDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
import com.yeejoin.amos.boot.module.jg.api.vo.JgMaintenanceContractVo;
......@@ -15,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -36,6 +39,9 @@ public class JgMaintenanceContractController extends BaseController {
@Autowired
JgMaintenanceContractServiceImpl jgMaintenanceContractServiceImpl;
@Autowired
RedisUtils redisUtils;
/**
* 新增(提交)
*
......@@ -170,6 +176,7 @@ public class JgMaintenanceContractController extends BaseController {
@ApiOperation(httpMethod = "POST", value = "执行流程", notes = "执行流程")
public ResponseModel<Object> flowExecute(@RequestBody JSONObject map) {
jgMaintenanceContractServiceImpl.flowExecute(Long.valueOf(String.valueOf(map.get("sequenceNbr"))),String.valueOf(map.get("instanceId")), String.valueOf(map.get("operate")), String.valueOf(map.get("comment")), true);
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (map.containsKey("formData") && !ObjectUtils.isEmpty(map.get("formData"))){
JgMaintenanceContract dto = new JgMaintenanceContract();
Map<String, Object> formData = (Map<String, Object>)map.get("formData");
......@@ -188,6 +195,7 @@ public class JgMaintenanceContractController extends BaseController {
result.setMaintenanceManagerTwoId(maintenanceManagerTwoInfo[0]);
result.setMaintenanceManagerTwoName(maintenanceManagerTwoInfo[1]);
result.setMaintenanceManagerTwoPhone(dto.getMaintenanceManagerTwoPhone());
result.setPromoter(reginParams.getUserModel().getUserId());
}
jgMaintenanceContractServiceImpl.getBaseMapper().updateById(result);
}
......
......@@ -8,6 +8,8 @@ import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.utils.ImageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -19,10 +21,10 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.io.File;
import java.util.*;
/**
* 移装造告知
......@@ -38,6 +40,9 @@ public class JgTransferNoticeController extends BaseController {
@Autowired
private IJgTransferNoticeService jgTransferNoticeService;
@Autowired
private ICommonService commonService;
/**
* 新增移装造告知
*
......@@ -148,9 +153,34 @@ public class JgTransferNoticeController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "移装告知列表全部数据查询", notes = "移装造告知列表全部数据查询")
@ApiOperation(httpMethod = "GET", value = "移装告知列表全部数据查询", notes = "移装造告知列表全部数据查询")
@GetMapping(value = "/generate-report")
public ResponseModel<String> selectForList(@RequestParam("sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgTransferNoticeService.generateTransferNoticeReport(sequenceNbr));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "特种设备登记证导出", notes = "特种设备登记证导出")
@GetMapping(value = "/certificate/report")
public void generateCertificateReport(HttpServletResponse response) {
Map<String, Object> map = new HashMap<>();
// 组装模板变量
map.put("useRegistrationCode", "202301256456"); // 编号
map.put("useUnitName", "西安市高科物业服务有限公司"); // 使用单位名称
map.put("fullAddress", "西安市曲江新区春临东街南湖意境1单元2号楼"); // 设备使用地点
map.put("equList", "电梯"); // 设备种类
map.put("equDefine", "曳引驱动电梯"); // 设备品种
map.put("equipCode", ""); // 设备代码
map.put("equCategory", "曳引电梯"); // 设备类别
map.put("useInnerCode", "KY-9527"); // 单位内编号
map.put("factoryNum", "G60001"); // 产品编号
map.put("receiveOrgName", "西安市曲江新区质检院"); // 登记机关
map.put("giveOutYear", "2023"); // 发证日期-年
map.put("giveOutMonth", "12"); // 发证日期-月
map.put("giveOutDay", "26"); // 发证日期-日
// 生成二维码
String qrCode = ImageUtils.generateQRCode("YZGZ20231225001", 70, 65);
map.put("supervisoryCode", qrCode); // 监管二维码
commonService.generateCertificateReport(map, response);
}
}
......@@ -2,7 +2,10 @@ package com.yeejoin.amos.boot.module.jg.biz.service;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -32,4 +35,6 @@ public interface ICommonService {
Map<String,Object> getEnterpriseInfo(String sequenceNbr);
List<Map<String,Object>> getEnterpriseEmployee(String unitCode);
void generateCertificateReport(Map<String, Object> map, HttpServletResponse response);
}
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.aspose.words.SaveFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.utils.FileExporter;
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.PrivilegeFeginService;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgFactoryInfoMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.Collectors;
......@@ -71,6 +81,20 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
PrivilegeFeginService privilegeFeginService;
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public List<EquipmentCategory> getEquipmentCategoryList(String code, String type) {
List<EquipmentCategory> result = new ArrayList<>();
......@@ -258,4 +282,94 @@ public class CommonServiceImpl implements ICommonService {
}
return result;
}
@Override
public void generateCertificateReport(Map<String, Object> map, HttpServletResponse response) {
if (CollectionUtils.isEmpty(map)) {
throw new IllegalArgumentException("参数不能为空");
}
// 组装模板变量
map.put("useRegistrationCode", Optional.ofNullable(map.get("useRegistrationCode")).orElse("").toString()); // 编号
map.put("useUnitName", Optional.ofNullable(map.get("useUnitName")).orElse("").toString()); // 使用单位名称
map.put("fullAddress", Optional.ofNullable(map.get("fullAddress")).orElse("").toString()); // 设备使用地点
map.put("equList", Optional.ofNullable(map.get("equList")).orElse("").toString()); // 设备种类
map.put("equipDefine", Optional.ofNullable(map.get("equipDefine")).orElse("").toString()); // 设备品种
map.put("equipCode", Optional.ofNullable(map.get("equipCode")).orElse("").toString()); // 设备代码
map.put("equipCategory", Optional.ofNullable(map.get("equipCategory")).orElse("").toString()); // 设备类别
map.put("useInnerCode", Optional.ofNullable(map.get("useInnerCode")).orElse("").toString()); // 单位内编号
map.put("factoryNum", Optional.ofNullable(map.get("factoryNum")).orElse("").toString()); // 产品编号
map.put("receiveOrgName", Optional.ofNullable(map.get("receiveOrgName")).orElse("").toString()); // 登记机关
map.put("giveOutYear", Optional.ofNullable(map.get("giveOutYear")).orElse("").toString()); // 发证日期-年
map.put("giveOutMonth", Optional.ofNullable(map.get("giveOutMonth")).orElse("").toString()); // 发证日期-月
map.put("giveOutDay", Optional.ofNullable(map.get("giveOutDay")).orElse("").toString()); // 发证日期-日
// 生成二维码
String qrCode = ImageUtils.generateQRCode(Optional.ofNullable(map.get("supervisoryCode")).orElse("").toString(), 70, 65);
map.put("supervisoryCode", qrCode); // 监管二维码
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("equipment-registration-certificate-report.ftl", map);
} catch (Exception e) {
throw new RuntimeException(e);
}
// // 上传pdf至文件服务器
// String url = this.uploadFile(pdfFile);
// 删除临时文件
// try {
// Files.deleteIfExists(pdfFile.toPath());
// } catch (IOException e) {
// log.error("删除临时文件失败:{}", e);
// }
try {
byte[] bytes = file2byte(pdfFile);
String docTitle = pdfFile.getName();
FileExporter.exportFile(FileExporter.FileType.valueOf("pdf"), docTitle, bytes, response);
} catch (Exception e) {
log.error("pdf文件转换失败:{}", e);
} finally {
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
}
}
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "特种设备使用登记证_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private String uploadFile(File file) {
Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
String urlString = "";
if (result != null) {
for (String s : result.getResult().keySet()) {
urlString = s;
}
}
return urlString;
}
}
\ No newline at end of file
......@@ -213,23 +213,51 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*/
private Map<String, Object> getStringObjectMap(String record, String fieldType) {
Map<String, Object> objMap = new HashMap<>();
String province="";
String city="";
String county="";
String street="";
String fullAddress="";
//使用信息
IdxBizJgUseInfo useInfo = idxBizJgUseInfoService.getOneData(record);
if (!ValidationUtil.isEmpty(useInfo)) {
if(!ValidationUtil.isEmpty(useInfo.getProvince()) && !ValidationUtil.isEmpty(useInfo.getProvinceName())){
province = useInfo.getProvince()+"_"+useInfo.getProvinceName();
fullAddress += useInfo.getProvinceName();
}
if(!ValidationUtil.isEmpty(useInfo.getCity()) && !ValidationUtil.isEmpty(useInfo.getCityName())) {
city = useInfo.getCity() + "_" + useInfo.getCityName();
fullAddress += useInfo.getCityName();
}
if(!ValidationUtil.isEmpty(useInfo.getCounty()) && !ValidationUtil.isEmpty(useInfo.getCountyName())) {
county = useInfo.getCounty() + "_" + useInfo.getCountyName();
fullAddress += useInfo.getCountyName();
}
if(!ValidationUtil.isEmpty(useInfo.getFactoryUseSiteStreet()) && !ValidationUtil.isEmpty(useInfo.getStreetName())) {
street = useInfo.getFactoryUseSiteStreet() + "_" + useInfo.getStreetName();
fullAddress += useInfo.getStreetName();
}
if(!ValidationUtil.isEmpty(useInfo.getAddress())) {
fullAddress += useInfo.getAddress();
}
Map<String, Object> useInfoMap = null;
if(!ValidationUtil.isEmpty(fieldType)){
useInfoMap = Bean.BeantoMap(useInfo);
useInfoMap.put("province", useInfo.getProvince()+"_"+useInfo.getProvinceName());
useInfoMap.put("city", useInfo.getCity()+"_"+useInfo.getCityName());
useInfoMap.put("county", useInfo.getCounty()+"_"+useInfo.getCountyName());
useInfoMap.put("street", useInfo.getFactoryUseSiteStreet()+"_"+useInfo.getStreetName());
if(!ValidationUtil.isEmpty(province)){ useInfoMap.put("province", province); }
if(!ValidationUtil.isEmpty(city)) { useInfoMap.put("city", city); }
if(!ValidationUtil.isEmpty(county)) { useInfoMap.put("county", county); }
if(!ValidationUtil.isEmpty(street)) { useInfoMap.put("street", street); }
if(!ValidationUtil.isEmpty(fullAddress)) { useInfoMap.put("fullAddress", fullAddress); }
useInfoMap.put("useinfoSeq", useInfo.getSequenceNbr());
}else {
useInfoMap = convertCamelToUnderscore(useInfo, null);
useInfoMap.put("PROVINCE", useInfo.getProvince()+"_"+useInfo.getProvinceName());
useInfoMap.put("CITY", useInfo.getCity()+"_"+useInfo.getCityName());
useInfoMap.put("COUNTY", useInfo.getCounty()+"_"+useInfo.getCountyName());
useInfoMap.put("STREET", useInfo.getFactoryUseSiteStreet()+"_"+useInfo.getStreetName());
if(!ValidationUtil.isEmpty(province)){ useInfoMap.put("PROVINCE", province); }
if(!ValidationUtil.isEmpty(city)) { useInfoMap.put("CITY", city); }
if(!ValidationUtil.isEmpty(county)) { useInfoMap.put("COUNTY", county); }
if(!ValidationUtil.isEmpty(street)) { useInfoMap.put("STREET", street); }
if(!ValidationUtil.isEmpty(fullAddress)){ useInfoMap.put("FULLADDRESS", fullAddress); }
useInfoMap.put("USEINFO_SEQ", useInfo.getSequenceNbr());
}
if(!useInfoMap.isEmpty()){
......
......@@ -40,6 +40,7 @@ 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.util.*;
import java.util.stream.Collectors;
/**
* 改造变更登记服务实现类
......@@ -81,7 +82,12 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
private IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
@Autowired
private IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
//单位变更登记关系表mapper
@Autowired
private JgChangeRegistrationUnitEqMapper jgChangeRegistrationUnitEqMapper;
//更名变更登记关系表mapper
@Autowired
private JgChangeRegistrationNameEqMapper jgChangeRegistrationNameEqMapper;
/**
* 分页查询
......@@ -188,7 +194,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReformEq.setEquipTransferId(jgChangeRegistrationReform.getSequenceNbr().toString());
jgChangeRegistrationReformEqMapper.insert(jgChangeRegistrationReformEq);
//当前单据id
jgRegistrationHistory.setCurrentDocumentId(jgChangeRegistrationReform.getSequenceNbr().toString());
jgRegistrationHistory.setCurrentDocumentId(jgChangeRegistrationReform.getApplyNo());
jgRegistrationHistoryMapper.insert(jgRegistrationHistory);
}
......@@ -281,7 +287,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = jgChangeRegistrationReformEqMapper.selectOne(new QueryWrapper<JgChangeRegistrationReformEq>().eq("equip_transfer_id", jgChangeRegistrationReform.getSequenceNbr()));
String newUseRegistrationCertificateNumber = getCode(jgChangeRegistrationReform.getSupervisoryCode());
jgChangeRegistrationReform.setUseRegistrationCode(newUseRegistrationCertificateNumber);
updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString(),newUseRegistrationCertificateNumber );
updateTechparamsByEquIdAndCurrentDoucumentId(jgChangeRegistrationReformEq.getEquId(), jgChangeRegistrationReform.getSequenceNbr().toString(),newUseRegistrationCertificateNumber,jgChangeRegistrationReform.getApplyNo() );
}
this.getBaseMapper().updateById(jgChangeRegistrationReform);
}
......@@ -422,16 +428,19 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
}
public void deleteBatch(List<Long> ids) {
List<JgChangeRegistrationReform> jgChangeRegistrationReformList = this.getBaseMapper().selectList(new QueryWrapper<JgChangeRegistrationReform>().in("sequence_nbr", ids));
List<String> applyNos =jgChangeRegistrationReformList.stream().map(JgChangeRegistrationReform::getApplyNo).collect(Collectors.toList());
JgChangeRegistrationReform jgChangeRegistrationReform = new JgChangeRegistrationReform();
jgChangeRegistrationReform.setIsDelete(true);
LambdaQueryWrapper<JgChangeRegistrationReform> lambda = new QueryWrapper<JgChangeRegistrationReform>().lambda();
lambda.in(JgChangeRegistrationReform::getSequenceNbr, ids);
this.update(jgChangeRegistrationReform, lambda);
this.getBaseMapper().delete(lambda);
JgChangeRegistrationReformEq jgChangeRegistrationReformEq = new JgChangeRegistrationReformEq();
jgChangeRegistrationReformEq.setIsDelete(true);
LambdaQueryWrapper<JgChangeRegistrationReformEq> lambda1 = new QueryWrapper<JgChangeRegistrationReformEq>().lambda();
lambda1.in(JgChangeRegistrationReformEq::getEquipTransferId, ids);
jgChangeRegistrationReformEqMapper.update(jgChangeRegistrationReformEq, lambda1);
jgChangeRegistrationReformEqMapper.delete(lambda1);
jgRegistrationHistoryMapper.delete(new QueryWrapper<JgRegistrationHistory>().in("current_document_id", applyNos));
}
public Map<String, Object> getDetail(String currentDocumentId, String equipId) {
......@@ -454,7 +463,7 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
} else {
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryMapper.selectOne(new QueryWrapper<JgRegistrationHistory>()
.eq("equ_id", equipId)
.eq("current_document_id", currentDocumentId)
.eq("current_document_id", jgChangeRegistrationReform.getApplyNo())
.eq("registration_class", "改造登记"));
originalData = JSONObject.parseObject(jgRegistrationHistory.getChangeData(), Map.class);
originalData.remove("sequenceNbr");
......@@ -474,6 +483,10 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
jgChangeRegistrationReformEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
jgChangeRegistrationTransferEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
jgUseRegistrationEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
//单位变更登记
jgChangeRegistrationUnitEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
//更名变更登记
jgChangeRegistrationNameEqMapper.updateEquipIsVaildByEquipIdAndCurrentDocumentId(equipmentId, currentDocumentId);
}
/**
......@@ -482,12 +495,12 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
* @param equipId
* @param currentDocumentId
*/
public void updateTechparamsByEquIdAndCurrentDoucumentId(String equipId, String currentDocumentId, String newUseRegistrationCertificateNumber) {
public void updateTechparamsByEquIdAndCurrentDoucumentId(String equipId, String currentDocumentId, String newUseRegistrationCertificateNumber,String applyNo) {
IdxBizJgTechParamsElevator idxBizJgTechParamsElevator = idxBizJgTechParamsElevatorMapper.selectOne(new QueryWrapper<IdxBizJgTechParamsElevator>().eq("RECORD", equipId));
JgRegistrationHistory jgRegistrationHistory = jgRegistrationHistoryMapper.selectOne(new QueryWrapper<JgRegistrationHistory>()
.eq("equ_id", equipId)
.eq("current_document_id", currentDocumentId)
.eq("current_document_id", applyNo)
.eq("registration_class", "改造登记"));
if (!ObjectUtils.isEmpty(idxBizJgTechParamsElevator) && !ObjectUtils.isEmpty(jgRegistrationHistory)) {
......@@ -500,7 +513,8 @@ public class JgChangeRegistrationReformServiceImpl extends BaseService<JgChangeR
BeanUtil.copyProperties(idxBizJgTechParamsElevatorNew, idxBizJgTechParamsElevator, "sequenceNbr", "record");
idxBizJgTechParamsElevatorMapper.updateById(idxBizJgTechParamsElevator);
//将历史数据回填到历史记录表中
jgRegistrationHistory.setChangeData(historyData);
jgRegistrationHistory.setChangeData(newData);
jgRegistrationHistory.setOldData(historyData);
jgRegistrationHistory.setStatus("history");
jgRegistrationHistoryMapper.updateById(jgRegistrationHistory);
makeEquipmentsInvalid(equipId, currentDocumentId);
......
......@@ -30,6 +30,7 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.boot.module.ymt.api.service.ITzBaseUnitLicenceService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
......@@ -124,21 +125,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Autowired
private RedisUtils redisUtils;
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Autowired
private TzBaseUnitLicenceMapper baseUnitLicenceMapper;
/**
* 根据sequenceNbr查询
......@@ -334,6 +322,23 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
Map<String, Object> installation = informationList.get(0);
String useCode = String.valueOf(installation.get("useCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
ArrayList<String> installLicenseNoList = new ArrayList<>();
ArrayList<String> installLicenseExpirationDateList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(tzBaseUnitLicence -> {
// 因模板许可证编号配置最多支持三个,再多样式混乱,目前返回三个
if (installLicenseNoList.size() < 3) {
installLicenseNoList.add(tzBaseUnitLicence.getCertNo());
installLicenseExpirationDateList.add(DateUtils.convertDateToString(tzBaseUnitLicence.getExpiryDate(), DateUtils.DATE_PATTERN));
}
});
}
Function<String, String> getValue = key -> installation.getOrDefault(key, "").toString();
// 组装模板变量
......@@ -359,27 +364,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
placeholders.put("useUnitLeaderAddress", getValue.apply("address"));
placeholders.put("installLicenseNoList", installLicenseNoList);
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("installation-notification-report.ftl", placeholders);
} catch (Exception e) {
throw new RuntimeException(e);
}
// 上传pdf至文件服务器
String url = this.uploadFile(pdfFile);
// 删除临时文件
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (IOException e) {
log.error("删除临时文件失败:{}", e);
}
String url = WordTemplateUtils.templateToPdf("installation-notification-report.ftl", placeholders);
// 更新到数据库
jgInstallationNotice.setNoticeReportUrl(url);
......@@ -388,40 +381,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
return url;
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "安装告知单_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private String uploadFile(File file) {
Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
String urlString = "";
if (result != null) {
for (String s : result.getResult().keySet()) {
urlString = s;
}
}
return urlString;
}
@Override
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
......@@ -785,10 +744,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
map1.put("USE_UNIT_CREDIT_CODE",jgInstallationNotice.getUseUnitCreditCode());
map1.put("USE_UNIT_NAME",jgInstallationNotice.getUseUnitName());
ReginParams reginParams = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(),
RequestContext.getToken())).toString(), ReginParams.class);
map1.put("USC_UNIT_CREDIT_CODE",reginParams.getCompany().getCompanyCode());
map1.put("USC_UNIT_NAME",reginParams.getCompany().getCompanyName());
map1.put("USC_UNIT_CREDIT_CODE",jgInstallationNotice.getInstallUnitCreditCode());
map1.put("USC_UNIT_NAME",jgInstallationNotice.getInstallUnitName());
objMap.put(tzsJgOtherInfo.getRecord(),map1);
jgInstallationNotice.setPromoter("");
tzsServiceFeignClient.commonUpdateEsDataByIds(objMap);
......@@ -815,7 +772,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 使用信息表更新是否西咸
IdxBizJgUseInfo useInfo = useInfoService.getOneData(jgRelationEquip.getEquId());
if (!ObjectUtils.isEmpty(useInfo)) {
useInfo.setIsNotXiXian(jgInstallationNotice.getIsXixian() == null ? "null" : jgInstallationNotice.getIsXixian().equals("0") ? "null" : "1");
useInfo.setIsNotXiXian(jgInstallationNotice.getIsXixian() == null ? "0" : jgInstallationNotice.getIsXixian());
useInfoService.saveOrUpdateData(useInfo);
}
......
......@@ -23,12 +23,10 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
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.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseUnitLicence;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
......@@ -96,19 +94,9 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
@Autowired
RedisUtils redisUtils;
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Autowired
private TzBaseUnitLicenceMapper baseUnitLicenceMapper;
/**
* 根据sequenceNbr查询
......@@ -293,6 +281,24 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
throw new IllegalArgumentException("维修告知单不存在");
}
Map<String, Object> installation = informationList.get(0);
String useCode = String.valueOf(installation.get("useCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
ArrayList<String> installLicenseNoList = new ArrayList<>();
ArrayList<String> installLicenseExpirationDateList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(tzBaseUnitLicence -> {
// 因模板许可证编号配置最多支持三个,再多样式混乱,目前返回三个
if (installLicenseNoList.size() < 3) {
installLicenseNoList.add(tzBaseUnitLicence.getCertNo());
installLicenseExpirationDateList.add(DateUtils.convertDateToString(tzBaseUnitLicence.getExpiryDate(), DateUtils.DATE_PATTERN));
}
});
}
Function<String, String> getValue = key -> installation.getOrDefault(key, "").toString();
// 组装模板变量
Map<String, Object> placeholders = new HashMap<>();
......@@ -320,59 +326,17 @@ public class JgMaintainNoticeServiceImpl extends BaseService<JgMaintainNoticeDto
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("installation-notification-report.ftl", placeholders);
} catch (Exception e) {
log.error("word转pdf失败:{}", e);
throw new RuntimeException(e);
}
// 上传pdf至文件服务器
String url = this.uploadFile(pdfFile);
// 删除临时文件
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (IOException e) {
log.error("删除临时文件失败:{}", e);
throw new RuntimeException(e);
}
placeholders.put("installLicenseNoList", installLicenseNoList);
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);
String url = WordTemplateUtils.templateToPdf("installation-notification-report.ftl", placeholders);
// 更新到数据库
JgMaintainNotice.setNoticeReportUrl(url);
this.updateById(JgMaintainNotice);
return url;
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "维修告知单_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private String uploadFile(File file) {
Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
String urlString = "";
if (result != null) {
for (String s : result.getResult().keySet()) {
urlString = s;
}
}
return urlString;
}
@Override
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
......
......@@ -94,12 +94,10 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
//使用单位用"使用单位统一信用代码"匹配数据
dto.setUseUnitCode(company.getCompanyCode());
dto.setRoleIds(null);
dto.setStatus(null);
contractList = maintenanceContractMapper.getContractList(page, dto);
} else if (MaintenanceEnum.WEIBAO.getCode().equals(phase)) {
//维保单位用"维保单位统一信用代码"匹配数据
dto.setMaintenanceUnitCode(company.getCompanyCode());
dto.setStatus(dto.getStatus().contains(USE) ? USE : null);
contractList = maintenanceContractMapper.getContractList(page, dto);
} else if (MaintenanceEnum.JIANGUAN.getCode().equals(phase)) {
//监管单位用"接收机构统一使用代码"匹配
......@@ -365,7 +363,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
BeanUtils.copyProperties(dto, contract);
contract.setCreateDate(new Date());
//获取维保备案编号
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.AZGZ.getCode(), 1);
ResponseModel<List<String>> listResponseModel = tzsServiceFeignClient.applicationFormCode(ApplicationFormTypeEnum.WBBA.getCode(), 1);
if (!ObjectUtils.isEmpty(listResponseModel) && listResponseModel.getStatus() != HttpStatus.OK.value()) {
log.error("告知单获取失败");
return false;
......@@ -463,7 +461,6 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
jgMaintenanceContract.setNextExecuteIds(role);
jgMaintenanceContract.setPromoter(reginParams.getUserModel().getUserId());
jgMaintenanceContract.setInstanceId(instanceId);
jgMaintenanceContract.setApplyDate(new Date());
if (!ObjectUtils.isEmpty(jgMaintenanceContract.getInstanceStatus())) {
jgMaintenanceContract.setInstanceStatus(jgMaintenanceContract.getInstanceStatus() + "," + role);
} else {
......@@ -479,6 +476,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
}
}else {
jgMaintenanceContract.setApplyDate(new Date());
jgMaintenanceContract.setStatus(taskCode);
}
this.getBaseMapper().updateById(jgMaintenanceContract);
......
......@@ -21,12 +21,10 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
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.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseUnitLicence;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
......@@ -96,22 +94,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper;
@Autowired
private RedisUtils redisUtils;
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
// 当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Autowired
private TzBaseUnitLicenceMapper baseUnitLicenceMapper;
/**
* 根据sequenceNbr查询
......@@ -302,6 +288,23 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
}
Map<String, Object> installation = informationList.get(0);
String useCode = String.valueOf(installation.get("useCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
ArrayList<String> installLicenseNoList = new ArrayList<>();
ArrayList<String> installLicenseExpirationDateList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(tzBaseUnitLicence -> {
// 因模板许可证编号配置最多支持三个,再多样式混乱,目前返回三个
if (installLicenseNoList.size() < 3) {
installLicenseNoList.add(tzBaseUnitLicence.getCertNo());
installLicenseExpirationDateList.add(DateUtils.convertDateToString(tzBaseUnitLicence.getExpiryDate(), DateUtils.DATE_PATTERN));
}
});
}
Function<String, String> getValue = key -> installation.getOrDefault(key, "").toString();
// 组装模板变量
......@@ -331,23 +334,10 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("installation-notification-report.ftl", placeholders);
} catch (Exception e) {
throw new RuntimeException(e);
}
placeholders.put("installLicenseNoList", installLicenseNoList);
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);
// 上传pdf至文件服务器
String url = this.uploadFile(pdfFile);
// 删除临时文件
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (IOException e) {
log.error("删除临时文件失败:{}", e);
}
String url = WordTemplateUtils.templateToPdf("installation-notification-report.ftl", placeholders);
// 更新到数据库
JgReformNotice.setNoticeReportUrl(url);
......@@ -356,39 +346,6 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
return url;
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "改造告知单_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private String uploadFile(File file) {
Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
String urlString = "";
if (result != null) {
for (String s : result.getResult().keySet()) {
urlString = s;
}
}
return urlString;
}
@Override
@SuppressWarnings ({"Duplicates", "rawtypes"})
......
......@@ -22,12 +22,10 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
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.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseUnitLicence;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.OtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.RegistrationInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
......@@ -88,19 +86,8 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
@Autowired
RedisUtils redisUtils;
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Autowired
private TzBaseUnitLicenceMapper baseUnitLicenceMapper;
/**
* 根据sequenceNbr查询
......@@ -188,6 +175,23 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
Map<String, Object> maintain = informationList.get(0);
String useCode = String.valueOf(maintain.get("useCode"));
LambdaQueryWrapper<TzBaseUnitLicence> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(TzBaseUnitLicence::getUnitCode, useCode);
List<TzBaseUnitLicence> list = baseUnitLicenceMapper.selectList(wrapper);
ArrayList<String> installLicenseNoList = new ArrayList<>();
ArrayList<String> installLicenseExpirationDateList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
list.forEach(tzBaseUnitLicence -> {
// 因模板许可证编号配置最多支持三个,再多样式混乱,目前返回三个
if (installLicenseNoList.size() < 3) {
installLicenseNoList.add(tzBaseUnitLicence.getCertNo());
installLicenseExpirationDateList.add(DateUtils.convertDateToString(tzBaseUnitLicence.getExpiryDate(), DateUtils.DATE_PATTERN));
}
});
}
Function<String, String> getValue = key -> maintain.getOrDefault(key, "").toString();
// 组装模板变量
......@@ -217,23 +221,10 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("installation-notification-report.ftl", placeholders);
} catch (Exception e) {
throw new RuntimeException(e);
}
placeholders.put("installLicenseNoList", installLicenseNoList);
placeholders.put("installLicenseExpirationDateList", installLicenseExpirationDateList);
// 上传pdf至文件服务器
String url = this.uploadFile(pdfFile);
// 删除临时文件
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (IOException e) {
log.error("删除临时文件失败:{}", e);
}
String url = WordTemplateUtils.templateToPdf("installation-notification-report.ftl", placeholders);
// 更新到数据库
jgTransferNotice.setNoticeReportUrl(url);
......@@ -242,39 +233,6 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
return url;
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "移装告知单_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private String uploadFile(File file) {
Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
String urlString = "";
if (result != null) {
for (String s : result.getResult().keySet()) {
urlString = s;
}
}
return urlString;
}
/**
* 更新移装告知
......
package com.yeejoin.amos.boot.module.jg.biz.utils;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
public class FileExporter {
public static void exportFile(FileType fileType, String fileName, byte[] data, HttpServletResponse response) {
try {
response.reset();
response.setCharacterEncoding("utf-8");
response.setContentType(fileType.getContentType());
fileName = fileName.replaceAll("\\.", "·");
fileName = URLEncoder.encode(fileName + fileType.getFileSufix(), "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename=" + fileName + "");
response.getOutputStream().write(data);
response.getOutputStream().flush();
} catch (Exception e) {
throw new BadRequest("导出文档出错");
} finally {
try {
response.getOutputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 文件类型
*/
public enum FileType {
// word文档
docx(".docx", "application/msword"),
// pdf文档
pdf(".pdf", "application/pdf");
private String fileSufix;
private String contentType;
private FileType(String fileSufix, String contentType) {
this.fileSufix = fileSufix;
this.contentType = contentType;
}
public String getFileSufix() {
return fileSufix;
}
public String getContentType() {
return contentType;
}
public static FileType getInstance(String fileSufix) {
FileType knowledgeRoleName = null;
for (FileType fileType : FileType.values()) {
if (fileType.getFileSufix().equals(fileSufix)) {
knowledgeRoleName = fileType;
}
}
return knowledgeRoleName;
}
}
}
......@@ -2,11 +2,17 @@ package com.yeejoin.amos.boot.module.jg.biz.utils;
import com.aspose.words.Document;
import com.aspose.words.License;
import com.aspose.words.SaveFormat;
import com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.nio.charset.StandardCharsets;
......@@ -124,4 +130,74 @@ public class WordTemplateUtils {
}
return result;
}
public static String templateToPdf(String wordPath, Map<String, Object> placeholders) {
// word转pdf
File pdfFile;
try {
pdfFile = wordToPdf(wordPath, placeholders);
} catch (Exception e) {
throw new RuntimeException(e);
}
// 上传pdf至文件服务器
String url = uploadFile(pdfFile);
// 删除临时文件
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (IOException e) {
log.error("删除临时文件失败:{}", e);
}
return url;
}
public static byte[] file2byte(File file) {
try {
FileInputStream in = new FileInputStream(file);
//当文件没有结束时,每次读取一个字节显示
byte[] data = new byte[in.available()];
in.read(data);
in.close();
return data;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 上传文件至文件服务器
*
* @param file 文件
*/
private static String uploadFile(File file) {
Assert.notNull(file, "文件不能为空");
MultipartFile multipartFile = new ByteArrayMultipartFile("file", "file.pdf", "application/pdf", file2byte(file));
FeignClientResult<Map<String, String>> result = Systemctl.fileStorageClient.updateCommonFile(multipartFile);
String urlString = "";
if (result != null) {
for (String s : result.getResult().keySet()) {
urlString = s;
}
}
return urlString;
}
/**
* word 转 pdf
*
* @param wordPath word文件路径
*/
private static File wordToPdf(String wordPath, Map<String, Object> placeholders) throws Exception {
Assert.hasText(wordPath, "word文件路径不能为空");
String tempFileName = "安装告知单_" + System.currentTimeMillis() + "_temp.pdf";
WordTemplateUtils instance = WordTemplateUtils.getInstance();
return instance.fillAndConvertDocFile(wordPath, tempFileName, placeholders, SaveFormat.PDF);
}
}
......@@ -119,11 +119,6 @@ public class JyjcInspectionResult extends BaseEntity {
@TableField("non_conformance")
private String nonConformance;
// /**
// * 整改情况
// */
// @TableField("rectification")
// private String rectification;
/**
* 备注(无用预留)
......@@ -180,4 +175,11 @@ public class JyjcInspectionResult extends BaseEntity {
*/
@TableField("equ_define")
private String equDefine;
/**
* 校验检验系统唯一流水号,排查问题,跟踪问题使用
*/
@TableField("trace_id")
private String traceId;
}
......@@ -152,4 +152,9 @@ public class JyjcInspectionResultModel extends BaseModel {
@ApiModelProperty(value = "监管码")
private String supervisoryCode;
/**
* 校验检验系统唯一流水号,排查问题,跟踪问题使用
*/
private String traceId;
}
......@@ -28,6 +28,7 @@ public enum ApplicationFormTypeEnum {
JG("JG"),// 检验结果
SBZX("SBZX"),//电梯(设备)注销
GMBG("GMBG"),//更名变更
TYQY("TYQY")//停用启用
;
/**
......
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