Commit 31c17c53 authored by KeYong's avatar KeYong

提交移装接口

parent 79c43c25
package com.yeejoin.amos.boot.module.jg.api.dto; package com.yeejoin.amos.boot.module.jg.api.dto;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.util.StringUtils;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 移装造告知 * 移装造告知
...@@ -84,6 +88,7 @@ public class JgTransferNoticeDto extends BaseDto { ...@@ -84,6 +88,7 @@ public class JgTransferNoticeDto extends BaseDto {
private String address; private String address;
@ApiModelProperty(value = "计划施工日期") @ApiModelProperty(value = "计划施工日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date planDate; private Date planDate;
@ApiModelProperty(value = "接收机构单位代码") @ApiModelProperty(value = "接收机构单位代码")
...@@ -146,4 +151,33 @@ public class JgTransferNoticeDto extends BaseDto { ...@@ -146,4 +151,33 @@ public class JgTransferNoticeDto extends BaseDto {
@ApiModelProperty(value = "设备使用地点-街道(镇)-名称") @ApiModelProperty(value = "设备使用地点-街道(镇)-名称")
private String streetName; private String streetName;
@ApiModelProperty(value = "委托书附件")
private List<Map<String, Object>> powerOfAttorneyList;
@ApiModelProperty(value = "施工合同附件")
private List<Map<String, Object>> constructionContractList;
@TableField(exist = false)
@ApiModelProperty(value = "告知设备列表")
private List<Map<String, Object>> deviceList;
@ApiModelProperty(value = "区名字")
private String countyName;
@ApiModelProperty(value = "市名字")
private String cityName;
@ApiModelProperty(value = "省名字")
private String provinceName;
@ApiModelProperty(value = "完整地址")
private String fullAddress;
public String getFullAddress() {
return (StringUtils.isEmpty(this.provinceName) ? "" : this.provinceName)
+ (StringUtils.isEmpty(this.cityName) ? "" : this.cityName)
+ (StringUtils.isEmpty(this.countyName) ? "" : this.countyName)
+ (StringUtils.isEmpty(this.address) ? "" : this.address);
}
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.api.entity; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jg.api.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -269,4 +270,13 @@ public class JgTransferNotice extends BaseEntity { ...@@ -269,4 +270,13 @@ public class JgTransferNotice extends BaseEntity {
@TableField(value ="\"street_name\"") @TableField(value ="\"street_name\"")
private String streetName; private String streetName;
@TableField("county_name")
private String countyName;
@TableField("city_name")
private String cityName;
@TableField("province_name")
private String provinceName;
} }
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq; import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* 移装告知设备关系表 Mapper 接口 * 移装告知设备关系表 Mapper 接口
...@@ -9,6 +8,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -9,6 +8,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author system_generator * @author system_generator
* @date 2023-12-19 * @date 2023-12-19
*/ */
public interface JgTransferNoticeEqMapper extends BaseMapper<JgTransferNoticeEq> { public interface JgTransferNoticeEqMapper extends CustomBaseMapper<JgTransferNoticeEq> {
} }
package com.yeejoin.amos.boot.module.jg.api.mapper; 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.JgTransferNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 移装造告知 Mapper 接口 * 移装造告知 Mapper 接口
...@@ -9,6 +15,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -9,6 +15,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author system_generator * @author system_generator
* @date 2023-12-19 * @date 2023-12-19
*/ */
public interface JgTransferNoticeMapper extends BaseMapper<JgTransferNotice> { public interface JgTransferNoticeMapper extends CustomBaseMapper<JgTransferNotice> {
Page<JgTransferNotice> queryForPage(Page<JgTransferNotice> page, @Param("param") JgTransferNoticeDto model, @Param("type") String type, @Param("orgCode") String orgCode);
@MapKey("sequenceNbr")
List<Map<String, Object>> queryEquipInformation(@Param("sequenceNbr") long sequenceNbr);
} }
package com.yeejoin.amos.boot.module.jg.api.service; package com.yeejoin.amos.boot.module.jg.api.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
/** /**
* 移装告知设备关系表接口类 * 移装告知设备关系表接口类
* *
* @author system_generator * @author system_generator
* @date 2023-12-19 * @date 2023-12-19
*/ */
public interface IJgTransferNoticeEqService { public interface IJgTransferNoticeEqService extends IService<JgTransferNoticeEq> {
} }
package com.yeejoin.amos.boot.module.jg.api.service; package com.yeejoin.amos.boot.module.jg.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import java.util.Map;
/** /**
* 移装造告知接口类 * 移装造告知接口类
* *
* @author system_generator * @author system_generator
* @date 2023-12-19 * @date 2023-12-19
*/ */
public interface IJgTransferNoticeService { public interface IJgTransferNoticeService extends IService<JgTransferNotice> {
Map<String, Map<String, Object>> queryBySequenceNbr(Long sequenceNbr);
JgTransferNoticeDto updateTransferNotice(String submitType, JgTransferNoticeDto noticeDto, String op);
Page<JgTransferNoticeDto> queryForJgTransferNoticePage(Page<JgTransferNotice> page, JgTransferNoticeDto model, String type, ReginParams reginParams);
Boolean deleteForBatch(Long[] sequenceNbrs);
void saveNotice(String submitType, Map<String, JgTransferNoticeDto> model, ReginParams reginParams);
String generateTransferNoticeReport(Long sequenceNbr);
} }
...@@ -2,4 +2,122 @@ ...@@ -2,4 +2,122 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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.JgTransferNoticeMapper"> <mapper namespace="com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper">
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice">
select
tjtn.sequence_nbr AS sequenceNbr,
tjtn.apply_no AS applyNo,
tjtn.notice_date AS noticeDate,
tjtn.use_unit_name AS useUnitName,
tjtn.receive_org_name AS receiveOrgName,
tjtn.address AS address,
tjtn.notice_status AS noticeStatus,
tjtn.install_unit_name AS installUnitName,
tjtn.province AS provinceName,
tjtn.city AS cityName,
tjtn.county AS countyName,
tjtn.instance_id AS instanceId,
tjtn.transfer_type AS transferType,
tjtn.plan_date AS planDate
FROM
tzs_jg_transfer_notice tjtn
<where>
tjtn.is_delete = false
<if test="param != null ">
<if test="param.applyNo != null and param.applyNo != ''">
AND tjtn.apply_no LIKE CONCAT('%', #{param.applyNo}, '%')
</if>
<if test="param.receiveOrgName != null and param.receiveOrgName != ''">
AND tjtn.receive_org_name LIKE CONCAT('%', #{param.receiveOrgName}, '%')
</if>
<if test="param.useUnitName != null and param.useUnitName != ''">
AND tjtn.use_unit_name LIKE CONCAT('%', #{param.useUnitName}, '%')
</if>
<if test="param.installUnitName != null and param.installUnitName != ''">
AND tjtn.install_unit_name LIKE CONCAT('%', #{param.installUnitName}, '%')
</if>
<if test="param.noticeStatus != null and param.noticeStatus != ''">
AND tjtn.notice_status = #{param.noticeStatus}
</if>
</if>
<if test="type == 'supervision'">
AND (tjtn.notice_status in ('6612', '6613', '6614') or tjtn.status in('6614') )
</if>
<if test="orgCode != null and orgCode != ''">
AND tjtn.install_unit_credit_code = #{orgCode}
</if>
</where>
ORDER BY
tjtn.notice_date DESC
</select>
<select id="queryEquipInformation" resultType="java.util.Map">
select
tjtn.sequence_nbr AS sequenceNbr,
tjtn.install_unit_name AS installUnitName,
tjtn.apply_no AS applyNo,
tjtn.province,
tjtn.city AS cityName,
tjtn.county AS countyName,
tjtn.address AS address,
tjtn.use_unit_name AS useUnitName,
tjtn.install_unit_credit_code AS installUnitCreditCode,
tjtn.install_unit_name AS installUnitName,
tjtn.equip_num AS equipName,
tjtn.rec_date AS recDate,
tjtn.create_date AS createDate,
tjtn.create_user_name AS createUserName,
tjtn.accept_date AS acceptDate,
tjtn.receive_company_code AS receiveCompanyCode,
tjtn.construction_contract AS constructionContract,
tjtn.transfer_type AS transferType,
tjtn.factory_use_site_street AS factoryUseSiteStreet,
tjtn.province AS provinceName,
tjtn.city AS cityName,
tjtn.county AS countyName,
ri.equ_list AS equList,
ri.equ_category AS equCategory,
ri.EQU_DEFINE AS equDefine,
ri.product_name AS productName,
ri.brand_name AS brandName,
ri.equ_type AS equType,
ri.equ_price AS equPrice,
ri.product_photo AS productPhoto,
di.design_unit_credit_code AS designUnitCreditCode,
di.design_unit_name AS designUnitName,
di.design_license_num AS designLicenseNum,
di.design_use_date AS designUseDate,
di.design_date AS designDate,
di.drawing_do AS drawingDo,
di.appraisal_unit AS appraisalUnit,
di.appraisal_date AS appraisalDate,
di.design_doc AS designDoc,
di.design_standard AS designStandard,
fi.produce_unit_credit_code AS produceUnitCreditCode,
fi.produce_unit_name AS produceUnitName,
fi.produce_license_num AS produceLicenseNum,
fi.factory_num AS factoryNum,
fi.produce_date AS produceDate,
fi.imported AS imported,
fi.produce_country AS produceCountry,
fi.factory_standard AS factoryStandard,
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ui.safety_manager AS safetyManager,
ui.phone AS safetyManagerPhone,
ui.PROVINCE_NAME AS useUnitProvinceName,
ui.CITY_NAME AS useUnitCityName,
ui.COUNTY_NAME AS useUnitCountyName,
ui.ADDRESS AS useUnitAddress
FROM
tzs_jg_transfer_notice tjtn
LEFT JOIN tzs_jg_installation_notice_eq re ON re.equip_transfer_id = tjtn.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
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
WHERE
tjtn.sequence_nbr = #{sequenceNbr}
LIMIT 1
</select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.jg.biz.controller; package com.yeejoin.amos.boot.module.jg.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping; import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiOperation; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgTransferNoticeServiceImpl; import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
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;
/** /**
* 移装造告知 * 移装造告知
...@@ -29,7 +36,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -29,7 +36,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
public class JgTransferNoticeController extends BaseController { public class JgTransferNoticeController extends BaseController {
@Autowired @Autowired
JgTransferNoticeServiceImpl jgTransferNoticeServiceImpl; private IJgTransferNoticeService jgTransferNoticeService;
/** /**
* 新增移装造告知 * 新增移装造告知
...@@ -37,80 +44,113 @@ public class JgTransferNoticeController extends BaseController { ...@@ -37,80 +44,113 @@ public class JgTransferNoticeController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增移装造告知", notes = "新增移装造告知") @ApiOperation(httpMethod = "POST", value = "新增移装造告知", notes = "新增移装造告知")
public ResponseModel<JgTransferNoticeDto> save(@RequestBody JgTransferNoticeDto model) { public ResponseModel<String> save(@RequestParam String submitType, @RequestBody Map<String, JgTransferNoticeDto> model) {
model = jgTransferNoticeServiceImpl.createWithModel(model); ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(model); jgTransferNoticeService.saveNotice(submitType, model, reginParams);
} return ResponseHelper.buildResponse("");
}
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
* @param sequenceNbr 主键 * @param
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新移装造告知", notes = "根据sequenceNbr更新移装造告知") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新移装造告知", notes = "根据sequenceNbr更新移装造告知")
public ResponseModel<JgTransferNoticeDto> updateBySequenceNbrJgTransferNotice(@RequestBody JgTransferNoticeDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JgTransferNoticeDto> updateBySequenceNbrJgTransferNotice(
model.setSequenceNbr(sequenceNbr); @RequestParam String submitType,
return ResponseHelper.buildResponse(jgTransferNoticeServiceImpl.updateWithModel(model)); @RequestBody Map<String, Object> model,
} @RequestParam(value = "op", required = false) String op) {
JgTransferNoticeDto transferNoticeInfo = BeanUtil.mapToBean(((LinkedHashMap) model.get("transferInfo")), JgTransferNoticeDto.class, true);
if (Objects.isNull(transferNoticeInfo)) {
throw new IllegalArgumentException("参数transferInfo不能为空");
}
Object o = ((LinkedHashMap<?, ?>) model.get("transferInfo")).get("proxyStatementAttachment");
Object o1 = ((LinkedHashMap<?, ?>) model.get("transferInfo")).get("installContractAttachment");
transferNoticeInfo.setConstructionContractList((List<Map<String, Object>>) o);
transferNoticeInfo.setPowerOfAttorneyList((List<Map<String, Object>>) o1);
return ResponseHelper.buildResponse(jgTransferNoticeService.updateTransferNotice(submitType, transferNoticeInfo, op));
/** }
/**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除移装造告知", notes = "根据sequenceNbr删除移装造告知") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除移装造告知", notes = "根据sequenceNbr删除移装造告知")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @RequestParam(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgTransferNoticeServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jgTransferNoticeService.removeById(sequenceNbr));
} }
/** /**
* 根据sequenceNbr批量删除
*
* @param sequenceNbrs 主键
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/batchDelete")
@ApiOperation(value = "根据sequenceNbr删除维保合同备案", notes = "根据sequenceNbr删除维保合同备案")
public ResponseModel<Boolean> deleteForBatch(@RequestParam("sequenceNbrs") Long[] sequenceNbrs) {
try {
return ResponseHelper.buildResponse(jgTransferNoticeService.deleteForBatch(sequenceNbrs));
} catch (Exception e) {
return CommonResponseUtil.failure(e.getMessage());
}
}
/**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/details")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个移装造告知", notes = "根据sequenceNbr查询单个移装造告知") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个移装造告知", notes = "根据sequenceNbr查询单个移装造告知")
public ResponseModel<JgTransferNoticeDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<Map<String, Map<String, Object>>> selectOne(@RequestParam Long sequenceNbr) {
return ResponseHelper.buildResponse(jgTransferNoticeServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(jgTransferNoticeService.queryBySequenceNbr(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @PostMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "移装造告知分页查询", notes = "移装造告知分页查询") @ApiOperation(httpMethod = "POST", value = "移装造告知分页查询", notes = "移装造告知分页查询")
public ResponseModel<Page<JgTransferNoticeDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<JgTransferNoticeDto>> queryForPage(
(value = "size") int size) { @ApiParam(value = "当前页码", required = true) @RequestParam(value = "current", defaultValue = "1") int current,
Page<JgTransferNoticeDto> page = new Page<JgTransferNoticeDto>(); @ApiParam(value = "每页大小", required = true) @RequestParam(value = "size", defaultValue = "20") int size,
page.setCurrent(current); @ApiParam(value = "类型:enterprise-企业端、supervision-监管端", required = true) @RequestParam(value = "type", defaultValue = "enterprise") String type,
page.setSize(size); @RequestBody(required = false) JgTransferNoticeDto model
return ResponseHelper.buildResponse(jgTransferNoticeServiceImpl.queryForJgTransferNoticePage(page)); ) {
} Page<JgTransferNotice> page = new Page<>(current, size);
ReginParams reginParams = getSelectedOrgInfo();
return ResponseHelper.buildResponse(jgTransferNoticeService.queryForJgTransferNoticePage(page, model, type, reginParams));
}
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "移装造告知列表全部数据查询", notes = "移装造告知列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "移装造告知列表全部数据查询", notes = "移装造告知列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/generate-report")
public ResponseModel<List<JgTransferNoticeDto>> selectForList() { public ResponseModel<String> selectForList(@RequestParam("sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(jgTransferNoticeServiceImpl.queryForJgTransferNoticeList()); return ResponseHelper.buildResponse(jgTransferNoticeService.generateTransferNoticeReport(sequenceNbr));
} }
} }
package com.yeejoin.amos.boot.module.jg.biz.service.impl; package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile;
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.entity.JgTransferNotice;
import com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq;
import com.yeejoin.amos.boot.module.jg.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService; import com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService;
import com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import org.typroject.tyboot.core.rdbms.service.BaseService; 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.OtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.RegistrationInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.SupervisoryCodeInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
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.service.ICreateCodeService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.workflow.Workflow;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowBatchDTO;
import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.text.ParseException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 移装造告知服务实现类 * 移装造告知服务实现类
...@@ -17,11 +65,299 @@ import java.util.List; ...@@ -17,11 +65,299 @@ import java.util.List;
*/ */
@Service @Service
public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto,JgTransferNotice,JgTransferNoticeMapper> implements IJgTransferNoticeService { public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto,JgTransferNotice,JgTransferNoticeMapper> implements IJgTransferNoticeService {
private static final String SUBMIT_TYPE_FLOW = "1";
private static final String PROCESS_DEFINITION_KEY = "transferNotice";
private static final String TABLE_PAGE_ID = "transferNoticeAdd";
@Autowired
EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
JgTransferNoticeEqMapper jgTransferNoticeEqMapper;
@Autowired
private JgTransferNoticeMapper jgTransferNoticeMapper;
@Autowired
private ICreateCodeService iCreateCodeService;
@Autowired
RegistrationInfoMapper tzsJgRegistrationInfoMapper;
@Autowired
OtherInfoMapper tzsJgOtherInfoMapper;
@Autowired
TzsServiceFeignClient tzsServiceFeignClient;
@Autowired
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper;
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;
}
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return 移装告知
*/
@Override
public Map<String, Map<String, Object>> queryBySequenceNbr(Long sequenceNbr) {
// 移装告知信息
JgTransferNotice notice = jgTransferNoticeMapper.selectById(sequenceNbr);
if (Objects.isNull(notice)) {
return null;
}
Map<String, Object> transferNotice = BeanUtil.beanToMap(notice);
transferNotice.put("province", notice.getProvince() + "_" + notice.getProvinceName());
transferNotice.put("city", notice.getCity() + "_" + notice.getCityName());
transferNotice.put("county", notice.getCounty() + "_" + notice.getCountyName());
transferNotice.put("useUnitCreditCode", notice.getUseUnitCreditCode() + "_" + notice.getUseUnitName());
if(!ValidationUtil.isEmpty(notice.getFactoryUseSiteStreet()) && !ValidationUtil.isEmpty(notice.getStreetName())) {
transferNotice.put("factoryUseSiteStreet", notice.getFactoryUseSiteStreet() + "_" + notice.getStreetName());
}
String[] fields = {"productPhoto", "designDoc", "designStandard", "factoryStandard",
"productQualityYieldProve", "insUseMaintainExplain", "inspectReport",
"proxyStatementAttachment", "installContractAttachment", "powerOfAttorneyList", "constructionContractList", "deviceList"};
// 设备信息
List<Map<String, Object>> equipmentInfos = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr);
for (String s : fields) {
if (transferNotice.containsKey(s)) {
transferNotice.put(s, JSON.parseArray(transferNotice.get(s).toString()));
}
if (equipmentInfos.get(0).containsKey(s)) {
equipmentInfos.get(0).put(s, JSON.parseArray(equipmentInfos.get(0).get(s).toString()));
}
}
return new HashMap<String, Map<String, Object>>() {{
this.put("transferNoticeInfo", transferNotice);
this.put("equipmentInfo", equipmentInfos.get(0));
}};
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteForBatch(Long[] sequenceNbrs) {
if (Objects.isNull(sequenceNbrs) || sequenceNbrs.length == 0) {
return false;
}
Collection<JgTransferNotice> jgTransferNotices = this.listByIds(Arrays.asList(sequenceNbrs));
jgTransferNotices.forEach(notice -> {
if (StringUtils.hasText(notice.getInspectionUnitCreditCode())) {
throw new IllegalStateException("所选数据已存在流程,不能删除!");
}
notice.setIsDelete(true);
});
return this.updateBatchById(jgTransferNotices);
}
/**
* 打印移装告知单
*
* @param sequenceNbr 主键
* @return pdf文件路径
*/
@Override
public String generateTransferNoticeReport(Long sequenceNbr) {
if (Objects.isNull(sequenceNbr)) {
throw new IllegalArgumentException("参数不能为空");
}
JgTransferNotice jgMaintainNotice = this.getById(sequenceNbr);
List<Map<String, Object>> informationList = jgTransferNoticeMapper.queryEquipInformation(sequenceNbr);
if (Objects.isNull(jgMaintainNotice) || CollectionUtils.isEmpty(informationList)) {
throw new IllegalArgumentException("移装告知单不存在");
}
Map<String, Object> maintain = informationList.get(0);
Function<String, String> getValue = key -> maintain.getOrDefault(key, "").toString();
// 组装模板变量
Map<String, Object> placeholders = new HashMap<>();
placeholders.put("sequenceNbr", getValue.apply("sequenceNbr"));
placeholders.put("installUnitName", getValue.apply("installUnitName"));
placeholders.put("applyNo", getValue.apply("applyNo"));
placeholders.put("productName", getValue.apply("productName"));
placeholders.put("equipType", getValue.apply("equType"));
// placeholders.put("equipCode", getValue.apply("equRegisterCode"));
placeholders.put("produceCode", getValue.apply("produceCode")); // TODO: 制造编号
placeholders.put("produceUnitName", getValue.apply("produceUnitName"));
placeholders.put("produceLicenseNum", getValue.apply("produceLicenseNum"));
placeholders.put("fullAddress", getValue.apply("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("address"));
// placeholders.put("installStartDate", getValue.apply("installStartDate"));
// placeholders.put("installType", getValue.apply("installType")); // TODO: 施工类别
// placeholders.put("installLicenseNo", getValue.apply("installLicenseNo"));
// placeholders.put("installLicenseExpirationDate", getValue.apply("installLicenseExpirationDate"));
// placeholders.put("installLeaderName", getValue.apply("installLeaderName"));
// placeholders.put("installLeaderPhone", getValue.apply("installLeaderPhone"));
// placeholders.put("installUnitAddress", getValue.apply("installUnitAddress")); // TODO: 施工单位地址
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
placeholders.put("useUnitLeaderAddress", getValue.apply("useUnitProvinceName") + getValue.apply("useUnitCityName") + getValue.apply("useUnitCountyName") + getValue.apply("useUnitAddress"));
// 生成二维码
String qrCode = ImageUtils.generateQRCode(getValue.apply("applyNo"), 300, 300);
placeholders.put("qrCode", qrCode);
// word转pdf
File pdfFile;
try {
pdfFile = this.wordToPdf("maintain-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);
}
// 更新到数据库
// 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;
}
/**
* 更新移装告知
*
* @param noticeDto 移装告知
*/
@SuppressWarnings({"rawtypes", "Duplicates"})
public JgTransferNoticeDto updateTransferNotice(String submitType, JgTransferNoticeDto noticeDto, String op) {
if (Objects.isNull(noticeDto) || StringUtils.isEmpty(submitType)) {
throw new IllegalArgumentException("参数不能为空");
}
// 字段转换
this.convertField(noticeDto);
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
AjaxResult ajaxResult;
// 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey("maintainNotification");
dto.setBusinessKey("1");
try {
ajaxResult = Workflow.taskClient.startByVariable(dto);
String instanceId = ((Map) ajaxResult.get("data")).get("id").toString();
noticeDto.setInstanceId(instanceId);
} catch (Exception e) {
log.error("提交失败:{}", e);
}
}
ajaxResult = Workflow.taskClient.getTask(noticeDto.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
//组装信息
TaskResultDTO taskResultDTO = new TaskResultDTO();
taskResultDTO.setResultCode("approvalStatus");
taskResultDTO.setTaskId(taskId);
taskResultDTO.setComment("提交流程");
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
taskResultDTO.setVariable(map);
//执行流程
AjaxResult ajaxResult1;
try {
ajaxResult1 = Workflow.taskClient.completeByTask(taskId, taskResultDTO);
if (ajaxResult1.get("code").equals(200)) {
noticeDto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
JgTransferNotice bean = new JgTransferNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgTransferNoticeMapper.updateById(bean);
}
} catch (Exception e) {
log.error("提交失败:{}", e);
}
} else {
JgTransferNotice bean = new JgTransferNotice();
BeanUtils.copyProperties(noticeDto, bean);
jgTransferNoticeMapper.updateById(bean);
}
return noticeDto;
}
/** /**
* 分页查询 * 分页查询
*/ */
public Page<JgTransferNoticeDto> queryForJgTransferNoticePage(Page<JgTransferNoticeDto> page) { public Page<JgTransferNoticeDto> queryForJgTransferNoticePage(Page<JgTransferNotice> page, JgTransferNoticeDto model, String type, ReginParams reginParams) {
return this.queryForPage(page, null, false); String orgCode;
if (type.equals("enterprise")) {
orgCode = reginParams.getCompany().getCompanyCode();
} else {
orgCode = reginParams.getCompany().getOrgCode();
}
Page<JgTransferNotice> noticePage = jgTransferNoticeMapper.queryForPage(page, model, type, orgCode);
// 将Page<JgTransferNotice>转化为Page<JgTransferNoticeDto>
Page<JgTransferNoticeDto> noticeDtoPage = new Page<>();
BeanUtils.copyProperties(noticePage, noticeDtoPage, "records");
List<JgTransferNoticeDto> records = noticePage.getRecords().stream().map(notice -> {
JgTransferNoticeDto noticeDto = new JgTransferNoticeDto();
BeanUtils.copyProperties(notice, noticeDto);
if (Objects.nonNull(notice.getNoticeStatus())) {
String noticeStatusDesc = FlowStatusEnum.getNameByType(Long.valueOf(notice.getNoticeStatus()));
noticeDto.setNoticeStatus(noticeStatusDesc);
}
return noticeDto;
}).collect(java.util.stream.Collectors.toList());
noticeDtoPage.setRecords(records);
return noticeDtoPage;
} }
/** /**
...@@ -30,4 +366,286 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto ...@@ -30,4 +366,286 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
public List<JgTransferNoticeDto> queryForJgTransferNoticeList() { public List<JgTransferNoticeDto> queryForJgTransferNoticeList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
@Override
@SuppressWarnings({"Duplicates", "rawtypes"})
@Transactional(rollbackFor = Exception.class)
public void saveNotice(String submitType, Map<String, JgTransferNoticeDto> jgTransferNoticeDtoMap, ReginParams reginParams) {
JgTransferNoticeDto model = jgTransferNoticeDtoMap.get(TABLE_PAGE_ID);
// 字段转换
convertField(model);
// 获取告知设备列表
List<Map<String, Object>> deviceList = model.getDeviceList();
if (CollectionUtils.isEmpty(deviceList)) {
return;
}
// 获取告知单号
List<String> applyNoList = iCreateCodeService.createApplicationFormCode(ApplicationFormTypeEnum.AZGZ.getCode(), deviceList.size());
if (CollectionUtils.isEmpty(applyNoList)) {
return;
}
// 判断当前是否为提交
List<String> instanceIdList = new ArrayList<>();
if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程
// ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
ActWorkflowBatchDTO actWorkflowBatchDTO = new ActWorkflowBatchDTO();
List<ActWorkflowStartDTO> list = new ArrayList<>();
for (int i = 0; i < deviceList.size(); i++
) {
ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
dto.setProcessDefinitionKey(PROCESS_DEFINITION_KEY);
dto.setBusinessKey(String.valueOf(i));
dto.setCompleteFirstTask(true);
list.add(dto);
}
actWorkflowBatchDTO.setProcess(list);
try {
FeignClientResult result = Workflow.taskV2Client.startByVariableBatch(actWorkflowBatchDTO);
List<Object> returnList = (List<Object>) result.getResult();
for (Object obj : returnList
) {
JSONObject jsonObject = JSON.parseObject(JSONObject.toJSONString(obj));
instanceIdList.add(jsonObject.getString("id"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
List<JgTransferNotice> list = new ArrayList<>();
List<JgTransferNoticeEq> equipList = new ArrayList<>();
deviceList.forEach(obj -> {
JgTransferNoticeEq jgRelationEquip = new JgTransferNoticeEq();
JgTransferNotice dto = new JgTransferNotice();
BeanUtils.copyProperties(model, dto);
int i = deviceList.indexOf(obj);
String applyNo = applyNoList.get(i);
dto.setApplyNo(applyNo);
dto.setNoticeDate(new Date());
dto.setInstallUnitName(reginParams.getCompany().getCompanyName());
dto.setInstallUnitCreditCode(reginParams.getCompany().getCompanyCode());
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(applyNo);
if (!CollectionUtils.isEmpty(instanceIdList)) {
dto.setInstanceId(instanceIdList.get(i));
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_PROCESSED.getCode()));
} else {
dto.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
}
list.add(dto);
equipList.add(jgRelationEquip);
});
jgTransferNoticeMapper.insertBatchSomeColumn(list);
List<JgTransferNoticeEq> jgRelationEquipList = equipList.stream().map(jgRelationEquip -> {
List<JgTransferNotice> collect = list.stream().filter(JgTransferNotice -> jgRelationEquip.getEquipTransferId().equals(JgTransferNotice.getApplyNo())).collect(Collectors.toList());
Long sequenceNbr = collect.get(0).getSequenceNbr();
return jgRelationEquip.setEquipTransferId(String.valueOf(sequenceNbr));
}).collect(Collectors.toList());
jgTransferNoticeEqMapper.insertBatchSomeColumn(jgRelationEquipList);
}
private void convertField(JgTransferNoticeDto model) {
// 处理图片
if (!ValidationUtil.isEmpty(model.getPowerOfAttorneyList())) {
model.setPowerOfAttorney(JSON.toJSONString(model.getPowerOfAttorneyList()));
}
if (!ValidationUtil.isEmpty(model.getConstructionContractList())) {
model.setConstructionContract(JSON.toJSONString(model.getConstructionContractList()));
}
// 分割省市区字段
String province = model.getProvince();
if (!ObjectUtils.isEmpty(province)) {
String[] provinceList = province.split("_");
if (provinceList.length > 1) {
model.setProvince(provinceList[0]);
model.setProvince(provinceList[1]);
}
}
String city = model.getCity();
if (!ObjectUtils.isEmpty(city)) {
String[] cityList = city.split("_");
if (cityList.length > 1) {
model.setCity(cityList[0]);
model.setCity(cityList[1]);
}
}
String county = model.getCounty();
if (!ObjectUtils.isEmpty(county)) {
String[] countyList = county.split("_");
if (countyList.length > 1) {
model.setCounty(countyList[0]);
model.setCounty(countyList[1]);
}
}
// 分割单位
String useUnitId = model.getUseUnitCreditCode();
if (!ObjectUtils.isEmpty(useUnitId)) {
String[] useUnitList = useUnitId.split("_");
if (useUnitList.length > 1) {
model.setUseUnitCreditCode(useUnitList[0]);
model.setUseUnitName(useUnitList[1]);
}
}
String receiveOrgId = model.getReceiveOrgCode();
if (!ObjectUtils.isEmpty(receiveOrgId)) {
String[] receiveOrgIdList = receiveOrgId.split("_");
if (receiveOrgIdList.length > 1) {
model.setReceiveOrgCode(receiveOrgIdList[0]);
model.setReceiveOrgName(receiveOrgIdList[1]);
}
}
String inspectUnitId = model.getInspectionUnitCreditCode();
if (!ObjectUtils.isEmpty(inspectUnitId)) {
String[] inspectUnitIdList = inspectUnitId.split("_");
if (inspectUnitIdList.length > 1) {
model.setInspectionUnitCreditCode(inspectUnitIdList[0]);
model.setInspectionUnitName(inspectUnitIdList[1]);
}
}
String factoryUseSiteStreet = model.getFactoryUseSiteStreet();
if (!ObjectUtils.isEmpty(factoryUseSiteStreet)) {
String[] factoryUseSiteStreetList = factoryUseSiteStreet.split("_");
if (factoryUseSiteStreetList.length > 1) {
model.setFactoryUseSiteStreet(factoryUseSiteStreetList[0]);
model.setStreetName(factoryUseSiteStreetList[1]);
}
}
}
private String convertImageUrl(List<Map<String, String>> urlList) {
String urls = "";
if (!CollectionUtils.isEmpty(urlList)) {
urls = urlList.stream().map(map -> map.get("url")).collect(Collectors.joining(","));
}
return urls;
}
public boolean submit(JgTransferNotice notice, String op) {
AjaxResult ajaxResult = Workflow.taskClient.getTask(notice.getInstanceId());
JSONObject dataObject = JSON.parseObject(JSON.toJSONString(ajaxResult.get("data")));
String taskId = dataObject.getString("id");
//组装信息
TaskResultDTO dto = new TaskResultDTO();
dto.setResultCode("approvalStatus");
dto.setTaskId(taskId);
dto.setComment("提交流程");
HashMap<String, Object> map = new HashMap<>();
map.put("approvalStatus", op);
dto.setVariable(map);
//执行流程
AjaxResult ajaxResult1 = null;
try {
ajaxResult1 = Workflow.taskClient.completeByTask(taskId, dto);
if (ajaxResult1.get("code").equals(200)) {
return true;
} else {
return false;
}
} catch (Exception e) {
log.error("提交失败:{}", e);
return false;
}
}
public void cancel(JgTransferNoticeDto noticeDto) {
FeignClientResult ajaxResult = Workflow.taskV2Client.rollBack(noticeDto.getInstanceId());
JgTransferNotice JgTransferNotice = this.baseMapper.selectById(noticeDto.getSequenceNbr());
if (ajaxResult.getStatus() == 200) {
JgTransferNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
jgTransferNoticeMapper.updateById(JgTransferNotice);
}
}
public void accept(JgTransferNoticeDto dto, String op) {
JgTransferNotice JgTransferNotice = this.jgTransferNoticeMapper.selectById(dto.getSequenceNbr());
// 组装设备注册代码
StringBuffer stringBuffer = new StringBuffer();
String ym = null;
try {
ym = DateUtils.dateFormat(new Date(), DateUtils.DATE_PATTERN_MM);
} catch (ParseException e) {
log.error("日期转换失败:{}", e);
}
LambdaQueryWrapper<JgTransferNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgTransferNoticeEq::getEquipTransferId, dto.getSequenceNbr());
JgTransferNoticeEq jgRelationEquip = jgTransferNoticeEqMapper.selectOne(queryWrapper);
LambdaQueryWrapper<OtherInfo> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(OtherInfo::getRecord, jgRelationEquip.getEquId());
OtherInfo tzsJgOtherInfo = tzsJgOtherInfoMapper.selectOne(queryWrapper1);
LambdaQueryWrapper<RegistrationInfo> queryWrapper2 = new LambdaQueryWrapper<>();
queryWrapper2.eq(RegistrationInfo::getRecord, jgRelationEquip.getEquId());
RegistrationInfo tzsJgRegistrationInfo = tzsJgRegistrationInfoMapper.selectOne(queryWrapper2);
stringBuffer.append(tzsJgRegistrationInfo.getEquCategory()).append(JgTransferNotice.getCity()).append(ym);
String equCode = stringBuffer.toString();
String deviceRegistrationCode = iCreateCodeService.createDeviceRegistrationCode(equCode);
Map<String, Object> map = new HashMap<>();
map.put("cityCode", JgTransferNotice.getCity());
map.put("countyCode", JgTransferNotice.getCounty());
map.put("equCategory", tzsJgRegistrationInfo.getEquCategory());
// map.put("isXiXian", JgTransferNotice.getIsXixian() == null ? "0" : JgTransferNotice.getIsXixian());
Map<String, Object> mapCode;
ResponseModel<Map<String, Object>> code = tzsServiceFeignClient.createCode(map);
mapCode = code.getResult();
LambdaQueryWrapper<SupervisoryCodeInfo> queryWrapper3 = new LambdaQueryWrapper<>();
queryWrapper3.eq(SupervisoryCodeInfo::getSupervisoryCode, mapCode.get("superviseCode").toString());
SupervisoryCodeInfo supervisoryCodeInfo = supervisoryCodeInfoMapper.selectOne(queryWrapper3);
supervisoryCodeInfo.setStatus("1");
supervisoryCodeInfoMapper.updateById(supervisoryCodeInfo);
// boolean submit = submit(JgTransferNotice, op);
// if(submit) {
if("0".equals(op)) {
JgTransferNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.HAVE_PROCESSED.getCode()));
// this.generateMaintainNoticeReport(JgTransferNotice.getSequenceNbr());
} else {
JgTransferNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_SUBMITTED.getCode()));
JgTransferNotice.setInstanceStatus(String.valueOf(FlowStatusEnum.REJECTED.getCode()));
}
jgTransferNoticeMapper.updateById(JgTransferNotice);
// }
// // 组装监管码
// String division = "";
// if (((XIAN.equals(dto.getCity()) || XIAN_YANG.equals(dto.getCity())) && "1".equals(dto.getIsXixian()))) {
// division = "X";
// } else {
// //生成监管码前缀
// Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), dto.getCounty());
// division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), dto.getCity()).get("code").toString() : divisionMap.get("code").toString();
// }
//
// // 组装96333码
// String prefix = "";
// if (((XIAN.equals(dto.getCity()) || XIAN_YANG.equals(dto.getCity())) && "1".equals(dto.getIsXixian()))) {
// prefix = EquipmentCategoryEnum.XXCSM.getValue();
// } else {
// Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), dto.getCounty());
// prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), dto.getCity()).get("code").toString() : elevatorMap.get("code").toString();
// }
}
} }
\ No newline at end of file
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