parent
38ff70f541
commit
bc56698b2f
|
@ -29,6 +29,12 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-security</artifactId>
|
<artifactId>cloud-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 公共核心依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -30,7 +30,9 @@ public interface RemoteEntService {
|
||||||
* @param entId 企业ID
|
* @param entId 企业ID
|
||||||
* @return 响应结果
|
* @return 响应结果
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/{entId}")
|
@GetMapping(value = "/getById/{entId}")
|
||||||
public Result<SysEnt> getById(@PathVariable(value = "entId") Long entId);
|
Result<SysEnt> getById(@PathVariable(value = "entId") Long entId);
|
||||||
|
// @GetMapping(value = "/{entId}")
|
||||||
|
// Result<EntResp> getById(@PathVariable(value = "entId") Long entId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.domain.FaultType;
|
|
||||||
import com.muyu.enterprise.domain.SysCarFault;
|
import com.muyu.enterprise.domain.SysCarFault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.domain.CarTemplate;
|
|
||||||
import com.muyu.enterprise.domain.vo.CarTemplateVO;
|
import com.muyu.enterprise.domain.vo.CarTemplateVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.domain.dateBase.ElectronicFence;
|
import com.muyu.enterprise.domain.dateBase.ElectronicFence;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.muyu.enterprise.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
/**
|
|
||||||
* 企业表--实体类
|
|
||||||
* @ClassName CarCompany
|
|
||||||
* @Description 企业表
|
|
||||||
* @author MingWei.Zong(微醺)
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
@TableName(value = "car_company")
|
|
||||||
@Tag(name = "企业表")
|
|
||||||
public class CarCompany {
|
|
||||||
/**
|
|
||||||
* 企业表
|
|
||||||
*/
|
|
||||||
@TableId(value = "enterprise_id",type = IdType.AUTO)
|
|
||||||
private Long enterpriseId;
|
|
||||||
/**
|
|
||||||
* 企业名称
|
|
||||||
*/
|
|
||||||
private String companyName;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.muyu.enterprise.controller;
|
|
||||||
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆企业--控制层
|
|
||||||
* @ClassName CarCompanyController
|
|
||||||
* @Description 车辆企业 Controller 层
|
|
||||||
* @author MingWei.Zong(微醺)
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/carCompany")
|
|
||||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
|
||||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
|
||||||
@Tag(name = "CarCompanyController", description = "企业表")
|
|
||||||
public class CarCompanyController extends BaseController {
|
|
||||||
|
|
||||||
private final CarCompanyService sysCarCompanyService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询企业表
|
|
||||||
*/
|
|
||||||
@PostMapping("selectCompany")
|
|
||||||
public Result<List<CarCompany>> selectCompany(){
|
|
||||||
startPage();
|
|
||||||
List<CarCompany> list = sysCarCompanyService.list();
|
|
||||||
list.forEach(carCompany -> {
|
|
||||||
|
|
||||||
});
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过ID查询企业
|
|
||||||
*/
|
|
||||||
@PostMapping("selectCompanyByCompanyId")
|
|
||||||
public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("enterpriseId") Long enterpriseId){
|
|
||||||
return Result.success(sysCarCompanyService.selectCompanyByCompanyId(enterpriseId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,19 +2,14 @@ package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.enterprise.service.CarConfigService;
|
import com.muyu.enterprise.service.CarConfigService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆配置--控制层
|
* 车辆配置--控制层
|
||||||
* @ClassName CarCompanyController
|
* @ClassName CarCompanyController
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.muyu.enterprise.cache.CarManageCacheService;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
import com.muyu.enterprise.service.CarManageService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
@ -32,8 +31,6 @@ public class CarManageController extends BaseController {
|
||||||
|
|
||||||
private final CarManageCacheService carManageCacheService;
|
private final CarManageCacheService carManageCacheService;
|
||||||
|
|
||||||
private final CarCompanyService sysCarCompanyService;
|
|
||||||
|
|
||||||
private final CarManageService carManageService;
|
private final CarManageService carManageService;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.muyu.enterprise.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆企业--持久层
|
|
||||||
* @ClassName CarCompanyMapper
|
|
||||||
* @Description 车辆企业 Mapper 层
|
|
||||||
* @author MingWei.Zong(微醺)
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
public interface CarCompanyMapper extends BaseMapper<CarCompany> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.muyu.enterprise.service;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆企业--业务层
|
|
||||||
* @ClassName CarCompanyService
|
|
||||||
* @Description 车辆企业 Service 层
|
|
||||||
* @author MingWei.Zong(微醺)
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
public interface CarCompanyService extends IService<CarCompany> {
|
|
||||||
/**
|
|
||||||
* @param enterpriseId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
CarCompany selectCompanyByCompanyId(Long enterpriseId);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.mapper.CarCompanyMapper;
|
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆企业--业务实现层
|
|
||||||
* @ClassName CarCompanyServiceImpl
|
|
||||||
* @Description 车辆企业 ServiceImpl 层
|
|
||||||
* @author MingWei.Zong(微醺)
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* 车辆企业--业务层
|
|
||||||
* @ClassName CarCompanyService
|
|
||||||
* @Description 车辆企业 Service 层
|
|
||||||
* @author MingWei.Zong(微醺)
|
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarCompany>
|
|
||||||
implements CarCompanyService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisService redisService;
|
|
||||||
@Autowired
|
|
||||||
private CarCompanyMapper carCompanyMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param enterpriseId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CarCompany selectCompanyByCompanyId(Long enterpriseId) {
|
|
||||||
return carCompanyMapper.selectById(enterpriseId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +1,12 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.domain.CarConfig;
|
import com.muyu.enterprise.domain.CarConfig;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
|
||||||
import com.muyu.enterprise.mapper.CarConfigMapper;
|
import com.muyu.enterprise.mapper.CarConfigMapper;
|
||||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.enterprise.service.CarConfigService;
|
import com.muyu.enterprise.service.CarConfigService;
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆配置--业务实现层
|
* 车辆配置--业务实现层
|
||||||
* @ClassName CarConfigServiceImpl
|
* @ClassName CarConfigServiceImpl
|
||||||
|
|
|
@ -3,16 +3,13 @@ package com.muyu.enterprise.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.system.domain.SysEnt;
|
|
||||||
import com.muyu.common.system.remote.RemoteEntService;
|
import com.muyu.common.system.remote.RemoteEntService;
|
||||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
|
||||||
import com.muyu.enterprise.domain.CarConfig;
|
import com.muyu.enterprise.domain.CarConfig;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
|
||||||
import com.muyu.enterprise.service.CarConfigService;
|
import com.muyu.enterprise.service.CarConfigService;
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
import com.muyu.enterprise.service.CarManageService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -32,8 +29,6 @@ import java.util.List;
|
||||||
public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage>
|
public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage>
|
||||||
implements CarManageService {
|
implements CarManageService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CarCompanyService carCompanyService;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarConfigService carConfigService;
|
private CarConfigService carConfigService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -71,8 +66,8 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
carVO.setEnergyType(carConfig.getEnergyType());
|
carVO.setEnergyType(carConfig.getEnergyType());
|
||||||
carVO.setGearType(carConfig.getGearType());
|
carVO.setGearType(carConfig.getGearType());
|
||||||
// 查询出对象,用于赋值 ----------远调企业
|
// 查询出对象,用于赋值 ----------远调企业
|
||||||
SysEnt data = remoteEntService.getById(carVO.getEnterpriseId()).getData();
|
// SysEnt data = remoteEntService.getById(carVO.getEnterpriseId()).getData();
|
||||||
carVO.setName(data.getName());
|
// carVO.setName(data.getName());
|
||||||
// 存到 redis
|
// 存到 redis
|
||||||
carManageCacheService.put(carVO.getCarVin(),carVOS);
|
carManageCacheService.put(carVO.getCarVin(),carVOS);
|
||||||
});
|
});
|
||||||
|
@ -84,12 +79,10 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
||||||
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
|
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
|
||||||
.selectAll(CarManage.class) // 查询所有车辆表
|
.selectAll(CarManage.class) // 查询所有车辆表
|
||||||
.select(CarCompany::getCompanyName)
|
|
||||||
.select(CarConfig::getConfigName)
|
.select(CarConfig::getConfigName)
|
||||||
.select(CarConfig::getGearType)
|
.select(CarConfig::getGearType)
|
||||||
.select(CarConfig::getEnergyType)
|
.select(CarConfig::getEnergyType)
|
||||||
.leftJoin(CarConfig.class, CarConfig::getConfigId, CarManage::getConfigId)
|
.leftJoin(CarConfig.class, CarConfig::getConfigId, CarManage::getConfigId)
|
||||||
.leftJoin(CarCompany.class, CarCompany::getEnterpriseId, CarManage::getEnterpriseId)
|
|
||||||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTe
|
||||||
// 通过 车辆类型ID 获取 车辆信息
|
// 通过 车辆类型ID 获取 车辆信息
|
||||||
CarManage carManage = carManageService.carManageShowByCarTypeId(carType.getCarTypeId());
|
CarManage carManage = carManageService.carManageShowByCarTypeId(carType.getCarTypeId());
|
||||||
// 将报文信息存储到 redis
|
// 将报文信息存储到 redis
|
||||||
carTemplateCacheService.put(carManage.getCarVin(),carTemplate);
|
// carTemplateCacheService.put(carManage.getCarVin(),carTemplate);
|
||||||
return carTemplate;
|
return carTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue