Commit 1895d51c authored by maoying's avatar maoying

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 808de20a a548c586
......@@ -50,7 +50,7 @@ public class Swagger2Config {
.apiInfo(apiInfo())
.select()
//此包路径下的类,才生成接口文档
.apis(RequestHandlerSelectors.basePackage("com.yeejoin.amos"))
.apis(RequestHandlerSelectors.basePackage("com.yeejoin"))
//加了ApiOperation注解的类,才生成接口文档
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
......
......@@ -115,4 +115,10 @@ public class FireEquipmentSignalLogDto extends BaseDto {
@ApiModelProperty(value = "负责人联系电话")
private String chargePersonPhone;
/**
* 3维页面访问地址
*/
@ApiModelProperty(value = "3维页面访问地址")
private String view3dUrl;
}
......@@ -80,4 +80,10 @@ public class FireStationInfoDto extends BaseDto {
@ApiModelProperty(value = "现存隐患")
private Long existDangerNumber;
/**
* 3维页面访问地址
*/
@ApiModelProperty(value = "3维页面访问地址")
private String view3dUrl;
}
......@@ -129,4 +129,10 @@ public class FireStationInfo extends BaseEntity {
*/
@TableField("fire_captain_phone")
private String fireCaptainPhone;
/**
* 3维页面访问地址
*/
@TableField("view3d_url")
private String view3dUrl;
}
......@@ -32,7 +32,8 @@
a.system_names,
s.station_charge_person,
s.charge_person_phone,
a.fire_building_mrid
a.fire_building_mrid,
s.view3d_url
from
asf_fire_equipment_signal_log a,
asf_fire_station_info s
......
......@@ -32,4 +32,11 @@ public class FireTeamListDto {
@ApiModelProperty(value = "树节点子节点id集合")
private List<String> nodeIds;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "所属单位")
private String company;
}
......@@ -27,6 +27,7 @@ public interface FireStationMapper extends BaseMapper<FireStation> {
+ "<if test='par.name!=null'> and a.name like CONCAT('%',#{par.name},'%') </if>"
+ "<if test='par.bizCompanyId!=null'> and a.biz_company_id = #{par.bizCompanyId} </if>"
+ "<if test='par.bizCompanyCode!=null'> and a.biz_company_code like CONCAT('',#{par.bizCompanyCode},'%') </if>"
+ "<if test='par.address!=null'> and a.address like CONCAT('',#{par.address},'%') </if>"
+" order by a.rec_date desc limit #{pageNum},#{pageSize}"
+ "</script>")
List<FireStationDto>getFireStation(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize,@Param("par")FireStationDto par);
......@@ -35,6 +36,7 @@ public interface FireStationMapper extends BaseMapper<FireStation> {
+ "<if test='par.name!=null'> and cb_fire_station.name like CONCAT('%',#{par.name},'%') </if>"
+ "<if test='par.bizCompanyId!=null'> and cb_fire_station.biz_company_id = #{par.bizCompanyId} </if>"
+ "<if test='par.bizCompanyCode!=null'> and cb_fire_station.biz_company_code like CONCAT('',#{par.bizCompanyCode},'%') </if>"
+ "<if test='par.address!=null'> and cb_fire_station.address like CONCAT('',#{par.address},'%') </if>"
+ "</script>")
Map<String, Long> getFireStationCount(@Param("par")FireStationDto par);
......
......@@ -44,7 +44,9 @@
<if test='par.parent != null'>and a.parent = #{par.parent}</if>
<if test='par.typeCode != null'>and a.type_code = #{par.typeCode}</if>
<if test='par.companyCode != null'>and a.company_code = #{par.companyCode}</if>
<if test='par.company != null and par.company != -1'>and a.company = #{par.company}</if>
<if test='par.name != null'>and a.name like concat('%', #{par.name}, '%')</if>
<if test='par.address != null'>and a.address like concat('%', #{par.address}, '%')</if>
<if test='par.nodeType != null and par.nodeType == "1" and par.nodeIds != null'>
and a.company in
<foreach collection="par.nodeIds" separator="," open="(" item="nodeId" close=")">
......
......@@ -24,6 +24,7 @@
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.company!=null and par.company!= -1'>and a.company= #{par.company}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
......@@ -43,6 +44,7 @@
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.company!=null and par.company!= -1'>and a.company= #{par.company}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code
......
......@@ -140,6 +140,9 @@
<if test="map.amosOrgCode != null and map.amosOrgCode != '-1'">
AND u.amos_org_code like concat('%',#{map.amosOrgCode}, '%')
</if>
<if test="map.company != null and map.company != '-1'">
AND u.parent_id = #{company}
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
......
......@@ -147,11 +147,11 @@
<if test="alertStatus!= null ">
and a.alert_status = #{alertStatus}
</if>
<if test="startTime!= null and endTime != null">
<if test="startTime!= null and endTime != null and startTime!= '' and endTime != ''">
and a.call_time between #{startTime} and #{endTime}
</if>
<if test="alertTypeCode!= null ">
and a.alarm_type_code = #{alertTypeCode}
<if test="alertTypeCode!= null and alertTypeCode!= '' ">
and a.alert_type_code = #{alertTypeCode}
</if>
<if test="alertSourceCode!= null ">
and a.alert_source_code = #{alertSourceCode}
......@@ -176,11 +176,8 @@
</select>
<select id="selectAllCount" resultType="int">
SELECT
sum(b.num)
FROM
(SELECT
count(distinct a.sequence_nbr) as num
SELECT
count(a.sequence_nbr) as num
FROM
jc_alert_called a
<if test="isFatherAlert!= null and isFatherAlert == 'true' ">
......@@ -190,23 +187,23 @@
<if test="alertStatus!= null ">
and a.alert_status = #{alertStatus}
</if>
<if test="startTime!= null and endTime != null">
<if test="startTime!= null and endTime != null and startTime!= '' and endTime != ''">
and a.call_time between #{startTime} and #{endTime}
</if>
<if test="alertTypeCode!= null ">
<if test="alertTypeCode!= null and alertTypeCode!= '' ">
and a.alarm_type_code = #{alertTypeCode}
</if>
<if test="alertSourceCode!= null ">
and a.alert_source_code = #{alertSourceCode}
</if>
<if test="systemSourceCode!= null ">
and a.system_source_code = #{systemSourceCode}
and a.system_source_code in (${systemSourceCode})
</if>
<if test="isFatherAlert!= null and isFatherAlert == 'true' ">
and j.alert_called_id = a.sequence_nbr
GROUP BY a.sequence_nbr
</if>
</where>) b
</where>
</select>
......
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 告知申请-设备信息表
......@@ -90,4 +95,17 @@ public class InformEquipmentDto extends BaseDto {
@ApiModelProperty(value = "告知单id")
private Long informId;
@ApiModelProperty(value = "原设备id")
private Long sourceEquipmentId;
@ExcelIgnore
@ApiModelProperty(value = "附件")
@TableField(exist = false)
private Map<String, List<AttachmentDto>> attachments;
@ApiModelProperty(value = "设备参数")
private List<EquipmentIndexDto> equipmentIndex;
}
......@@ -160,4 +160,9 @@ public class InformEquipment extends BaseEntity {
@TableField("inform_id")
private Long informId;
/**
* 原设备id
*/
@TableField("source_equipment_id")
private Long sourceEquipmentId;
}
......@@ -12,4 +12,5 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
public interface IEquipmentInformService {
EquipmentInformDto createEquipmentInform(EquipmentInformDto model);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import java.util.List;
/**
* 告知申请-设备信息表接口类
*
......@@ -9,4 +13,11 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
*/
public interface IInformEquipmentService {
InformEquipmentDto saveInformEquipment(InformEquipmentDto model);
InformEquipmentDto getEquipmentById(Long sequenceNbr);
List<InformEquipmentDto> getEquipListByInformId(Long sequenceNbr);
InformEquipmentDto updateEquipment(InformEquipmentDto model);
}
......@@ -94,9 +94,9 @@ public class EquipmentController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@PutMapping(value = "/updateEquipment")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新装备信息表", notes = "根据sequenceNbr更新装备信息表")
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model) {
if (ValidationUtil.isEmpty(model)
|| ValidationUtil.isEmpty(model.getSequenceNbr())) {
throw new BadRequest("参数校验失败.");
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
......@@ -10,6 +11,8 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentInformServiceImpl;
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;
......@@ -45,7 +48,7 @@ public class EquipmentInformController extends BaseController {
public ResponseModel<String> getInformCode(@PathVariable String regionCode) {
// 行政编码 + 年月 + 顺序号
String code = regionCode +DateUtils.getDateNowShortNumber();
int number = equipmentInformServiceImpl.count(new LambdaQueryWrapper<EquipmentInform>().like(EquipmentInform::getProductCode,code));
int number = equipmentInformServiceImpl.count(new LambdaQueryWrapper<EquipmentInform>().like(EquipmentInform::getProductCode,regionCode));
String numberStr = String.format("%04d", number);
code += numberStr;
return ResponseHelper.buildResponse(code);
......@@ -133,4 +136,8 @@ public class EquipmentInformController extends BaseController {
public ResponseModel<List<EquipmentInformDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentInformServiceImpl.queryForEquipmentInformList());
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
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.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.InformEquipment;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.InformEquipmentServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
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 org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
/**
* 告知申请-设备信息表
......@@ -31,31 +43,65 @@ public class InformEquipmentController extends BaseController {
@Autowired
InformEquipmentServiceImpl informEquipmentServiceImpl;
/**
* 新增告知申请-设备信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增告知申请-设备信息表", notes = "新增告知申请-设备信息表")
/**
* 新增告知书设备
* @param model
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/saveInformEquipment")
@ApiOperation(httpMethod = "POST", value = "新增告知书设备", notes = "新增告知书设备")
public ResponseModel<InformEquipmentDto> save(@RequestBody InformEquipmentDto model) {
model = informEquipmentServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
if (ValidationUtil.isEmpty(model.getSourceEquipmentId())
|| ValidationUtil.isEmpty(model.getInformId())) {
throw new BadRequest("参数校验失败.");
}
model = informEquipmentServiceImpl.saveInformEquipment(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个装备信息", notes = "根据sequenceNbr查询单个装备信息")
public ResponseModel<InformEquipmentDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(informEquipmentServiceImpl.getEquipmentById(sequenceNbr));
}
/**
* 根据告知书id 查询相关设备信息
* @param sequenceNbr
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新告知申请-设备信息表", notes = "根据sequenceNbr更新告知申请-设备信息表")
public ResponseModel<InformEquipmentDto> updateBySequenceNbrInformEquipment(@RequestBody InformEquipmentDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(informEquipmentServiceImpl.updateWithModel(model));
@GetMapping(value = "/getEquipListByInformId/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据告知书id 查询相关设备信息", notes = "根据告知书id 查询相关设备信息")
public ResponseModel<List<InformEquipmentDto>> getEquipListByInformId(@PathVariable Long sequenceNbr) {
List<InformEquipmentDto> result = informEquipmentServiceImpl.getEquipListByInformId(sequenceNbr);
return ResponseHelper.buildResponse(result);
}
/**
* 根据sequenceNbr更新
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateEquipment")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新装备信息表", notes = "根据sequenceNbr更新装备信息表")
public ResponseModel<InformEquipmentDto> updateBySequenceNbrEquipment(@RequestBody InformEquipmentDto model) {
if (ValidationUtil.isEmpty(model)
|| ValidationUtil.isEmpty(model.getSequenceNbr())) {
throw new BadRequest("参数校验失败.");
}
model = informEquipmentServiceImpl.updateEquipment(model);
return ResponseHelper.buildResponse(model);
}
/**
......@@ -68,49 +114,8 @@ public class InformEquipmentController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除告知申请-设备信息表", notes = "根据sequenceNbr删除告知申请-设备信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(informEquipmentServiceImpl.removeById(sequenceNbr));
return ResponseHelper.buildResponse(informEquipmentServiceImpl.update(new LambdaUpdateWrapper<InformEquipment>().eq(InformEquipment::getSequenceNbr,sequenceNbr).set(InformEquipment::getIsDelete,true)));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个告知申请-设备信息表", notes = "根据sequenceNbr查询单个告知申请-设备信息表")
public ResponseModel<InformEquipmentDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(informEquipmentServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "告知申请-设备信息表分页查询", notes = "告知申请-设备信息表分页查询")
public ResponseModel<Page<InformEquipmentDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<InformEquipmentDto> page = new Page<InformEquipmentDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(informEquipmentServiceImpl.queryForInformEquipmentPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "告知申请-设备信息表列表全部数据查询", notes = "告知申请-设备信息表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<InformEquipmentDto>> selectForList() {
return ResponseHelper.buildResponse(informEquipmentServiceImpl.queryForInformEquipmentList());
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentInformStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentInformMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentInformService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentInformDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformEquipmentService;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -23,6 +30,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 设备告知单服务实现类
......@@ -37,10 +45,18 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
SourceFileServiceImpl sourceFileService;
@Autowired
EquipmentServiceImpl equipmentServiceImpl;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
EquipmentIndexServiceImpl equipmentIndexServiceImpl;
@Autowired
InformEquipmentServiceImpl informEquipmentServiceImpl;
/**
* 分页查询
*/
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.InformEquipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.InformEquipmentMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IInformEquipmentService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 告知申请-设备信息表服务实现类
......@@ -17,6 +33,58 @@ import java.util.List;
*/
@Service
public class InformEquipmentServiceImpl extends BaseService<InformEquipmentDto,InformEquipment,InformEquipmentMapper> implements IInformEquipmentService {
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
EquipmentIndexServiceImpl equipmentIndexServiceImpl;
@Autowired
EquipmentServiceImpl equipmentServiceImpl;
@Transactional
@Override
public InformEquipmentDto saveInformEquipment(InformEquipmentDto model) {
// 首先获取设备基本信息并复制
Equipment sourceEquip = equipmentServiceImpl.getById(model.getSourceEquipmentId());
BeanUtils.copyProperties(sourceEquip,model);
model.setSequenceNbr(null);
model.setRecDate(new Date());
model.setRecUserId(null);
model.setRecUserName(null);
this.createWithModel(model);
// 保存设备参数信息
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,model.getSourceEquipmentId()).eq(EquipmentIndex::getIsDelete,false));
if(indexList != null && indexList.size()>0) {
for(EquipmentIndex t : indexList) {
EquipmentIndexDto temp = new EquipmentIndexDto();
BeanUtils.copyProperties(t,temp);
temp.setSequenceNbr(null);
temp.setEquipmentId(model.getSequenceNbr());
temp.setEquipmentName(model.getName());
equipmentIndexServiceImpl.createWithModel(temp);
}
}
// 获取设备附件信息 保存附件信息
// 原附件信息
Map<String, List<AttachmentDto>> sourceAttach = sourceFileService.getAttachments(sourceEquip.getSequenceNbr());
for( Map.Entry<String, List<AttachmentDto>> m :sourceAttach.entrySet()) {
List<AttachmentDto> tempList = m.getValue();
tempList.stream().forEach(l -> {
l.setSequenceNbr(null);
});
}
if(sourceAttach != null) {
sourceFileService.saveAttachments(model.getSequenceNbr(), sourceAttach);
}
return model;
}
/**
* 分页查询
*/
......@@ -30,4 +98,76 @@ public class InformEquipmentServiceImpl extends BaseService<InformEquipmentDto,I
public List<InformEquipmentDto> queryForInformEquipmentList() {
return this.queryForList("" , false);
}
@Override
public InformEquipmentDto getEquipmentById(Long sequenceNbr) {
// 获取基本信息
InformEquipment equipment = this.getById(sequenceNbr);
InformEquipmentDto result = new InformEquipmentDto();
BeanUtils.copyProperties(equipment,result);
// 封装附件
result.setAttachments(sourceFileService.getAttachments(equipment.getSequenceNbr()));
// 封装详细参数
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,equipment.getSequenceNbr()));
List<EquipmentIndexDto> dtoList = new ArrayList<>();
indexList.stream().forEach(t -> {
EquipmentIndexDto temp = new EquipmentIndexDto();
BeanUtils.copyProperties(t,temp);
dtoList.add(temp);
});
result.setEquipmentIndex(dtoList);
return result;
}
@Override
public InformEquipmentDto updateEquipment(InformEquipmentDto model) {
this.updateWithModel(model);
saveSourceFile(model);
// 先删除参数信息 再添加新的参数信息
equipmentIndexServiceImpl.remove(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,model.getSequenceNbr()));
// 保存设备参数信息
List<EquipmentIndexDto> equipmentIndex = model.getEquipmentIndex();
if(equipmentIndex != null && equipmentIndex.size()>0) {
for(EquipmentIndexDto t : equipmentIndex) {
t.setEquipmentId(model.getSequenceNbr());
t.setEquipmentName(model.getName());
equipmentIndexServiceImpl.createWithModel(t);
}
}
Bean.copyExistPropertis(this.queryBySeq(model.getSequenceNbr()), model);
return model;
}
@Override
public List<InformEquipmentDto> getEquipListByInformId(Long sequenceNbr) {
List<InformEquipment> list = this.list(new LambdaQueryWrapper<InformEquipment>().eq(InformEquipment::getIsDelete,false).eq(InformEquipment::getInformId,sequenceNbr));
List<InformEquipmentDto> result = new ArrayList<>();
list.stream().forEach(t -> {
InformEquipmentDto tempDto = new InformEquipmentDto();
BeanUtils.copyProperties(t,tempDto);
// 封装附件
tempDto.setAttachments(sourceFileService.getAttachments(t.getSequenceNbr()));
// 封装详细参数
List<EquipmentIndex> indexList = equipmentIndexServiceImpl.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId,t.getSequenceNbr()));
List<EquipmentIndexDto> dtoList = new ArrayList<>();
indexList.stream().forEach(i -> {
EquipmentIndexDto temp = new EquipmentIndexDto();
BeanUtils.copyProperties(i,temp);
dtoList.add(temp);
});
tempDto.setEquipmentIndex(dtoList);
result.add(tempDto);
});
return result;
}
// 保存附件信息
public void saveSourceFile(InformEquipmentDto model) {
if (model.getAttachments() != null) {
sourceFileService.saveAttachments(model.getSequenceNbr(), model.getAttachments());
}
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
......@@ -15,11 +16,14 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
@SpringBootApplication
@EnableTransactionManagement
@EnableConfigurationProperties
@EnableDiscoveryClient
@MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
......
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