代码优化

This commit is contained in:
马三炮 2025-04-14 13:36:41 +08:00
parent f733a8b6b5
commit b000767268
3 changed files with 23 additions and 0 deletions

View File

@ -107,6 +107,7 @@ public class CoordinatePhotoServiceImpl implements CoordinatePhotoService {
ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo();
BeanUtils.copyProperties(data,comprehensiveQueryVo);
comprehensiveQueryVo.setUploadType("4");
comprehensiveQueryVo.setVioPlace(data.getBuildPlace());
synthesisQueryService.addComprehensiveQuery(comprehensiveQueryVo);
} catch (Exception e) {
log.error(e.toString(), e);
@ -142,6 +143,7 @@ public class CoordinatePhotoServiceImpl implements CoordinatePhotoService {
}
ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo();
BeanUtils.copyProperties(data,comprehensiveQueryVo);
comprehensiveQueryVo.setVioPlace(data.getBuildPlace());
synthesisQueryService.updateComprehensiveQuery(comprehensiveQueryVo);
} catch (Exception e) {
log.error(e.toString(), e);

View File

@ -16,8 +16,11 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
@ -72,6 +75,7 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
return ServerResponse.createSuccess();
} catch (Exception e) {
log.error(e.toString(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ServerResponse.createErroe("删除失败");
}
}
@ -104,9 +108,14 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo();
BeanUtils.copyProperties(data,comprehensiveQueryVo);
comprehensiveQueryVo.setUploadType("5");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (data.getTime() != null && !data.getTime().trim().isEmpty()) {
comprehensiveQueryVo.setRectDate(dateFormat.parse(data.getTime()));
}
synthesisQueryService.addComprehensiveQuery(comprehensiveQueryVo);
} catch (Exception e) {
log.error(e.toString(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ServerResponse.createErroe("新增失败");
}
return ServerResponse.createSuccess("新增成功");
@ -139,9 +148,14 @@ public class ImportantMatterServiceImpl implements ImportantMatterService {
//修改综合查询
ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo();
BeanUtils.copyProperties(data,comprehensiveQueryVo);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (data.getTime() != null && !data.getTime().trim().isEmpty()) {
comprehensiveQueryVo.setRectDate(dateFormat.parse(data.getTime()));
}
synthesisQueryService.updateComprehensiveQuery(comprehensiveQueryVo);
} catch (Exception e) {
log.error(e.toString(), e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ServerResponse.createErroe("修改失败");
}
return ServerResponse.createSuccess("修改成功");

View File

@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -108,6 +109,12 @@ public class SafetyMeasuresServiceImpl implements SafetyMeasuresService {
ComprehensiveQueryVo comprehensiveQueryVo = new ComprehensiveQueryVo();
BeanUtils.copyProperties(data,comprehensiveQueryVo);
comprehensiveQueryVo.setUploadType("3");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (data.getCheckDate() != null && !data.getCheckDate().trim().isEmpty()) {
comprehensiveQueryVo.setRectDate(dateFormat.parse(data.getCheckDate()));
}
comprehensiveQueryVo.setVioPlace(data.getCheckPlace());
comprehensiveQueryVo.setVioDesc(data.getCheckDesc());
synthesisQueryService.addComprehensiveQuery(comprehensiveQueryVo);
} catch (Exception e) {
log.error(e.toString(), e);