Merge remote-tracking branch 'origin/master'

master_suzejing
xiaoSu 2024-04-10 11:24:05 +08:00
commit 66ca1afa4a
80 changed files with 2212 additions and 353 deletions

View File

@ -0,0 +1,43 @@
package com.zhilian.business.domain;
import lombok.Data;
import java.util.Date;
/**
* @ClassName Break
* @Description
* @Author YuanYongH
* @Date 2024/4/4 9:40
*/
@Data
public class Break {
/**
* id
**/
private Integer breakId;
/**
*
**/
private String breakCode;
/**
* VIN
**/
private String breakVin;
/**
*
**/
private Date breakDate;
/**
*
**/
private Date breakTime;
/**
*
**/
private String breakType;
/**
*
**/
private Integer breakState;
}

View File

@ -0,0 +1,28 @@
package com.zhilian.business.domain;
import lombok.Data;
/**
* @ClassName BreakLog
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 15:07
*/
@Data
public class BreakLog {
/** 故障日志id */
private Integer breakLogId;
/** 故障码 */
private String breakCode;
/** 车辆VIN */
private String breakVin;
/** 故障类型 */
private String breakType;
/** 结束报警时间 */
private String breakTime;
/** 开始报警时间 */
private String breakDate;
/** 是否报警 */
private String breakState;
}

View File

@ -0,0 +1,113 @@
package com.zhilian.business.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhilian.common.core.annotation.Excel;
import com.zhilian.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* business_break
*
* @author Yy
* @date 2024-04-07
*/
@Data
public class BusinessBreak extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long breakId;
/** 故障码 */
@Excel(name = "故障码")
private String breakCode;
/** 车辆VIN */
@Excel(name = "车辆VIN")
private String breakVin;
/** 结束报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date breakTime;
/** 故障类型 */
@Excel(name = "故障类型")
private String breakType;
/** 开始报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date breakDate;
/** 是否警告 */
@Excel(name = "是否警告")
private String breakState;
public void setBreakId(Long breakId)
{
this.breakId = breakId;
}
public Long getBreakId()
{
return breakId;
}
public void setBreakCode(String breakCode)
{
this.breakCode = breakCode;
}
public String getBreakCode()
{
return breakCode;
}
public void setBreakVin(String breakVin)
{
this.breakVin = breakVin;
}
public String getBreakVin()
{
return breakVin;
}
public void setBreakType(String breakType)
{
this.breakType = breakType;
}
public String getBreakType()
{
return breakType;
}
public void setBreakState(String breakState)
{
this.breakState = breakState;
}
public String getBreakState()
{
return breakState;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("breakId", getBreakId())
.append("breakCode", getBreakCode())
.append("breakVin", getBreakVin())
.append("breakTime", getBreakTime())
.append("breakType", getBreakType())
.append("breakDate", getBreakDate())
.append("breakState", getBreakState())
.toString();
}
}

View File

@ -1,4 +1,4 @@
package com.zhilian.common.business.domain;
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@ -13,12 +13,14 @@ import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName Fence
* @Description
* @Author ZeJinG.Su
* @Date 15:28 2024/4/8
*/
@Data
@SuperBuilder
@NoArgsConstructor

View File

@ -1,4 +1,4 @@
package com.zhilian.common.business.domain;
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@ -10,12 +10,7 @@ import lombok.*;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName Markers
* @Description
* @Author ZeJinG.Su
* @Date 15:29 2024/4/8
*/
@Data
@ToString
@SuperBuilder
@ -25,16 +20,12 @@ import java.util.List;
@TableName("business_markers")
public class Markers extends BaseEntity {
/**
*
*/
@TableId(value = "markers_id", type = IdType.AUTO)
@Excel(name = "标识编号")
private Long markersId;
/**
*
*/
@TableField("markers_name")
@Excel(name = "标识名称")
private String markersName;

View File

@ -1,4 +1,4 @@
package com.zhilian.common.business.domain;
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@ -12,10 +12,7 @@ import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName Vehicle
* @Description
* @Author ZeJinG.Su
* @Date 15:27 2024/4/8
* business_vehicle
*/
@Data
@ToString

View File

@ -1,4 +1,4 @@
package com.zhilian.common.business.domain;
package com.zhilian.business.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@ -10,12 +10,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
/**
* @ClassName VehicleType
* @Description
* @Author ZeJinG.Su
* @Date 15:30 2024/4/8
*/
@Data
@SuperBuilder
@NoArgsConstructor

View File

@ -1,14 +1,9 @@
package com.zhilian.common.business.domain.middle;
package com.zhilian.business.domain.middle;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.ToString;
/**
* @ClassName MarkersFence
* @Description
* @Author ZeJinG.Su
* @Date 15:30 2024/4/8
*/
@Data
@ToString
@TableName("business_markers_fence")
@ -18,9 +13,6 @@ public class MarkersFence {
*/
@TableId(value = "markers_id",type = IdType.INPUT)
private Long markerId;
/**
*
*/
@TableField(value = "fence_id",insertStrategy = FieldStrategy.IGNORED)
private Long fenceId;

View File

@ -1,14 +1,9 @@
package com.zhilian.common.business.domain.middle;
package com.zhilian.business.domain.middle;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.ToString;
/**
* @ClassName VehicleMarkers
* @Description
* @Author ZeJinG.Su
* @Date 15:27 2024/4/8
*/
@Data
@ToString
@TableName("business_vehicle_markers")

View File

@ -0,0 +1,8 @@
package com.zhilian.business.domain.vo;
import lombok.Data;
@Data
public class MarkersVo {
}

View File

@ -1,12 +1,9 @@
package com.zhilian.common.business.domain.vo;
package com.zhilian.business.domain.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zhilian.common.core.annotation.Excel;
import lombok.Data;
/**
* @ClassName VehicleVo
* @Description
* @Author ZeJinG.Su
* @Date 15:28 2024/4/8
*/
@Data
public class VehicleVo {
/**

View File

@ -0,0 +1,22 @@
package com.zhilian.business.remote;
import com.zhilian.business.domain.Break;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.remote.factory.RemoteBreakFallbackFactory;
import com.zhilian.common.core.constant.ServiceNameConstants;
import com.zhilian.common.core.domain.Result;
import lombok.extern.java.Log;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(contextId = "remoteBreakService", value = ServiceNameConstants.BUSINESS_SERVICE, fallbackFactory = RemoteBreakFallbackFactory.class)
public interface RemoteBreakService {
/**
*
*/
@PostMapping
public Result add(@RequestBody BusinessBreak businessBreak);
}

View File

@ -0,0 +1,7 @@
package com.zhilian.business.remote;
import org.springframework.stereotype.Component;
@Component
public interface RemoteFenceService {
}

View File

@ -1,7 +1,7 @@
package com.zhilian.common.business.remote;
package com.zhilian.business.remote;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.common.business.remote.factory.RemoteVehicleFallbackFactory;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory;
import com.zhilian.common.core.constant.ServiceNameConstants;
import com.zhilian.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient;

View File

@ -0,0 +1,22 @@
package com.zhilian.business.remote.factory;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.remote.RemoteBreakService;
import com.zhilian.common.core.domain.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class RemoteBreakFallbackFactory implements FallbackFactory<RemoteBreakService> {
@Override
public RemoteBreakService create(Throwable cause) {
return new RemoteBreakService() {
@Override
public Result add(BusinessBreak businessBreak) {
log.error("故障日志服务调用失败");
return Result.error("故障日志服务调用失败");
}
};
}
}

View File

@ -0,0 +1,8 @@
package com.zhilian.business.remote.factory;
import com.zhilian.common.core.constant.ServiceNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
//@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public class RemoteFenceFallbackFactory {
}

View File

@ -1,8 +1,8 @@
package com.zhilian.common.business.remote.factory;
package com.zhilian.business.remote.factory;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.common.business.remote.RemoteVehicleService;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.remote.RemoteVehicleService;
import com.zhilian.common.core.domain.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,36 +0,0 @@
package com.zhilian.common.business.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @ClassName FenceVo
* @Description
* @Author ZeJinG.Su
* @Date 15:27 2024/4/8
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class FenceVo {
/**
*
*/
private String fenceName;
/**
*
*/
private Long fenceTypeId;
/**
*
*/
private Long fenceState;
}

View File

@ -1 +1,3 @@
com.zhilian.common.business.remote.factory.RemoteVehicleFallbackFactory
com.zhilian.business.remote.factory.RemoteBreakFallbackFactory
com.zhilian.business.remote.factory.RemoteFenceFallbackFactory
com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory

View File

@ -20,6 +20,11 @@ public class ServiceNameConstants {
* serviceid
*/
public static final String FILE_SERVICE = "zhilian-file";
/**
* serviceid
*/
public static final String BUSINESS_SERVICE = "zhilian-business";
/**
* serviceid
*/

View File

@ -5,10 +5,10 @@ import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName ErrorCar
* @Description
* @Author Can.J
* @Date 2024/4/8 12:50
* @ClassName ErrorCar
* @Description
* @Author Can.J
* @Date 2024/4/8 12:50
*/
@AllArgsConstructor
@NoArgsConstructor

View File

@ -0,0 +1,102 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.Break;
import com.zhilian.business.domain.BreakVo;
import com.zhilian.business.service.BreakService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.page.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName BreakController
* @Description
* @Author YuanYongH
* @Date 2024/4/4 9:40
*/
@RestController
public class BreakController {
@Autowired
private BreakService breakService;
/**
* @Description // 故障列表
* @Date 2024/4/4
* @param breakVo
* @return com.zhilian.common.core.domain.Result<com.zhilian.common.core.web.page.PageResult<com.zhilian.business.domain.Break>>
**/
@PostMapping("breakList")
public Result<PageResult<Break>> breakList(@RequestBody BreakVo breakVo) {
PageResult<Break> pageResult = breakService.breakList(breakVo);
return Result.success(pageResult);
}
/**
* @Description // 故障添加
* @Date 2024/4/4
* @param break1
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("breakAdd")
public Result breakAdd(@RequestBody Break break1) {
int i = breakService.breakAdd(break1);
Result<Integer> success = Result.success(i);
return success;
}
/**
* @Description // 故障修改
* @Date 2024/4/4
* @param break1
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("breakUpd")
public Result breadUpd(@RequestBody Break break1) {
int i = breakService.breakUpd(break1);
Result<Integer> success = Result.success(i);
return success;
}
/**
* @Description // 故障删除
* @Date 2024/4/4
* @param breakId
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("breakDel/{breakId}")
public Result delFirm(@PathVariable Integer breakId){
int i = breakService.breakDel(breakId);
Result<Integer> success = Result.success(i);
return success;
}
}

View File

@ -0,0 +1,63 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.service.BreakLogService;
import com.zhilian.common.core.domain.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @ClassName BreakLogController
* @Description
* @Author YuanYongH
* @Date 2024/4/8 20:48
*/
@RestController
public class BreakLogController {
@Autowired
private BreakLogService breakLogService;
/**
* @Description //故障日志列表
* @Date 2024/4/10
* @return com.zhilian.common.core.domain.Result<java.util.List<com.zhilian.business.domain.BreakLog>>
**/
@PostMapping("log")
public Result<List<BreakLog>> breakLog() {
List<BreakLog> list = breakLogService.breakLog();
Result<List<BreakLog>> success = Result.success(list);
return success;
}
/**
* @Description //故障日志添加
* @Date 2024/4/10
* @param breakLog
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("logAdd")
public Result logAdd(@RequestBody BreakLog breakLog){
int i = breakLogService.logAdd(breakLog);
Result<Integer> success = Result.success(i);
return success;
}
/**
* @Description // 故障日志修改
* @Date 2024/4/10
* @param breakLog
* @return com.zhilian.common.core.domain.Result
**/
@PostMapping("updLog")
public Result updLog(@RequestBody BreakLog breakLog){
int i = breakLogService.updLog(breakLog);
Result<Integer> success = Result.success(i);
return success;
}
}

View File

@ -0,0 +1,117 @@
package com.zhilian.business.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.domain.request.BreakReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhilian.common.log.annotation.Log;
import com.zhilian.common.log.enums.BusinessType;
import com.zhilian.common.security.annotation.RequiresPermissions;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.service.IBusinessBreakService;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.utils.poi.ExcelUtil;
import com.zhilian.common.core.web.page.*;
/**
* Controller
*
* @author Yy
* @date 2024-04-07
*/
@RestController
@RequestMapping("/break")
public class BusinessBreakController extends BaseController
{
@Autowired
private IBusinessBreakService businessBreakService;
/**
*
*/
// @RequiresPermissions("business:break:list")
@GetMapping("/list")
public Result<TableDataInfo<BusinessBreak>> list(BreakReq breakReq)
{
startPage();
List<BusinessBreak> list = businessBreakService.selectBusinessBreakList(breakReq);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("business:break:export")
@Log(title = "故障", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BreakReq breakReq)
{
List<BusinessBreak> list = businessBreakService.selectBusinessBreakList(breakReq);
ExcelUtil<BusinessBreak> util = new ExcelUtil<BusinessBreak>(BusinessBreak.class);
util.exportExcel(response, list, "故障数据");
}
/**
*
*/
@RequiresPermissions("business:break:query")
@GetMapping(value = "/{breakId}")
public Result getInfo(@PathVariable("breakId") Long breakId)
{
return success(businessBreakService.selectBusinessBreakByBreakId(breakId));
}
/**
*
*/
@RequiresPermissions("business:break:add")
@Log(title = "故障", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody BusinessBreak businessBreak)
{
return toAjax(businessBreakService.insertBusinessBreak(businessBreak));
}
/**
*
*/
@RequiresPermissions("business:break:edit")
@Log(title = "故障", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody BusinessBreak businessBreak)
{
return toAjax(businessBreakService.updateBusinessBreak(businessBreak));
}
/**
*
*/
@RequiresPermissions("business:break:remove")
@Log(title = "故障", businessType = BusinessType.DELETE)
@DeleteMapping("/{breakIds}")
public Result remove(@PathVariable Long[] breakIds)
{
return toAjax(businessBreakService.deleteBusinessBreakByBreakIds(breakIds));
}
/**
*
*/
@PostMapping("breakLog")
public Result<List<BreakLog>> breakLog(){
List<BreakLog> list = businessBreakService.breakLog();
Result<List<BreakLog>> success = Result.success(list);
return success;
}
}

View File

@ -1,8 +1,8 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.Fence;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.common.business.domain.Fence;
import com.zhilian.business.service.FenceService;
import com.zhilian.common.core.web.page.TableDataInfo;
import com.zhilian.common.security.utils.SecurityUtils;

View File

@ -1,8 +1,8 @@
package com.zhilian.business.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhilian.common.business.domain.Markers;
import com.zhilian.common.business.domain.middle.MarkersFence;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.domain.middle.MarkersFence;
import com.zhilian.business.service.MarkersFenceService;
import com.zhilian.business.service.MarkersService;
import com.zhilian.common.core.domain.Result;

View File

@ -1,6 +1,6 @@
package com.zhilian.business.controller;
import com.zhilian.common.business.domain.middle.MarkersFence;
import com.zhilian.business.domain.middle.MarkersFence;
import com.zhilian.business.service.MarkersFenceService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;

View File

@ -1,8 +1,8 @@
package com.zhilian.business.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.common.business.domain.middle.VehicleMarkers;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.service.MarkersService;
import com.zhilian.business.service.VehicleMarkersService;
import com.zhilian.business.service.VehicleService;

View File

@ -1,6 +1,5 @@
package com.zhilian.business.controller;
import com.zhilian.common.business.domain.middle.VehicleMarkers;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.service.VehicleMarkersService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;

View File

@ -1,6 +1,5 @@
package com.zhilian.business.controller;
import com.zhilian.common.business.domain.VehicleType;
import com.zhilian.business.domain.VehicleType;
import com.zhilian.business.service.VehicleTypeService;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;

View File

@ -0,0 +1,44 @@
package com.zhilian.business.domain;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.Date;
/**
* @ClassName Break
* @Description
* @Author YuanYongH
* @Date 2024/4/4 9:40
*/
@Data
public class Break {
/**
* id
**/
private Integer breakId;
/**
*
**/
private String breakCode;
/**
* VIN
**/
private String breakVin;
/**
*
**/
private Date breakDate;
/**
*
**/
private Date breakTime;
/**
*
**/
private String breakType;
/**
*
**/
private Integer breakState;
}

View File

@ -0,0 +1,30 @@
package com.zhilian.business.domain;
import com.zhilian.common.core.web.page.PageResult;
import io.swagger.models.auth.In;
import lombok.Data;
/**
* @ClassName BreakLog
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 15:07
*/
@Data
public class BreakLog {
/** 故障日志id */
private Integer breakLogId;
/** 故障码 */
private String breakCode;
/** 车辆VIN */
private String breakVin;
/** 故障类型 */
private String breakType;
/** 结束报警时间 */
private String breakTime;
/** 开始报警时间 */
private String breakDate;
/** 是否报警 */
private String breakState;
}

View File

@ -0,0 +1,33 @@
package com.zhilian.business.domain;
import io.swagger.models.auth.In;
import lombok.Data;
/**
* @ClassName BreakVo
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/4 9:51
*/
@Data
public class BreakVo {
/**
* id
**/
private Integer breakId;
/**
* VIN
**/
private String breakVin;
/**
*
**/
private Integer breakState;
/**
*
**/
private Integer pageNum = 1;
private Integer pageSize = 3;
}

View File

@ -0,0 +1,112 @@
package com.zhilian.business.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhilian.common.core.annotation.Excel;
import com.zhilian.common.core.web.domain.BaseEntity;
/**
* business_break
*
* @author Yy
* @date 2024-04-07
*/
@Data
public class BusinessBreak extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long breakId;
/** 故障码 */
@Excel(name = "故障码")
private String breakCode;
/** 车辆VIN */
@Excel(name = "车辆VIN")
private String breakVin;
/** 结束报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private String breakTime;
/** 故障类型 */
@Excel(name = "故障类型")
private String breakType;
/** 开始报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private String breakDate;
/** 是否警告 */
@Excel(name = "是否警告")
private String breakState;
public void setBreakId(Long breakId)
{
this.breakId = breakId;
}
public Long getBreakId()
{
return breakId;
}
public void setBreakCode(String breakCode)
{
this.breakCode = breakCode;
}
public String getBreakCode()
{
return breakCode;
}
public void setBreakVin(String breakVin)
{
this.breakVin = breakVin;
}
public String getBreakVin()
{
return breakVin;
}
public void setBreakType(String breakType)
{
this.breakType = breakType;
}
public String getBreakType()
{
return breakType;
}
public void setBreakState(String breakState)
{
this.breakState = breakState;
}
public String getBreakState()
{
return breakState;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("breakId", getBreakId())
.append("breakCode", getBreakCode())
.append("breakVin", getBreakVin())
.append("breakTime", getBreakTime())
.append("breakType", getBreakType())
.append("breakDate", getBreakDate())
.append("breakState", getBreakState())
.toString();
}
}

View File

@ -0,0 +1,28 @@
package com.zhilian.business.domain.request;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName BreakReq
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 15:28
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BreakReq {
/** 故障id */
private Integer breakId;
/** 故障码 */
private String breakCode;
/** 车辆VIN */
private String breakVin;
/** 故障类型 */
private String breakType;
}

View File

@ -0,0 +1,21 @@
package com.zhilian.business.mapper;
import com.zhilian.business.domain.BreakLog;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @ClassName BreakLogMapper
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 20:49
*/
@Mapper
public interface BreakLogMapper {
List<BreakLog> breakLog();
int logAdd(BreakLog breakLog);
int updLog(BreakLog breakLog);
}

View File

@ -0,0 +1,27 @@
package com.zhilian.business.mapper;
import com.zhilian.business.domain.Break;
import com.zhilian.business.domain.BreakVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
/**
* @ClassName BreakMapper
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/4 9:59
*/
@Mapper
public interface BreakMapper {
List<Break> breakList(BreakVo breakVo);
int breakAdd(Break break1);
int breakUpd(Break break1);
int breakDel(Integer breakId);
Integer addBreak(String breakCode, String breakVin, Date breakTime, Date breakDate, String breakType, Integer breakState);
}

View File

@ -0,0 +1,67 @@
package com.zhilian.business.mapper;
import java.util.List;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.domain.request.BreakReq;
/**
* Mapper
*
* @author Yy
* @date 2024-04-07
*/
public interface BusinessBreakMapper
{
/**
*
*
* @param breakId
* @return
*/
public BusinessBreak selectBusinessBreakByBreakId(Long breakId);
/**
*
*
* @param breakReq
* @return
*/
public List<BusinessBreak> selectBusinessBreakList(BreakReq breakReq);
/**
*
*
* @param businessBreak
* @return
*/
public int insertBusinessBreak(BusinessBreak businessBreak);
/**
*
*
* @param businessBreak
* @return
*/
public int updateBusinessBreak(BusinessBreak businessBreak);
/**
*
*
* @param breakId
* @return
*/
public int deleteBusinessBreakByBreakId(Long breakId);
/**
*
*
* @param breakIds
* @return
*/
public int deleteBusinessBreakByBreakIds(Long[] breakIds);
List<BreakLog> breakLog();
}

View File

@ -1,7 +1,6 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.common.business.domain.Fence;
import com.zhilian.business.domain.Fence;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -1,7 +1,6 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.common.business.domain.middle.MarkersFence;
import com.zhilian.business.domain.middle.MarkersFence;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -1,7 +1,6 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.common.business.domain.Markers;
import com.zhilian.business.domain.Markers;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -1,7 +1,7 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.business.domain.Vehicle;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -1,7 +1,6 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.common.business.domain.middle.VehicleMarkers;
import com.zhilian.business.domain.middle.VehicleMarkers;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -1,7 +1,6 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.common.business.domain.VehicleType;
import com.zhilian.business.domain.VehicleType;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

View File

@ -0,0 +1,19 @@
package com.zhilian.business.service;
import com.zhilian.business.domain.BreakLog;
import java.util.List;
/**
* @ClassName BreakLogService
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 20:49
*/
public interface BreakLogService {
List<BreakLog> breakLog();
int logAdd(BreakLog breakLog);
int updLog(BreakLog breakLog);
}

View File

@ -0,0 +1,21 @@
package com.zhilian.business.service;
import com.zhilian.business.domain.Break;
import com.zhilian.business.domain.BreakVo;
import com.zhilian.common.core.web.page.PageResult;
/**
* @ClassName BreakService
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/4 9:54
*/
public interface BreakService {
PageResult<Break> breakList(BreakVo breakVo);
int breakAdd(Break break1);
int breakUpd(Break break1);
int breakDel(Integer breakId);
}

View File

@ -1,7 +1,7 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.common.business.domain.Fence;
import com.zhilian.business.domain.Fence;
import java.util.List;

View File

@ -0,0 +1,67 @@
package com.zhilian.business.service;
import java.util.List;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.domain.request.BreakReq;
/**
* Service
*
* @author Yy
* @date 2024-04-07
*/
public interface IBusinessBreakService
{
/**
*
*
* @param breakId
* @return
*/
public BusinessBreak selectBusinessBreakByBreakId(Long breakId);
/**
*
*
* @param breakReq
* @return
*/
public List<BusinessBreak> selectBusinessBreakList(BreakReq breakReq);
/**
*
*
* @param businessBreak
* @return
*/
public int insertBusinessBreak(BusinessBreak businessBreak);
/**
*
*
* @param businessBreak
* @return
*/
public int updateBusinessBreak(BusinessBreak businessBreak);
/**
*
*
* @param breakIds
* @return
*/
public int deleteBusinessBreakByBreakIds(Long[] breakIds);
/**
*
*
* @param breakId
* @return
*/
public int deleteBusinessBreakByBreakId(Long breakId);
List<BreakLog> breakLog();
}

View File

@ -1,8 +1,9 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.common.business.domain.Markers;
import com.zhilian.common.business.domain.middle.MarkersFence;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.domain.middle.MarkersFence;
public interface MarkersFenceService extends IService<MarkersFence> {
boolean insert(Markers markers);

View File

@ -1,7 +1,7 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.common.business.domain.Markers;
import com.zhilian.business.domain.Markers;
import java.util.List;

View File

@ -1,8 +1,8 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.common.business.domain.middle.VehicleMarkers;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import org.springframework.stereotype.Service;
@Service

View File

@ -1,7 +1,7 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.business.domain.Vehicle;
import java.util.List;

View File

@ -1,7 +1,8 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.common.business.domain.VehicleType;
import com.zhilian.business.domain.VehicleType;
import java.util.List;

View File

@ -0,0 +1,77 @@
package com.zhilian.business.service.impl;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.mapper.BreakLogMapper;
import com.zhilian.business.service.BreakLogService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName BreakLogServiceImpl
* @Description
* @Author YuanYongH
* @Date 2024/4/8 20:49
*/
@Service
@Log4j2
public class BreakLogServiceImpl implements BreakLogService {
@Autowired
private BreakLogMapper breakLogMapper;
@Autowired
private RedisTemplate<String ,String> redisTemplate;
@Override
public List<BreakLog> breakLog() {
BreakLog breakLog = new BreakLog();
// 10秒
final long timeInterval = 10000;
Runnable runnable = new Runnable() {
@Override
public void run() {
while (true){
breakLogMapper.breakLog();
log.info("扫描故障状态");
String breakState = breakLog.getBreakState();
if (breakState != null){
// 判断故障状态
if (breakLog.getBreakState().equals("0")){
log.info("正常");
}else if (breakLog.getBreakState().equals("1")){
log.info("故障");
}else {
log.info("未知");
}
}
try {
Thread.sleep(timeInterval);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
// 开启线程
Thread thread = new Thread(runnable);
thread.start();
// 返回故障日志
return breakLogMapper.breakLog();
}
@Override
public int logAdd(BreakLog breakLog) {
return breakLogMapper.logAdd(breakLog);
}
@Override
public int updLog(BreakLog breakLog) {
return breakLogMapper.updLog(breakLog);
}
}

View File

@ -0,0 +1,51 @@
package com.zhilian.business.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhilian.business.domain.Break;
import com.zhilian.business.domain.BreakVo;
import com.zhilian.business.mapper.BreakMapper;
import com.zhilian.business.service.BreakService;
import com.zhilian.common.core.web.page.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName BreakServiceImpl
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/4 9:54
*/
@Service
public class BreakServiceImpl implements BreakService {
@Autowired
private BreakMapper breakMapper;
@Override
public PageResult<Break> breakList(BreakVo breakVo) {
PageHelper.startPage(breakVo.getPageNum(),breakVo.getPageSize());
List<Break> list = breakMapper.breakList(breakVo);
PageInfo<Break> info = new PageInfo<>(list);
return PageResult.toResult(info.getTotal(),list).getData();
}
@Override
public int breakAdd(Break break1) {
int i = breakMapper.breakAdd(break1);
if (i>0){
breakMapper.addBreak(break1.getBreakCode(),break1.getBreakVin(),break1.getBreakTime(),break1.getBreakDate(),break1.getBreakType(),break1.getBreakState());
}
return i;
}
@Override
public int breakUpd(Break break1) {
return breakMapper.breakUpd(break1);
}
@Override
public int breakDel(Integer breakId) {
return breakMapper.breakDel(breakId);
}
}

View File

@ -0,0 +1,101 @@
package com.zhilian.business.service.impl;
import java.util.List;
import com.zhilian.business.domain.BreakLog;
import com.zhilian.business.domain.request.BreakReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhilian.business.mapper.BusinessBreakMapper;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.service.IBusinessBreakService;
/**
* Service
*
* @author Yy
* @date 2024-04-07
*/
@Service
public class BusinessBreakServiceImpl implements IBusinessBreakService
{
@Autowired
private BusinessBreakMapper businessBreakMapper;
/**
*
*
* @param breakId
* @return
*/
@Override
public BusinessBreak selectBusinessBreakByBreakId(Long breakId)
{
return businessBreakMapper.selectBusinessBreakByBreakId(breakId);
}
/**
*
*
* @param breakReq
* @return
*/
@Override
public List<BusinessBreak> selectBusinessBreakList(BreakReq breakReq)
{
return businessBreakMapper.selectBusinessBreakList(breakReq);
}
/**
*
*
* @param businessBreak
* @return
*/
@Override
public int insertBusinessBreak(BusinessBreak businessBreak)
{
return businessBreakMapper.insertBusinessBreak(businessBreak);
}
/**
*
*
* @param businessBreak
* @return
*/
@Override
public int updateBusinessBreak(BusinessBreak businessBreak)
{
return businessBreakMapper.updateBusinessBreak(businessBreak);
}
/**
*
*
* @param breakIds
* @return
*/
@Override
public int deleteBusinessBreakByBreakIds(Long[] breakIds)
{
return businessBreakMapper.deleteBusinessBreakByBreakIds(breakIds);
}
/**
*
*
* @param breakId
* @return
*/
@Override
public int deleteBusinessBreakByBreakId(Long breakId)
{
return businessBreakMapper.deleteBusinessBreakByBreakId(breakId);
}
@Override
public List<BreakLog> breakLog() {
return businessBreakMapper.breakLog();
}
}

View File

@ -2,7 +2,7 @@ package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.common.business.domain.Fence;
import com.zhilian.business.domain.Fence;
import com.zhilian.business.mapper.FenceMapper;
import com.zhilian.business.service.FenceService;
import com.zhilian.common.core.utils.StringUtils;

View File

@ -1,9 +1,8 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.common.business.domain.Markers;
import com.zhilian.common.business.domain.middle.MarkersFence;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.domain.middle.MarkersFence;
import com.zhilian.business.mapper.MarkersFenceMapper;
import com.zhilian.business.service.MarkersFenceService;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -2,7 +2,7 @@ package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.common.business.domain.Markers;
import com.zhilian.business.domain.Markers;
import com.zhilian.business.mapper.MarkersMapper;
import com.zhilian.business.service.MarkersService;
import com.zhilian.common.core.utils.StringUtils;

View File

@ -1,9 +1,8 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.common.business.domain.middle.VehicleMarkers;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.domain.middle.VehicleMarkers;
import com.zhilian.business.mapper.VehicleMarkersMapper;
import com.zhilian.business.service.VehicleMarkersService;
import org.springframework.stereotype.Service;

View File

@ -2,7 +2,7 @@ package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.common.business.domain.Vehicle;
import com.zhilian.business.domain.Vehicle;
import com.zhilian.business.mapper.VehicleMapper;
import com.zhilian.business.service.VehicleService;
import com.zhilian.common.core.utils.StringUtils;

View File

@ -1,7 +1,7 @@
package com.zhilian.business.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhilian.common.business.domain.VehicleType;
import com.zhilian.business.domain.VehicleType;
import com.zhilian.business.mapper.VehicleTypeMapper;
import com.zhilian.business.service.VehicleTypeService;
import com.zhilian.common.redis.service.RedisService;

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhilian.business.mapper.BreakLogMapper">
<insert id="logAdd">
INSERT INTO `zhilian-business`.`business_break_log`
( `break_code`, `break_vin`, `break_time`, `break_type`, `break_date`, `break_state`)
VALUES
(#{breakCode}, #{breakVin}, NOW(), #{breakType}, NOW(), #{breakState});
</insert>
<update id="updLog">
UPDATE `zhilian-business`.`business_break_log`
SET `break_code` = #{breakCode}, `break_vin` = #{breakVin}, `break_time` = NOW(), `break_type` = #{breakType}, `break_date` = NOW(), `break_state` = #{breakState}
WHERE `break_log_id` = #{breakLogId};
</update>
<select id="breakLog" resultType="com.zhilian.business.domain.BreakLog">
select * from business_break_log
</select>
</mapper>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhilian.business.mapper.BreakMapper">
<insert id="breakAdd">
</insert>
<insert id="addBreak">
</insert>
<update id="breakUpd">
</update>
<update id="breakDel">
delete from business_breakdown where break_id = #{breakId}
</update>
<select id="breakList" resultType="com.zhilian.business.domain.Break">
select * from business_break
</select>
</mapper>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhilian.business.mapper.BusinessBreakMapper">
<resultMap type="com.zhilian.business.domain.BusinessBreak" id="BusinessBreakResult">
<result property="breakId" column="break_id" />
<result property="breakCode" column="break_code" />
<result property="breakVin" column="break_vin" />
<result property="breakTime" column="break_time" />
<result property="breakType" column="break_type" />
<result property="breakDate" column="break_date" />
<result property="breakState" column="break_state" />
</resultMap>
<sql id="selectBusinessBreakVo">
select break_id, break_code, break_vin, break_time, break_type, break_date, break_state from business_break
</sql>
<select id="selectBusinessBreakList" parameterType="com.zhilian.business.domain.BusinessBreak" resultMap="BusinessBreakResult">
<include refid="selectBusinessBreakVo"/>
<where>
<if test="breakCode != null and breakCode != ''"> and break_code = #{breakCode}</if>
<if test="breakVin != null and breakVin != ''"> and break_vin = #{breakVin}</if>
<if test="breakType != null and breakType != ''"> and break_type = #{breakType}</if>
</where>
</select>
<select id="selectBusinessBreakByBreakId" parameterType="Long" resultMap="BusinessBreakResult">
<include refid="selectBusinessBreakVo"/>
where break_id = #{breakId}
</select>
<select id="breakLog" resultType="com.zhilian.business.domain.BreakLog">
select * from business_break_log
</select>
<insert id="insertBusinessBreak" parameterType="com.zhilian.business.domain.BusinessBreak" useGeneratedKeys="true" keyProperty="breakId">
insert into business_break
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="breakCode != null">break_code,</if>
<if test="breakVin != null">break_vin,</if>
<if test="breakTime != null">break_time,</if>
<if test="breakType != null">break_type,</if>
<if test="breakDate != null">break_date,</if>
<if test="breakState != null">break_state,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="breakCode != null">#{breakCode},</if>
<if test="breakVin != null">#{breakVin},</if>
<if test="breakTime != null">#{breakTime},</if>
<if test="breakType != null">#{breakType},</if>
<if test="breakDate != null">#{breakDate},</if>
<if test="breakState != null">#{breakState},</if>
</trim>
</insert>
<update id="updateBusinessBreak" parameterType="com.zhilian.business.domain.BusinessBreak">
update business_break
<trim prefix="SET" suffixOverrides=",">
<if test="breakCode != null">break_code = #{breakCode},</if>
<if test="breakVin != null">break_vin = #{breakVin},</if>
<if test="breakTime != null">break_time = #{breakTime},</if>
<if test="breakType != null">break_type = #{breakType},</if>
<if test="breakDate != null">break_date = #{breakDate},</if>
<if test="breakState != null">break_state = #{breakState},</if>
</trim>
where break_id = #{breakId}
</update>
<delete id="deleteBusinessBreakByBreakId" parameterType="Long">
delete from business_break where break_id = #{breakId}
</delete>
<delete id="deleteBusinessBreakByBreakIds" parameterType="String">
delete from business_break where break_id in
<foreach item="breakId" collection="array" open="(" separator="," close=")">
#{breakId}
</foreach>
</delete>
</mapper>

View File

@ -140,31 +140,31 @@ public class MqttxConfig {
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
log.info("消息到达,接受消息主题{},接受消息Qos{},接受消息内容{}", topic, mqttMessage.getQos(), new String(mqttMessage.getPayload()));
HashSet<String> strings = new HashSet<>();
strings.add("malfunction");
strings.add("event-storage");
strings.add("geofence");
redisService.setCacheSet("vehicle-event:" + "VIN123456789DIJE4",strings);
Set<Object> cacheSet = redisService.getCacheSet("vehicle-event:" + "VIN123456789DIJE4");
if (redisService.hasKey("vehicle-event:" + "VIN123456789DIJE4")){
//有事件
Set<Object> cacheSet1 = redisService.getCacheSet("vehicle-event:" + "VIN123456789DIJE4");
Set<String> events = cacheSet1.stream().map(item -> {
return String.valueOf(item);
}).collect(Collectors.toSet());
if (events.contains("geofence")){
//包含围栏事件
}else {
//不包含围栏事件
redisService.setCacheSet("vehicle-event:" + "VIN123456789DIJE4","geofence");
redisService.deleteCacheSet("vehicle-event:" + "VIN123456789DIJE4");
events.add("geofence");
redisService.setCacheSet("vehicle-event:" + "VIN123456789DIJE4",events);
}
}
// HashSet<String> strings = new HashSet<>();
// strings.add("malfunction");
// strings.add("event-storage");
// strings.add("geofence");
//
// redisService.setCacheSet("vehicle-event:" + "VIN123456789DIJE4",strings);
// Set<Object> cacheSet = redisService.getCacheSet("vehicle-event:" + "VIN123456789DIJE4");
//
// if (redisService.hasKey("vehicle-event:" + "VIN123456789DIJE4")){
// //有事件
// Set<Object> cacheSet1 = redisService.getCacheSet("vehicle-event:" + "VIN123456789DIJE4");
// Set<String> events = cacheSet1.stream().map(item -> {
// return String.valueOf(item);
// }).collect(Collectors.toSet());
// if (events.contains("geofence")){
// //包含围栏事件
//
// }else {
// //不包含围栏事件
// redisService.setCacheSet("vehicle-event:" + "VIN123456789DIJE4","geofence");
// redisService.deleteCacheSet("vehicle-event:" + "VIN123456789DIJE4");
// events.add("geofence");
// redisService.setCacheSet("vehicle-event:" + "VIN123456789DIJE4",events);
// }
// }
//将接受到的车辆报文存储到kafka中
executorService.execute(() -> {

View File

@ -130,6 +130,7 @@
<artifactId>spring-kafka</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,14 @@
package com.zhilian.resolver;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class GeoFence {
private String longitudeAndLatitude;
}

View File

@ -1,19 +1,32 @@
package com.zhilian.resolver;
import com.zhilian.common.security.annotation.EnableCustomConfig;
import com.zhilian.common.security.annotation.EnableMyFeignClients;
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* @ClassName ZhiLianResolverApplication
* @Description TODO
* @Author YuanYongH
* @Date 2024/4/8 17:25
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableScheduling
@EnableMyFeignClients
@EnableMyFeignClients(basePackages = {"com.zhilian.business.remote","com.zhilian.common.system.remote"})
@MapperScan({"com.zhilian.resolver.mapper", "com.zhilian.resolver.resolverReport"})
@SpringBootApplication
//com.zhilian.business.remote.factory.RemoteBreakFallbackFactory
//com.zhilian.business.remote.factory.RemoteFenceFallbackFactory
//com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory
public class ZhiLianResolverApplication {
public static void main(String[] args) {
SpringApplication.run(ZhiLianResolverApplication.class, args);
SpringApplication.run(ZhiLianResolverApplication.class,args);
}
}

View File

@ -28,9 +28,4 @@ public class RealTimeTrajectoryController {
return result;
}
@GetMapping("/findVin/{vin}")
public String findVin(@PathVariable String vin){
String result = realTimeTrajectoryService.findVin(vin);
return result;
}
}

View File

@ -1,88 +1,97 @@
package com.zhilian.resolver.model;
import com.zhilian.common.core.utils.SpringUtils;
import com.zhilian.common.resolver.domain.ResolverReportData;
import com.zhilian.resolver.service.ResolverEventService;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import static com.zhilian.resolver.utils.ConvertUtils.hexStringToString;
import static com.zhilian.resolver.utils.ConvertUtils.parseVehicleData;
/**
* @ClassName ModelsKafkaMessage
* @Description
* @Author Can.J
* @Date 2024/4/8
*/
@Component
@Slf4j
public class ModelsKafkaMessage {
private static final String TOPIC_NAME = "test-topic";
private static final String BOOTSTRAP_SERVERS = "10.10.25.5:9092";
static ArrayList<String> stringEvents = new ArrayList<>() {
{
add("malfunction"); //故障事件
add("event-realTimeTrajectory"); //实时轨迹数事件
add("event-storage"); //存储服务事件
add("geofence"); //电子围栏事件
}
};
/**
*
* @return
*/
@Scheduled(fixedDelay = 50)
private static void consumerMessages() {
Properties props = new Properties();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS);
props.put(ConsumerConfig.GROUP_ID_CONFIG, "my-consumer-group");
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
//创建消费者
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
try {
//订阅主题
consumer.subscribe(Collections.singletonList(TOPIC_NAME));
//持续消费消息
while (true) {
ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
records.forEach(record -> {
System.out.println("接收到的数据:" + record.value());
String str = hexStringToString(record.value());
List<ResolverReportData> resolverReportDataList = parseVehicleData(str);
for (ResolverReportData vehicleData : resolverReportDataList) {
log.info("解析到车辆数据:{}", vehicleData);
//str-->vehicleDataList-->vehicleData实例
log.info("解析到车辆数据:{}", vehicleData);
for (String stringEvent : stringEvents) {
ResolverEventService resolverEventService =SpringUtils.getBean(stringEvent);
resolverEventService.execute(vehicleData);
}
}
});
}
} catch (Exception e) {
e.printStackTrace();
} finally {
consumer.close();
}
}
}
//package com.zhilian.resolver.model;
//import com.zhilian.common.core.utils.SpringUtils;
//import com.zhilian.common.redis.service.RedisService;
//import com.zhilian.common.resolver.domain.ResolverReportData;
//import com.zhilian.resolver.service.ResolverEventService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.kafka.clients.consumer.ConsumerConfig;
//import org.apache.kafka.clients.consumer.ConsumerRecords;
//import org.apache.kafka.clients.consumer.KafkaConsumer;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.time.Duration;
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static com.zhilian.resolver.utils.ConvertUtils.hexStringToString;
//import static com.zhilian.resolver.utils.ConvertUtils.parseVehicleData;
//
///**
// * @ClassName ModelsKafkaMessage
// * @Description 描述
// * @Author Can.J
// * @Date 2024/4/8
// */
//@Component
//@Slf4j
//public class ModelsKafkaMessage {
// @Autowired
// private RedisService redisService;
// private static final String TOPIC_NAME = "vehicle-topic";
// private static final String BOOTSTRAP_SERVERS = "10.10.25.5:9092";
//
//
//
// /**
// * 消费者配置
// * @return
// */
// @PostConstruct
// private void consumerMessages() {
// Thread kafkaConsumerThread = new Thread(() -> {
// log.info("启动线程");
// Properties props = new Properties();
// props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, BOOTSTRAP_SERVERS);
// props.put(ConsumerConfig.GROUP_ID_CONFIG, "my-consumer-group");
// props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
// props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringDeserializer");
//
// //创建消费者
// KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
//
// try {
//
// //订阅主题
// consumer.subscribe(Collections.singletonList(TOPIC_NAME));
//
// //持续消费消息
// while (true) {
// ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));
// records.forEach(record -> {
// System.out.println("接收到的数据:" + record.value());
// String str = hexStringToString(record.value());
// List<ResolverReportData> resolverReportDataList = parseVehicleData(str);
// for (ResolverReportData vehicleData : resolverReportDataList) {
// log.info("解析到车辆数据:{}", vehicleData);
//
// //获取vin
// String vin = vehicleData.getVin();
// //获取事件集
// Set<Object> cacheSet = redisService.getCacheSet("vehicle-event:" + vin);
// List<String> events = cacheSet.stream().map(item -> {
// return String.valueOf(item);
// }).collect(Collectors.toList());
// log.info("事件集合:{}",events);
//
// log.info("解析到车辆数据:{}", vehicleData);
// for (String stringEvent : events) {
// ResolverEventService resolverEventService =SpringUtils.getBean(stringEvent);
// resolverEventService.execute(vehicleData);
// }
// }
// });
// }
// } catch (Exception e) {
// log.error("Error occurred in Kafka consumer thread", e);
// } finally {
// consumer.close();
// }
// });
// kafkaConsumerThread.start();
// }
//
//
//}

View File

@ -1,10 +1,8 @@
package com.zhilian.resolver.service.impl.eventGeofence;
import com.zhilian.common.business.domain.vo.FenceVo;
import com.zhilian.common.resolver.domain.ResolverReportData;
import com.zhilian.resolver.GeoFence;
import com.zhilian.resolver.service.ResolverEventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@ -21,8 +19,6 @@ import static java.lang.Double.parseDouble;
@Slf4j
@Service("geofence")
public class GeofenceEventServiceImpl implements ResolverEventService {
// @Autowired
// private FenceMapper fenceMapper;
@Override
public void execute(ResolverReportData resolverReportData) {
@ -33,23 +29,24 @@ public class GeofenceEventServiceImpl implements ResolverEventService {
double pointLng = parseDouble(resolverReportData.getLongitude());
//维度
double pointLat = parseDouble(resolverReportData.getLatitude());
FenceVo fenceVo = new FenceVo();
// List<Fence> list=fenceMapper.fenceList(fenceVo);
//
// for (Fence fence : list) {
// if (fence.getVin().equals(vin)){
// String[] split = fence.getFenceMessage().split(";");
//
// boolean withinFence = isWithinFence(pointLat, pointLng, Arrays.asList(split));
//
// if(withinFence){
// log.info("在围栏内");
// }else {
// log.error("不在围栏内");
// }
// }
// }
// 调用电子围栏信息
GeoFence geoFence = new GeoFence();
//39.958897,116.179075; 39.950476,116.330823; 39.865149,116.290311; 39.881485,116.083631
// 廊坊经度:116.683752 维度:39.538047
geoFence.setLongitudeAndLatitude("39.538047,116.683752;39.538047,116.683752;39.538047,116.683752;39.538047,116.683752");
String[] split = geoFence.getLongitudeAndLatitude().split(";");
boolean withinFence = isWithinFence(pointLat, pointLng, Arrays.asList(split));
if(withinFence){
log.info("在围栏内");
}else {
log.error("不在围栏内");
}
log.info("电子围挡结束");
}

View File

@ -1,10 +1,10 @@
package com.zhilian.resolver.service.impl.eventMalfunction;
import com.alibaba.fastjson.JSON;
import com.zhilian.business.domain.BusinessBreak;
import com.zhilian.business.remote.RemoteBreakService;
import com.zhilian.common.redis.service.RedisService;
import com.zhilian.common.resolver.domain.ErrorCar;
import com.zhilian.common.resolver.domain.ResolverReportData;
import com.zhilian.common.resolver.domain.SysUserEnhancedServices;
import com.zhilian.resolver.mapper.UserMapper;
import com.zhilian.resolver.service.ResolverEventService;
import com.zhilian.resolver.service.ResolverReportInfoService;
@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
@ -38,109 +39,179 @@ public class MalfunctionEventServiceImpl implements ResolverEventService {
@Autowired
private ResolverReportInfoService resolverReportInfoService;
@Autowired
private RemoteBreakService remoteBreakService;
@Override
public void execute(ResolverReportData vehicleData) {
log.info("故障事件开始执行");
if(isAnyFieldZero(vehicleData)){
resolverReportInfoService.saveDataToDatabaseByMalfunction(vehicleData);
ErrorCar errorCar = new ErrorCar();
errorCar.setVin(vehicleData.getVin());
BusinessBreak businessBreak = new BusinessBreak();
businessBreak.setBreakVin(vehicleData.getVin());
// * 车辆状态 1正常 0故障
if(vehicleData.getVehicleStatus()==0){
errorCar.setCode("GZ001");
errorCar.setLevel(1);
businessBreak.setBreakCode("CL001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("车体故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 充电状态 1正常 0故障
// private int chargingStatus;
if(vehicleData.getChargingStatus()==0){
errorCar.setCode("GZ001");
errorCar.setLevel(1);
businessBreak.setBreakCode("CD001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 运行状态 1正常 0故障
if(vehicleData.getOperatingStatus()==0){
errorCar.setCode("GZ002");
errorCar.setLevel(3);
businessBreak.setBreakCode("DW001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("行驶故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * SOC 状态 1正常 0故障
if(vehicleData.getSocStatus()==0){
errorCar.setCode("GZ003");
errorCar.setLevel(3);
businessBreak.setBreakCode("SOC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
//
// /**
// * 可充电储能装置工作状态 1正常 0故障
// */
// private int chargingEnergyStorageStatus;
//
// /**
// * 驱动电机状态 1正常 0故障
// */
// private int driveMotorStatus;
//
// /**
// * 定位是否有效 1有效 0无效
// */
// private int positionStatus;
//
// /**
// 可充电储能装置工作状态 1正常 0故障;
if(vehicleData.getChargingEnergyStorageStatus()==0){
businessBreak.setBreakCode("CDC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// 驱动电机状态 1正常 0故障
if(vehicleData.getDriveMotorStatus()==0){
businessBreak.setBreakCode("DJ001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电机故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// 定位是否有效 1有效 0无效
if(vehicleData.getPositionStatus()==0){
businessBreak.setBreakCode("SOC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("定位故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * EAS(汽车防盗系统)状态 1正常 0故障
// */
// private int easStatus;
//
// /**
if(vehicleData.getEasStatus()==0){
businessBreak.setBreakCode("EAS001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("EAS故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * PTC(电动加热器)状态 1正常 0故障
// */
// private int ptcStatus;
//
// /**
if(vehicleData.getPtcStatus()==0){
businessBreak.setBreakCode("PTC001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("加热故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * EPS(电动助力系统)状态 1正常 0故障
// */
// private int epsStatus;
//
// /**
if(vehicleData.getEpsStatus()==0){
businessBreak.setBreakCode("EPS001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电动助力故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * ABS(防抱死)状态 1正常 0故障
// */
// private int absStatus;
//
// /**
if(vehicleData.getAbsStatus()==0){
businessBreak.setBreakCode("ABS001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("ABS故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * MCU(电机/逆变器)状态 1正常 0故障
// */
// private int mcuStatus;
//
// /**
if(vehicleData.getMcuStatus()==0){
businessBreak.setBreakCode("MCU001");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("MCU故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 动力电池加热状态 1正常 0故障
// */
// private int heatingStatus;
//
// /**
if(vehicleData.getHeatingStatus()==0){
businessBreak.setBreakCode("DC002");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 动力电池当前状态 1正常 0故障
// */
// private int batteryStatus;
//
// /**
if(vehicleData.getBatteryStatus()==0){
businessBreak.setBreakCode("DC003");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * 动力电池保温状态 1正常 0故障
// */
// private int batteryInsulationStatus;
//
// /**
if(vehicleData.getBatteryInsulationStatus()==0){
businessBreak.setBreakCode("DC004");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电池故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * DCDC(电力交换系统) 状态 1正常 0故障
// */
// private int dcdcStatus;
//
// /**
if(vehicleData.getDcdcStatus()==0){
businessBreak.setBreakCode("DCDC005");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电力故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// * CHG(充电机)状态 1正常 0故障
// */
// private int chgStatus;
String key = "breakdown";
String value = JSON.toJSONString(errorCar);
redisService.setCacheObject(key,value);
if(vehicleData.getChgStatus()==0){
businessBreak.setBreakCode("CDJ005");
businessBreak.setBreakDate(new Date());
businessBreak.setBreakType("电力故障");
businessBreak.setBreakState("1");
remoteBreakService.add(businessBreak);
}
// String key = "breakdown";
String value = JSON.toJSONString(businessBreak);
redisService.setCacheObject("breakdown:gz:"+vehicleData.getVin(),value);
long expireTime = 30;
redisService.expire(key, expireTime, TimeUnit.MINUTES);
redisService.expire("breakdown:gz:"+vehicleData.getVin(), expireTime, TimeUnit.MINUTES);
}

View File

@ -1,22 +1,33 @@
package com.zhilian.resolver.service.impl.eventRealTime;
import com.zhilian.common.redis.service.RedisService;
import com.zhilian.common.resolver.domain.ResolverReportData;
import com.zhilian.resolver.service.ResolverEventService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @ClassName RealTimeTrajectoryEventImplService
* @Description
* @Author Can.J
* @Date 2024/4/4 9:49
* @ClassName RealTimeTrajectoryEventImplService
* @Description
* @Author Can.J
* @Date 2024/4/4 9:49
*/
@Slf4j
@Service("event-realTimeTrajectory")
public class RealTimeTrajectoryEventImplService implements ResolverEventService {
@Autowired
private RedisService redisService;
@Override
public void execute(ResolverReportData resolverReportData) {
log.info("开始实时数据");
//实时数据 事件名+vin为key 判断有键删除 保持最新数据 前台redis组件获取数据
if(redisService.hasKey("event-real-time:"+resolverReportData.getVin())){
redisService.deleteObject("event-real-time:"+resolverReportData.getVin());
}
redisService.setCacheSet("event-real-time:"+resolverReportData.getVin(),resolverReportData);
log.info("结束实时数据");
}
@ -29,4 +40,5 @@ public class RealTimeTrajectoryEventImplService implements ResolverEventService
public String getEventName() {
return "event-realTimeTrajectory";
}
}

View File

@ -0,0 +1,103 @@
package com.zhilian.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhilian.common.log.annotation.Log;
import com.zhilian.common.log.enums.BusinessType;
import com.zhilian.common.security.annotation.RequiresPermissions;
import com.zhilian.system.domain.BusinessBreak;
import com.zhilian.system.service.IBusinessBreakService;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.utils.poi.ExcelUtil;
import com.zhilian.common.core.web.page.TableDataInfo;
/**
*
* @author y
* @date 2024-04-07
*/
@RestController
@RequestMapping("/break")
public class BusinessBreakController extends BaseController
{
@Autowired
private IBusinessBreakService businessBreakService;
/**
*
*/
@RequiresPermissions("system:break:list")
@GetMapping("/list")
public Result<TableDataInfo<BusinessBreak>> list(BusinessBreak businessBreak)
{
startPage();
List<BusinessBreak> list = businessBreakService.selectBusinessBreakList(businessBreak);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:break:export")
@Log(title = "", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BusinessBreak businessBreak)
{
List<BusinessBreak> list = businessBreakService.selectBusinessBreakList(businessBreak);
ExcelUtil<BusinessBreak> util = new ExcelUtil<BusinessBreak>(BusinessBreak.class);
util.exportExcel(response, list, "故障码数据");
}
/**
*
*/
@RequiresPermissions("system:break:query")
@GetMapping(value = "/{breakId}")
public Result getInfo(@PathVariable("breakId") Long breakId)
{
return success(businessBreakService.selectBusinessBreakByBreakId(breakId));
}
/**
*
*/
@RequiresPermissions("system:break:add")
@Log(title = "", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody BusinessBreak businessBreak)
{
return toAjax(businessBreakService.insertBusinessBreak(businessBreak));
}
/**
*
*/
@RequiresPermissions("system:break:edit")
@Log(title = "", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody BusinessBreak businessBreak)
{
return toAjax(businessBreakService.updateBusinessBreak(businessBreak));
}
/**
*
*/
@RequiresPermissions("system:break:remove")
@Log(title = "", businessType = BusinessType.DELETE)
@DeleteMapping("/{breakIds}")
public Result remove(@PathVariable Long[] breakIds)
{
return toAjax(businessBreakService.deleteBusinessBreakByBreakIds(breakIds));
}
}

View File

@ -0,0 +1,150 @@
package com.zhilian.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhilian.common.core.annotation.Excel;
import com.zhilian.common.core.web.domain.BaseEntity;
/**
*
* @author zhilian
* @date 2024-04-07
*/
public class BusinessBreak extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long breakId;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakCar;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakVin;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Date breakTime;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakType;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakRank;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakState;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakDevice;
/** $column.columnComment */
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private String breakDesc;
public void setBreakId(Long breakId)
{
this.breakId = breakId;
}
public Long getBreakId()
{
return breakId;
}
public void setBreakCar(String breakCar)
{
this.breakCar = breakCar;
}
public String getBreakCar()
{
return breakCar;
}
public void setBreakVin(String breakVin)
{
this.breakVin = breakVin;
}
public String getBreakVin()
{
return breakVin;
}
public void setBreakTime(Date breakTime)
{
this.breakTime = breakTime;
}
public Date getBreakTime()
{
return breakTime;
}
public void setBreakType(String breakType)
{
this.breakType = breakType;
}
public String getBreakType()
{
return breakType;
}
public void setBreakRank(String breakRank)
{
this.breakRank = breakRank;
}
public String getBreakRank()
{
return breakRank;
}
public void setBreakState(String breakState)
{
this.breakState = breakState;
}
public String getBreakState()
{
return breakState;
}
public void setBreakDevice(String breakDevice)
{
this.breakDevice = breakDevice;
}
public String getBreakDevice()
{
return breakDevice;
}
public void setBreakDesc(String breakDesc)
{
this.breakDesc = breakDesc;
}
public String getBreakDesc()
{
return breakDesc;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("breakId", getBreakId())
.append("breakCar", getBreakCar())
.append("breakVin", getBreakVin())
.append("breakTime", getBreakTime())
.append("breakType", getBreakType())
.append("breakRank", getBreakRank())
.append("breakState", getBreakState())
.append("breakDevice", getBreakDevice())
.append("breakDesc", getBreakDesc())
.toString();
}
}

View File

@ -0,0 +1,30 @@
package com.zhilian.system.mapper;
import java.util.List;
import com.zhilian.system.domain.BusinessBreak;
/**
*
* @author zhilian
* @date 2024-04-07
*/
public interface BusinessBreakMapper
{
public BusinessBreak selectBusinessBreakByBreakId(Long breakId);
public List<BusinessBreak> selectBusinessBreakList(BusinessBreak businessBreak);
public int insertBusinessBreak(BusinessBreak businessBreak);
public int updateBusinessBreak(BusinessBreak businessBreak);
public int deleteBusinessBreakByBreakId(Long breakId);
public int deleteBusinessBreakByBreakIds(Long[] breakIds);
}

View File

@ -0,0 +1,25 @@
package com.zhilian.system.service;
import java.util.List;
import com.zhilian.system.domain.BusinessBreak;
public interface IBusinessBreakService
{
public BusinessBreak selectBusinessBreakByBreakId(Long breakId);
public List<BusinessBreak> selectBusinessBreakList(BusinessBreak businessBreak);
public int insertBusinessBreak(BusinessBreak businessBreak);
public int updateBusinessBreak(BusinessBreak businessBreak);
public int deleteBusinessBreakByBreakIds(Long[] breakIds);
public int deleteBusinessBreakByBreakId(Long breakId);
}

View File

@ -0,0 +1,58 @@
package com.zhilian.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhilian.system.mapper.BusinessBreakMapper;
import com.zhilian.system.domain.BusinessBreak;
import com.zhilian.system.service.IBusinessBreakService;
@Service
public class BusinessBreakServiceImpl implements IBusinessBreakService
{
@Autowired
private BusinessBreakMapper businessBreakMapper;
@Override
public BusinessBreak selectBusinessBreakByBreakId(Long breakId)
{
return businessBreakMapper.selectBusinessBreakByBreakId(breakId);
}
@Override
public List<BusinessBreak> selectBusinessBreakList(BusinessBreak businessBreak)
{
return businessBreakMapper.selectBusinessBreakList(businessBreak);
}
@Override
public int insertBusinessBreak(BusinessBreak businessBreak)
{
return businessBreakMapper.insertBusinessBreak(businessBreak);
}
@Override
public int updateBusinessBreak(BusinessBreak businessBreak)
{
return businessBreakMapper.updateBusinessBreak(businessBreak);
}
@Override
public int deleteBusinessBreakByBreakIds(Long[] breakIds)
{
return businessBreakMapper.deleteBusinessBreakByBreakIds(breakIds);
}
@Override
public int deleteBusinessBreakByBreakId(Long breakId)
{
return businessBreakMapper.deleteBusinessBreakByBreakId(breakId);
}
}

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhilian.system.mapper.BusinessBreakMapper">
<resultMap type="com.zhilian.system.domain.BusinessBreak" id="BusinessBreakResult">
<result property="breakId" column="break_id" />
<result property="breakCar" column="break_car" />
<result property="breakVin" column="break_vin" />
<result property="breakTime" column="break_time" />
<result property="breakType" column="break_type" />
<result property="breakRank" column="break_rank" />
<result property="breakState" column="break_state" />
<result property="breakDevice" column="break_device" />
<result property="breakDesc" column="break_desc" />
</resultMap>
<sql id="selectBusinessBreakVo">
select break_id, break_car, break_vin, break_time, break_type, break_rank, break_state, break_device, break_desc from business_break
</sql>
<select id="selectBusinessBreakList" parameterType="com.zhilian.system.domain.BusinessBreak" resultMap="BusinessBreakResult">
<include refid="selectBusinessBreakVo"/>
<where>
<if test="breakCar != null and breakCar != ''"> and break_car = #{breakCar}</if>
<if test="breakVin != null and breakVin != ''"> and break_vin = #{breakVin}</if>
<if test="breakTime != null "> and break_time = #{breakTime}</if>
<if test="breakType != null and breakType != ''"> and break_type = #{breakType}</if>
<if test="breakRank != null and breakRank != ''"> and break_rank = #{breakRank}</if>
<if test="breakState != null and breakState != ''"> and break_state = #{breakState}</if>
<if test="breakDevice != null and breakDevice != ''"> and break_device = #{breakDevice}</if>
<if test="breakDesc != null and breakDesc != ''"> and break_desc = #{breakDesc}</if>
</where>
</select>
<select id="selectBusinessBreakByBreakId" parameterType="Long" resultMap="BusinessBreakResult">
<include refid="selectBusinessBreakVo"/>
where break_id = #{breakId}
</select>
<insert id="insertBusinessBreak" parameterType="com.zhilian.system.domain.BusinessBreak" useGeneratedKeys="true" keyProperty="breakId">
insert into business_break
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="breakCar != null">break_car,</if>
<if test="breakVin != null">break_vin,</if>
<if test="breakTime != null">break_time,</if>
<if test="breakType != null">break_type,</if>
<if test="breakRank != null">break_rank,</if>
<if test="breakState != null">break_state,</if>
<if test="breakDevice != null">break_device,</if>
<if test="breakDesc != null">break_desc,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="breakCar != null">#{breakCar},</if>
<if test="breakVin != null">#{breakVin},</if>
<if test="breakTime != null">#{breakTime},</if>
<if test="breakType != null">#{breakType},</if>
<if test="breakRank != null">#{breakRank},</if>
<if test="breakState != null">#{breakState},</if>
<if test="breakDevice != null">#{breakDevice},</if>
<if test="breakDesc != null">#{breakDesc},</if>
</trim>
</insert>
<update id="updateBusinessBreak" parameterType="com.zhilian.system.domain.BusinessBreak">
update business_break
<trim prefix="SET" suffixOverrides=",">
<if test="breakCar != null">break_car = #{breakCar},</if>
<if test="breakVin != null">break_vin = #{breakVin},</if>
<if test="breakTime != null">break_time = #{breakTime},</if>
<if test="breakType != null">break_type = #{breakType},</if>
<if test="breakRank != null">break_rank = #{breakRank},</if>
<if test="breakState != null">break_state = #{breakState},</if>
<if test="breakDevice != null">break_device = #{breakDevice},</if>
<if test="breakDesc != null">break_desc = #{breakDesc},</if>
</trim>
where break_id = #{breakId}
</update>
<delete id="deleteBusinessBreakByBreakId" parameterType="Long">
delete from business_break where break_id = #{breakId}
</delete>
<delete id="deleteBusinessBreakByBreakIds" parameterType="String">
delete from business_break where break_id in
<foreach item="breakId" collection="array" open="(" separator="," close=")">
#{breakId}
</foreach>
</delete>
</mapper>