Commit 2f840cc2 by levphon

Merge remote-tracking branch 'origin/v1.5.0' into v1.5.0

2 parents a0c80f17 c372f57e
package cn.com.glsx.stdinterface.modules.controller;
import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData;
import cn.com.glsx.stdinterface.api.VehicleServiceClient;
import cn.com.glsx.stdinterface.api.WorkOrderClient;
import cn.com.glsx.stdinterface.dto.*;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.entity.WorkOrder;
import cn.com.glsx.stdinterface.modules.service.VehicleService;
import cn.com.glsx.stdinterface.modules.service.WorkOrderService;
import cn.hutool.core.date.DateUtil;
import com.glsx.plat.core.web.R;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@RestController
@RequestMapping(value = "/vehicle")
public class VehicleController implements VehicleServiceClient {
@Autowired
private VehicleService vehicleService;
@Override
public R<VehicleDto> getVehicleBySn(@RequestParam String sn) {
if (StringUtils.isBlank(sn)) {
return R.ok("vehicle not exist");
}
Vehicle vehicle = vehicleService.getVehicleInfoBySn(sn);
if (vehicle!=null) {
VehicleDto vehicleDto = new VehicleDto();
vehicleDto.setId(vehicle.getId());
vehicleDto.setVin(vehicle.getVin());
vehicleDto.setCreateBy(vehicle.getCreatedBy());
vehicleDto.setCreateDate((vehicle.getCreatedDate()!=null)? DateUtil.format(vehicle.getCreatedDate(), "yyyy-MM-dd HH:mm:ss"):"");
return R.ok().data(vehicleDto);
}
return R.ok("vehicle not exist");
}
}
package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.entity.WorkOrder;
import cn.com.glsx.stdinterface.modules.mapper.VehicleMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 车辆服务
*/
@Slf4j
@Service
public class VehicleService {
@Autowired
private VehicleMapper vehicleMapper;
public Vehicle getVehicleInfoBySn(String sn) {
Vehicle vehicle = vehicleMapper.getVehicleBySn(sn);
return vehicle;
}
}
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
<if test="merchantType !=null and merchantType != ''"> <if test="merchantType !=null and merchantType != ''">
and merchant_type = #{merchantType} and merchant_type = #{merchantType}
</if> </if>
order by created_date desc
limit 1
</select> </select>
<delete id="logicDeleteById"> <delete id="logicDeleteById">
......
...@@ -122,7 +122,8 @@ ...@@ -122,7 +122,8 @@
select select
tv.id, tv.id,
tv.vin, tv.vin,
tv.created_by tv.created_by,
tv.created_date
from t_vehicle tv from t_vehicle tv
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
where tvd.sn = #{sn} where tvd.sn = #{sn}
......
...@@ -2,6 +2,9 @@ package cn.com.glsx.stdinterface.modules.service; ...@@ -2,6 +2,9 @@ package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.Application; import cn.com.glsx.Application;
import cn.com.glsx.stdinterface.dto.FakeOfflineFenceSnDto; import cn.com.glsx.stdinterface.dto.FakeOfflineFenceSnDto;
import cn.com.glsx.stdinterface.modules.entity.FakeOfflineFenceSn;
import cn.com.glsx.stdinterface.modules.mapper.FakeOfflineFenceSnMapper;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -19,6 +22,9 @@ class FakeOfficeServiceTest { ...@@ -19,6 +22,9 @@ class FakeOfficeServiceTest {
@Autowired @Autowired
private FakeOfficeService fakeOfficeService; private FakeOfficeService fakeOfficeService;
@Autowired
private FakeOfflineFenceSnMapper fakeOfflineFenceSnMapper;
@Test @Test
public void storeFakeData() { public void storeFakeData() {
System.out.println("test storeFakeData start "); System.out.println("test storeFakeData start ");
...@@ -34,4 +40,11 @@ class FakeOfficeServiceTest { ...@@ -34,4 +40,11 @@ class FakeOfficeServiceTest {
fakeOfficeService.storeFakeData(fakeOfflineFenceSnDto); fakeOfficeService.storeFakeData(fakeOfflineFenceSnDto);
System.out.println("test storeFakeData end "); System.out.println("test storeFakeData end ");
} }
@Test
public void test01() {
FakeOfflineFenceSn fakeOfflineFenceSn = fakeOfflineFenceSnMapper.selectBySnAndMerchantType("1610111618", 1);
System.out.println("fakeOfflineFenceSn = " + JSONUtil.toJsonStr(fakeOfflineFenceSn));
}
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.Application;
import cn.com.glsx.notify.dto.MailTemplateMessageDTO;
import cn.com.glsx.stdinterface.dto.VehicleDto;
import cn.com.glsx.stdinterface.dto.WorkOrderAddrVerifyBO;
import cn.com.glsx.stdinterface.dto.WorkOrderAddrVerifyDTO;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.entity.WorkOrder;
import cn.com.glsx.stdinterface.modules.entity.WorkOrderDocs;
import cn.com.glsx.stdinterface.modules.mapper.WorkOrderDocsMapper;
import cn.com.glsx.stdinterface.modules.model.CommonApiRequest;
import cn.com.glsx.stdinterface.modules.model.WorkOrderInfoBO;
import cn.com.glsx.stdinterface.modules.remote.NotifyCenterService;
import cn.com.glsx.stdinterface.modules.util.Sm4EncryptUtils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class VehicleServiceTest {
@Autowired
private VehicleService vehicleService;
@Test
public void testddd() {
String sn = "1190909618";
Vehicle vehicle = vehicleService.getVehicleInfoBySn(sn);
if (vehicle!=null) {
VehicleDto vehicleDto = new VehicleDto();
vehicleDto.setId(vehicle.getId());
vehicleDto.setVin(vehicle.getVin());
vehicleDto.setCreateBy(vehicle.getCreatedBy());
vehicleDto.setCreateDate((vehicle.getCreatedDate()!=null)? DateUtil.format(vehicle.getCreatedDate(), "yyyy-MM-dd HH:mm:ss"):"");
System.out.println("==" + JSONObject.toJSONString(vehicleDto));
}
System.out.println("end");
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!