Commit ad18cc3c authored by zhangzhenbang's avatar zhangzhenbang

试探性写了一两个接口

parent 6735a928
package com.yingxin.beijingvehicleflow.controller;
import com.yingxin.beijingvehicleflow.constant.Const;
import com.yingxin.beijingvehicleflow.entity.FloatingPopulation;
import com.yingxin.beijingvehicleflow.entity.IdentityInformation;
import com.yingxin.beijingvehicleflow.response.Response;
import com.yingxin.beijingvehicleflow.service.FloatingPopulationServcie;
import com.yingxin.beijingvehicleflow.util.DesUtil;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -28,31 +22,11 @@ import java.util.Date;
@RequestMapping("/api/v1")
public class FloatingPopulationController {
private static Logger LOGGER = LoggerFactory.getLogger(FloatingPopulationController.class);
@Autowired
private FloatingPopulationServcie populationServcie;
@PostMapping("/float-population")
public Response checkFloatingPopulation(@RequestBody String json) {
IdentityInformation info;
JSONObject datafterDecryptJson;
try {
JSONObject jsonObject = JSONObject.fromObject(json);
String encodedData = jsonObject.getString("encodedData");
String datafterDecryptStr = DesUtil.decrypt(Const.KEY, encodedData);
datafterDecryptJson = JSONObject.fromObject(datafterDecryptStr);
} catch (Exception e) {
LOGGER.error("json解析异常", e);
return Response.fail();
}
FloatingPopulation floatingPopulation = new FloatingPopulation();
floatingPopulation.setAuthTime(datafterDecryptJson.getString("authTime"));
floatingPopulation.setAuthCoordinate(datafterDecryptJson.getString("authCoordinate"));
floatingPopulation.setReservationId(datafterDecryptJson.getInt("id"));
public Response checkFloatingPopulation(@RequestBody FloatingPopulation floatingPopulation) {
if (!populationServcie.isIdentityInfoValid(floatingPopulation)) {
return Response.fail("INVALID-CODE","二维码已过期,请重新生成二维码。");
......
......@@ -16,7 +16,7 @@ import org.apache.ibatis.annotations.Select;
public interface FloatingPopulationMapper {
@Insert("insert into floating_population(check_coordinate,check_time,submit_coordinate,submit_time," +
"auth_coordinate,auth_time,worker_id,reservation_id,isTemperatureOk) " +
"auth_coordinate,auth_time,worker_id,reservation_id,is_temperature_ok) " +
"values(#{checkCoordinate},#{checkTime},#{submitCoordinate},#{submitTime}," +
"#{authCoordinate},#{authTime},#{workerId},#{reservationId},#{isTemperatureOk})")
int insertFloatingPopulation(FloatingPopulation floatingPopulation);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment