测试完成
parent
69a359ded8
commit
eb37f788a7
|
@ -1,7 +1,6 @@
|
||||||
package com.zcloud.controller.accident;
|
package com.zcloud.controller.accident;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.zcloud.controller.base.BaseController;
|
import com.zcloud.controller.base.BaseController;
|
||||||
|
@ -56,7 +55,7 @@ public class AccidentRecordsController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/{id}")
|
@RequestMapping("/{id}")
|
||||||
public Map<String, Object> getById(@PathVariable("id") Long id) {
|
public Map<String, Object> getById(@PathVariable("id") String id) {
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
result.put("result", "success");
|
result.put("result", "success");
|
||||||
result.put("info", accidentRecordsService.getById(Optional.of(id).orElseThrow(() -> new RuntimeException("id不能为空"))));
|
result.put("info", accidentRecordsService.getById(Optional.of(id).orElseThrow(() -> new RuntimeException("id不能为空"))));
|
||||||
|
@ -109,7 +108,7 @@ public class AccidentRecordsController extends BaseController {
|
||||||
if (StrUtil.isEmpty(values)) {
|
if (StrUtil.isEmpty(values)) {
|
||||||
throw new RuntimeException("id不能为空");
|
throw new RuntimeException("id不能为空");
|
||||||
}
|
}
|
||||||
List<Long> ids = Arrays.stream(values.split(",")).map(Convert::toLong).filter(ObjectUtil::isNotEmpty)
|
List<String> ids = Arrays.stream(values.split(",")).filter(ObjectUtil::isNotEmpty)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
accidentRecordsService.delete(ids);
|
accidentRecordsService.delete(ids);
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class AccidentRecords implements Serializable {
|
||||||
* 主键ID
|
* 主键ID
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "主键ID不能为null")
|
@NotNull(message = "主键ID不能为null")
|
||||||
private Long id;
|
private String id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事故案号
|
* 事故案号
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.zcloud.entity.accident.dto;
|
package com.zcloud.entity.accident.dto;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.zcloud.entity.accident.ExcelValue;
|
import com.zcloud.entity.accident.ExcelValue;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class AccidentRecordsExcel implements Serializable {
|
public class AccidentRecordsExcel implements Serializable {
|
||||||
|
@ -38,11 +40,11 @@ public class AccidentRecordsExcel implements Serializable {
|
||||||
@ExcelValue(value = "事故级别")
|
@ExcelValue(value = "事故级别")
|
||||||
private String incidentLevel;
|
private String incidentLevel;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 事故性质
|
// * 事故性质
|
||||||
*/
|
// */
|
||||||
@ExcelValue(value = "事故性质")
|
// @ExcelValue(value = "事故性质")
|
||||||
private String incidentNature;
|
// private String incidentNature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事故发生地点
|
* 事故发生地点
|
||||||
|
@ -121,4 +123,13 @@ public class AccidentRecordsExcel implements Serializable {
|
||||||
*/
|
*/
|
||||||
@ExcelValue(value = "报出日期")
|
@ExcelValue(value = "报出日期")
|
||||||
private String reportDate;
|
private String reportDate;
|
||||||
|
|
||||||
|
|
||||||
|
public void setIncidentDate(Date incidentDate) {
|
||||||
|
this.incidentDate = DateUtil.format(incidentDate, "yyyy年MM月dd日HH时mm分ss秒");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReportDate(Date reportDate) {
|
||||||
|
this.reportDate = DateUtil.format(reportDate, "yyyy年MM月dd日HH时mm分ss秒");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public interface AccidentRecordsMapper {
|
||||||
* @param id id
|
* @param id id
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
PageData getById(Long id);
|
PageData getById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
|
@ -49,7 +49,7 @@ public interface AccidentRecordsMapper {
|
||||||
* @param ids 主键数组
|
* @param ids 主键数组
|
||||||
* @return 受影响的行数
|
* @return 受影响的行数
|
||||||
*/
|
*/
|
||||||
int delete(@Param("ids") List<Long> ids);
|
int delete(@Param("ids") List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
|
|
|
@ -24,7 +24,7 @@ public interface AccidentRecordsService {
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
PageData getById(Long id);
|
PageData getById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
|
@ -45,7 +45,7 @@ public interface AccidentRecordsService {
|
||||||
*
|
*
|
||||||
* @param ids 主键数组
|
* @param ids 主键数组
|
||||||
*/
|
*/
|
||||||
void delete(List<Long> ids);
|
void delete(List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出Excel
|
* 导出Excel
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.zcloud.service.accident.impl;
|
package com.zcloud.service.accident.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
|
@ -12,17 +15,17 @@ import com.zcloud.entity.accident.dto.AccidentRecordsExcel;
|
||||||
import com.zcloud.mapper.datasource.accident.AccidentRecordsMapper;
|
import com.zcloud.mapper.datasource.accident.AccidentRecordsMapper;
|
||||||
import com.zcloud.service.accident.AccidentRecordsService;
|
import com.zcloud.service.accident.AccidentRecordsService;
|
||||||
import com.zcloud.service.bus.ImgFilesService;
|
import com.zcloud.service.bus.ImgFilesService;
|
||||||
import com.zcloud.util.*;
|
import com.zcloud.util.Const;
|
||||||
|
import com.zcloud.util.Jurisdiction;
|
||||||
|
import com.zcloud.util.Smb;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.time.LocalDateTime;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -49,17 +52,22 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData getById(Long id) {
|
public PageData getById(String id) {
|
||||||
return accidentRecordsMapper.getById(id);
|
return accidentRecordsMapper.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void save(AccidentRecords accidentRecords) {
|
public void save(AccidentRecords accidentRecords) {
|
||||||
accidentRecords.setId(IdUtil.getSnowflake(1, 1).nextId());
|
accidentRecords.setId(IdUtil.fastSimpleUUID());
|
||||||
accidentRecords.setCreatedBy(Jurisdiction.getUsername());
|
accidentRecords.setCreatedBy(Jurisdiction.getUsername());
|
||||||
Date date = Date.from(LocalDateTime.now().toInstant(ZoneOffset.of("+08:00")));
|
Date date = new Date();
|
||||||
accidentRecords.setCreatedTime(date);
|
SimpleDateFormat dateFormat = new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
|
||||||
|
// 设置成东八区时间
|
||||||
|
dateFormat.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
|
||||||
|
|
||||||
|
DateUtil.parse(dateFormat.format(date), DatePattern.NORM_DATETIME_PATTERN);
|
||||||
|
|
||||||
accidentRecords.setIsDeleted(0);
|
accidentRecords.setIsDeleted(0);
|
||||||
String corpinfoId = StrUtil.isEmpty(accidentRecords.getCorpinfoId()) ? Jurisdiction.getCORPINFO_ID() : accidentRecords.getCorpinfoId();
|
String corpinfoId = StrUtil.isEmpty(accidentRecords.getCorpinfoId()) ? Jurisdiction.getCORPINFO_ID() : accidentRecords.getCorpinfoId();
|
||||||
accidentRecords.setCorpinfoId(corpinfoId);
|
accidentRecords.setCorpinfoId(corpinfoId);
|
||||||
|
@ -70,8 +78,7 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(AccidentRecords accidentRecords) {
|
public void update(AccidentRecords accidentRecords) {
|
||||||
accidentRecords.setUpdatedBy(Jurisdiction.getUsername());
|
accidentRecords.setUpdatedBy(Jurisdiction.getUsername());
|
||||||
Date date = Date.from(LocalDateTime.now().toInstant(ZoneOffset.of("+08:00")));
|
accidentRecords.setUpdatedTime(new Date());
|
||||||
accidentRecords.setUpdatedTime(date);
|
|
||||||
String corpinfoId = StrUtil.isEmpty(accidentRecords.getCorpinfoId()) ? Jurisdiction.getCORPINFO_ID() : accidentRecords.getCorpinfoId();
|
String corpinfoId = StrUtil.isEmpty(accidentRecords.getCorpinfoId()) ? Jurisdiction.getCORPINFO_ID() : accidentRecords.getCorpinfoId();
|
||||||
accidentRecords.setCorpinfoId(corpinfoId);
|
accidentRecords.setCorpinfoId(corpinfoId);
|
||||||
Assert.isTrue(accidentRecordsMapper.updateById(accidentRecords) == 1, "更新事故记录失败");
|
Assert.isTrue(accidentRecordsMapper.updateById(accidentRecords) == 1, "更新事故记录失败");
|
||||||
|
@ -79,7 +86,7 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(List<Long> ids) {
|
public void delete(List<String> ids) {
|
||||||
Assert.isTrue(accidentRecordsMapper.delete(ids) == ids.size(), "删除事故记录失败");
|
Assert.isTrue(accidentRecordsMapper.delete(ids) == ids.size(), "删除事故记录失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,13 +159,13 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String importPhotos(MultipartFile file) {
|
public String importPhotos(MultipartFile file) {
|
||||||
String fileName = UuidUtil.get32UUID() + "." + FilenameUtils.getExtension(file.getOriginalFilename());
|
String fileName = IdUtil.fastSimpleUUID() + "." + FileUtil.extName(file.getOriginalFilename());
|
||||||
PageData pd = new PageData();
|
PageData pd = new PageData();
|
||||||
pd.put("IMGFILES_ID", UuidUtil.get32UUID());
|
pd.put("IMGFILES_ID", IdUtil.fastSimpleUUID());
|
||||||
pd.put("FOREIGN_KEY", UuidUtil.get32UUID());
|
pd.put("FOREIGN_KEY", IdUtil.fastSimpleUUID());
|
||||||
pd.put("TYPE", 117);
|
pd.put("TYPE", 117);
|
||||||
try {
|
try {
|
||||||
String path = Const.FILEPATHFILE + UuidUtil.get32UUID() + "/" + DateUtil.getDays();
|
String path = Const.FILEPATHFILE + IdUtil.fastSimpleUUID() + "/" + DateUtil.format(new Date(), DatePattern.PURE_DATE_PATTERN);
|
||||||
Smb.sshSftp(file, fileName, path);
|
Smb.sshSftp(file, fileName, path);
|
||||||
pd.put("FILEPATH", path + "/" + fileName);
|
pd.put("FILEPATH", path + "/" + fileName);
|
||||||
imgFilesService.save(pd);
|
imgFilesService.save(pd);
|
||||||
|
|
|
@ -3,143 +3,143 @@
|
||||||
<mapper namespace="com.zcloud.mapper.datasource.accident.AccidentRecordsMapper">
|
<mapper namespace="com.zcloud.mapper.datasource.accident.AccidentRecordsMapper">
|
||||||
|
|
||||||
<select id="listPage" parameterType="com.zcloud.entity.Page" resultType="pd">
|
<select id="listPage" parameterType="com.zcloud.entity.Page" resultType="pd">
|
||||||
select cast(accident_id AS CHAR) as id, CORP_NAME as companyName, location, date_format(incident_date,'%Y-%m-%d %H:%I:%s') as 'incidentDate', incident_name as 'incidentName'
|
select ACCIDENT_ID as id, CORP_NAME as companyName, LOCATION as 'location', INCIDENT_DATE as 'incidentDate', INCIDENT_NAME as 'incidentName'
|
||||||
from accident_records as ar
|
from bus_accident as ar
|
||||||
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
left join bus_corp_info as bci on ar.CORPINFO_ID = bci.CORPINFO_ID
|
||||||
<where>
|
<where>
|
||||||
<if test="pd.corpInfoId != null and pd.corpInfoId != ''">
|
<if test="pd.corpInfoId != null and pd.corpInfoId != ''">
|
||||||
and ar.corpinfo_id = #{pd.corpInfoId}
|
and ar.CORPINFO_ID = #{pd.corpInfoId}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.incidentName != null and pd.incidentName != ''">
|
<if test="pd.incidentName != null and pd.incidentName != ''">
|
||||||
and incident_name like concat('%', #{pd.incidentName}, '%')
|
and INCIDENT_NAME like concat('%', #{pd.incidentName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.startTime != null and pd.startTime != '' and pd.endTime != null and pd.startTime != ''">
|
<if test="pd.startTime != null and pd.startTime != '' and pd.endTime != null and pd.startTime != ''">
|
||||||
and incident_date between #{pd.startTime} and #{pd.endTime}
|
and INCIDENT_DATE between #{pd.startTime} and #{pd.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.location != null and pd.location != ''">
|
<if test="pd.location != null and pd.location != ''">
|
||||||
and location like concat('%', #{pd.location}, '%')
|
and LOCATION like concat('%', #{pd.location}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.incidentLevel != null and pd.incidentLevel != ''">
|
<if test="pd.incidentLevel != null and pd.incidentLevel != ''">
|
||||||
and incident_level like concat('%', #{pd.incidentLevel}, '%')
|
and INCIDENT_LEVEL = #{pd.incidentLevel}
|
||||||
</if>
|
</if>
|
||||||
<if test="pd.incidentType != null and pd.incidentLevel != ''">
|
<if test="pd.incidentType != null and pd.incidentType != ''">
|
||||||
and incident_type = #{pd.incidentType}
|
and INCIDENT_TYPE = #{pd.incidentType}
|
||||||
</if>
|
</if>
|
||||||
<if test="1 == 1">
|
<if test="1 == 1">
|
||||||
and is_deleted = 0
|
and IS_DELETED = 0
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by incident_date desc , companyName
|
order by INCIDENT_DATE desc , companyName
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getById" resultType="com.zcloud.entity.PageData">
|
<select id="getById" resultType="com.zcloud.entity.PageData">
|
||||||
select cast(accident_id AS CHAR) as id,
|
select ACCIDENT_ID as id,
|
||||||
incident_number as incidentNumber,
|
INCIDENT_NUMBER as incidentNumber,
|
||||||
incident_name as incidentName,
|
INCIDENT_NAME as incidentName,
|
||||||
incident_type as incidentType,
|
INCIDENT_TYPE as incidentType,
|
||||||
incident_level as incidentLevel,
|
INCIDENT_LEVEL as incidentLevel,
|
||||||
CORP_NAME as companyName,
|
CORP_NAME as companyName,
|
||||||
incident_nature as incidentNature,
|
INCIDENT_NATURE as incidentNature,
|
||||||
`location` as location,
|
LOCATION as location,
|
||||||
incident_date as incidentDate,
|
INCIDENT_DATE as incidentDate,
|
||||||
direct_loss as directLoss,
|
DIRECT_LOSS as directLoss,
|
||||||
injured as injured,
|
INJURED as injured,
|
||||||
fatalities as fatalities,
|
FATALITIES as fatalities,
|
||||||
seriously_injured as seriouslyInjured,
|
SERIOUSLY_INJURED as seriouslyInjured,
|
||||||
cause as cause,
|
CAUSE as cause,
|
||||||
summary as summary,
|
SUMMARY as summary,
|
||||||
photos as photos,
|
PHOTOS as photos,
|
||||||
analysis as analysis,
|
ANALYSIS as analysis,
|
||||||
suggestions as suggestions,
|
SUGGESTIONS as suggestions,
|
||||||
measures as measures,
|
MEASURES as measures,
|
||||||
ar.creator as creator,
|
ar.CREATOR as creator,
|
||||||
report_date as reportDate
|
REPORT_DATE as reportDate
|
||||||
from accident_records as ar
|
from bus_accident as ar
|
||||||
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
||||||
where ar.accident_id = #{id}
|
where ar.ACCIDENT_ID = #{id}
|
||||||
and ar.is_deleted = 0;
|
and ar.IS_DELETED = 0;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="save" parameterType="com.zcloud.entity.accident.AccidentRecords">
|
<insert id="save" parameterType="com.zcloud.entity.accident.AccidentRecords">
|
||||||
insert into accident_records
|
insert into bus_accident
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
accident_id,
|
ACCIDENT_ID,
|
||||||
</if>
|
</if>
|
||||||
<if test="incidentNumber != null">
|
<if test="incidentNumber != null">
|
||||||
incident_number,
|
INCIDENT_NUMBER,
|
||||||
</if>
|
</if>
|
||||||
<if test="incidentName != null">
|
<if test="incidentName != null">
|
||||||
incident_name,
|
INCIDENT_NAME,
|
||||||
</if>
|
</if>
|
||||||
<if test="incidentType != null">
|
<if test="incidentType != null">
|
||||||
incident_type,
|
INCIDENT_TYPE,
|
||||||
</if>
|
</if>
|
||||||
<if test="corpinfoId != null">
|
<if test="corpinfoId != null">
|
||||||
corpinfo_id,
|
CORPINFO_ID,
|
||||||
</if>
|
</if>
|
||||||
<if test="incidentLevel != null">
|
<if test="incidentLevel != null">
|
||||||
incident_level,
|
INCIDENT_LEVEL,
|
||||||
</if>
|
</if>
|
||||||
<if test="incidentNature != null">
|
<if test="incidentNature != null">
|
||||||
incident_nature,
|
INCIDENT_NATURE,
|
||||||
</if>
|
</if>
|
||||||
<if test="location != null">
|
<if test="location != null">
|
||||||
location,
|
LOCATION,
|
||||||
</if>
|
</if>
|
||||||
<if test="incidentDate != null">
|
<if test="incidentDate != null">
|
||||||
incident_date,
|
INCIDENT_DATE,
|
||||||
</if>
|
</if>
|
||||||
<if test="directLoss != null">
|
<if test="directLoss != null">
|
||||||
direct_loss,
|
DIRECT_LOSS,
|
||||||
</if>
|
</if>
|
||||||
<if test="injured != null">
|
<if test="injured != null">
|
||||||
injured,
|
INJURED,
|
||||||
</if>
|
</if>
|
||||||
<if test="fatalities != null">
|
<if test="fatalities != null">
|
||||||
fatalities,
|
FATALITIES,
|
||||||
</if>
|
</if>
|
||||||
<if test="seriouslyInjured != null">
|
<if test="seriouslyInjured != null">
|
||||||
seriously_injured,
|
SERIOUSLY_INJURED,
|
||||||
</if>
|
</if>
|
||||||
<if test="cause != null">
|
<if test="cause != null">
|
||||||
cause,
|
CAUSE,
|
||||||
</if>
|
</if>
|
||||||
<if test="summary != null">
|
<if test="summary != null">
|
||||||
summary,
|
SUMMARY,
|
||||||
</if>
|
</if>
|
||||||
<if test="photos != null">
|
<if test="photos != null">
|
||||||
photos,
|
PHOTOS,
|
||||||
</if>
|
</if>
|
||||||
<if test="analysis != null">
|
<if test="analysis != null">
|
||||||
analysis,
|
ANALYSIS,
|
||||||
</if>
|
</if>
|
||||||
<if test="suggestions != null">
|
<if test="suggestions != null">
|
||||||
suggestions,
|
SUGGESTIONS,
|
||||||
</if>
|
</if>
|
||||||
<if test="measures != null">
|
<if test="measures != null">
|
||||||
measures,
|
MEASURES,
|
||||||
</if>
|
</if>
|
||||||
<if test="creator != null">
|
<if test="creator != null">
|
||||||
creator,
|
CREATOR,
|
||||||
</if>
|
</if>
|
||||||
<if test="reportDate != null">
|
<if test="reportDate != null">
|
||||||
report_date,
|
REPORT_DATE,
|
||||||
</if>
|
</if>
|
||||||
<if test="createdBy != null">
|
<if test="createdBy != null">
|
||||||
created_by,
|
CREATED_BY,
|
||||||
</if>
|
</if>
|
||||||
<if test="createdTime != null">
|
<if test="createdTime != null">
|
||||||
created_time,
|
CREATED_TIME,
|
||||||
</if>
|
</if>
|
||||||
<if test="updatedBy != null">
|
<if test="updatedBy != null">
|
||||||
updated_by,
|
UPDATED_BY,
|
||||||
</if>
|
</if>
|
||||||
<if test="updatedTime != null">
|
<if test="updatedTime != null">
|
||||||
updated_time,
|
UPDATED_TIME,
|
||||||
</if>
|
</if>
|
||||||
<if test="isDeleted != null">
|
<if test="isDeleted != null">
|
||||||
is_deleted
|
IS_DELETED
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
values
|
values
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateById" parameterType="com.zcloud.entity.accident.AccidentRecords">
|
<update id="updateById" parameterType="com.zcloud.entity.accident.AccidentRecords">
|
||||||
UPDATE accident_records
|
UPDATE bus_accident
|
||||||
<set>
|
<set>
|
||||||
<if test="incidentNumber != null">incident_number = #{incidentNumber},</if>
|
<if test="incidentNumber != null">incident_number = #{incidentNumber},</if>
|
||||||
<if test="incidentName != null">incident_name = #{incidentName},</if>
|
<if test="incidentName != null">incident_name = #{incidentName},</if>
|
||||||
|
@ -258,7 +258,7 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<update id="delete">
|
<update id="delete">
|
||||||
update accident_records
|
update bus_accident
|
||||||
set is_deleted = 1
|
set is_deleted = 1
|
||||||
where
|
where
|
||||||
accident_id IN
|
accident_id IN
|
||||||
|
@ -279,9 +279,8 @@
|
||||||
where PARENT_ID = 'b61a1edc59c0430c8741c5f51aa26c3c'
|
where PARENT_ID = 'b61a1edc59c0430c8741c5f51aa26c3c'
|
||||||
and BIANMA = incident_level) as 'incidentLevel',
|
and BIANMA = incident_level) as 'incidentLevel',
|
||||||
CORP_NAME as 'companyName',
|
CORP_NAME as 'companyName',
|
||||||
incident_nature as incidentNature,
|
|
||||||
`location` as location,
|
`location` as location,
|
||||||
date_format(incident_date, '%Y年%m月%d日%H时%I分%s秒') as 'incidentDate',
|
incident_date as 'incidentDate',
|
||||||
direct_loss as directLoss,
|
direct_loss as directLoss,
|
||||||
injured,
|
injured,
|
||||||
fatalities,
|
fatalities,
|
||||||
|
@ -292,8 +291,8 @@
|
||||||
suggestions,
|
suggestions,
|
||||||
measures,
|
measures,
|
||||||
ar.creator as creator,
|
ar.creator as creator,
|
||||||
date_format(report_date, '%Y年%m月%d日%H时%I分%s秒') as 'reportDate'
|
report_date as 'reportDate'
|
||||||
from accident_records as ar
|
from bus_accident as ar
|
||||||
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
||||||
<where>
|
<where>
|
||||||
<if test="pd.corpInfoId != null and pd.corpInfoId != ''">
|
<if test="pd.corpInfoId != null and pd.corpInfoId != ''">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.zcloud.service.accident.service;
|
package com.zcloud.service.accident.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import com.zcloud.entity.Page;
|
import com.zcloud.entity.Page;
|
||||||
import com.zcloud.entity.PageData;
|
import com.zcloud.entity.PageData;
|
||||||
import com.zcloud.entity.accident.AccidentRecords;
|
import com.zcloud.entity.accident.AccidentRecords;
|
||||||
|
@ -63,25 +62,12 @@ public class AccidentRecordsServiceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetById() {
|
public void testGetById() {
|
||||||
Long id = 1L;
|
|
||||||
PageData expectedPageData = new PageData();
|
|
||||||
when(accidentRecordsMapper.getById(id)).thenReturn(expectedPageData);
|
|
||||||
|
|
||||||
PageData resultPageData = accidentRecordsService.getById(id);
|
|
||||||
|
|
||||||
assertEquals(expectedPageData, resultPageData);
|
|
||||||
verify(accidentRecordsMapper, times(1)).getById(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSave() {
|
public void testSave() {
|
||||||
AccidentRecords accidentRecords = new AccidentRecords();
|
|
||||||
accidentRecords.setId(IdUtil.getSnowflake(1, 1).nextId());
|
|
||||||
accidentRecords.setCreatedBy("测试");
|
|
||||||
accidentRecords.setCreatedTime(new Date());
|
|
||||||
accidentRecords.setIsDeleted(0);
|
|
||||||
|
|
||||||
accidentRecordsService.save(accidentRecords);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue