作者 xudada

舱单解析表接口

package com.tianbo.analysis.controller;
import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.model.FFMInfo;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
import com.tianbo.analysis.service.FFMResolve;
import com.tianbo.util.Date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@Api(description = "舱单解析表接口")
@RestController
@RequestMapping("/ffminfo/")
public class FFMInfoController {
@Autowired
FFMResolve ffmResolve;
@ApiOperation(value = "查询未解析的入业务表的航班列表")
@RequestMapping("/selectFlightnoList")
public ResultJson<List<FFMInfo>> unresolvedFlightnoList(){
List<FFMInfo> list=ffmResolve.unresolvedFlightnoList();
return new ResultJson("200","success",list);
}
@ApiOperation(value = "查询未解析入业务表的舱单列表(参数:航班号,航班日期)")
@GetMapping("/selectFFMList")
public ResultJson<List<FFMInfo>> selectFFMList(@RequestParam(value = "flightno", required = false) String flightno,
@RequestParam(value = "flightdate", required = false) String flightdate){
FFMInfo ffmInfo=new FFMInfo();
ffmInfo.setFlightno(flightno);
if(StringUtils.isNotEmpty(flightdate)){
Date flight_Date = DateUtil.parseDate(flightdate,"yyyy-MM-dd");
ffmInfo.setFlightdate(flight_Date);
}
List<FFMInfo> list=ffmResolve.unresolvedFFMList(ffmInfo);
return new ResultJson("200","success",list);
}
@ApiOperation(value = "删除航班舱单临时表接口 (接口参数:航班号,航班日期,autoid,都为条件项)")
@GetMapping("/delFlightno")
public ResultJson delFlightno(@RequestParam(value = "flightno", required = false) String flightno,
@RequestParam(value = "flightdate", required = false) String flightdate,
@RequestParam(value = "autoid", required = false) String autiod){
FFMInfo ffmInfo=new FFMInfo();
ffmInfo.setFlightno(flightno);
if(StringUtils.isNotEmpty(flightdate)){
Date flight_Date = DateUtil.parseDate(flightdate,"yyyy-MM-dd");
ffmInfo.setFlightdate(flight_Date);
}
ffmInfo.setAutoid(autiod);
int result=ffmResolve.delFlightno(ffmInfo);
return result>0?new ResultJson("200","删除成功!"):new ResultJson("201","删除失败");
}
@ApiOperation(value = "批量删除舱单临时表接口(接口参数:list[autoid])")
@PostMapping("/batchSend")
public ResultJson batchSend(@RequestBody List<String> autoIDlist){
int result=ffmResolve.delByAutoidList(autoIDlist);
return result>0?new ResultJson("200","删除成功!"):new ResultJson("201","删除失败");
}
}
... ...
... ... @@ -2,6 +2,8 @@ package com.tianbo.analysis.dao;
import com.tianbo.analysis.model.FFMInfo;
import java.util.List;
public interface FFMInfoDao {
int deleteByPrimaryKey(String autoid);
... ... @@ -14,4 +16,12 @@ public interface FFMInfoDao {
int updateByPrimaryKeySelective(FFMInfo record);
int updateByPrimaryKey(FFMInfo record);
List<FFMInfo> unresolvedFlightnoList();
List<FFMInfo> unresolvedFFMList(FFMInfo record);
int delFlightno(FFMInfo record);
int delByAutoidList(List<String> idList);
}
... ...
... ... @@ -2,6 +2,15 @@ package com.tianbo.analysis.service;
import com.tianbo.analysis.model.FFMInfo;
import java.util.List;
public interface FFMResolve {
boolean resolve(FFMInfo ffmInfo);
List<FFMInfo> unresolvedFlightnoList();
List<FFMInfo> unresolvedFFMList(FFMInfo record);
int delFlightno(FFMInfo record);
int delByAutoidList(List<String> idList);
}
... ...
... ... @@ -65,4 +65,24 @@ public class FFMResolveImpl implements FFMResolve {
return false;
}
@Override
public List<FFMInfo> unresolvedFlightnoList() {
return ffmInfoDao.unresolvedFlightnoList();
}
@Override
public List<FFMInfo> unresolvedFFMList(FFMInfo record) {
return ffmInfoDao.unresolvedFFMList(record);
}
@Override
public int delFlightno(FFMInfo record) {
return ffmInfoDao.delFlightno(record);
}
@Override
public int delByAutoidList(List<String> idList) {
return ffmInfoDao.delByAutoidList(idList);
}
}
... ...
... ... @@ -36,6 +36,34 @@
from FFM_INFO
where AUTOID = #{autoid,jdbcType=VARCHAR}
</select>
<select id="unresolvedFlightnoList" parameterType="java.lang.String" resultMap="BaseResultMap">
select distinct flightno,flightdate from FFM_INFO where dealstatus = '0'
</select>
<select id="unresolvedFFMList" parameterType="com.tianbo.analysis.model.FFMInfo" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM FFM_INFO WHERE
FLIGHTNO = #{flightno,jdbcType=VARCHAR} AND FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP}
AND dealstatus = '0' order by REPORTORDER asc
</select>
<select id="delFlightno" parameterType="com.tianbo.analysis.model.FFMInfo">
DELETE FROM FFM_INFO where dealstatus = '0'
<if test="autoid != null">
and AUTOID = #{autoid,jdbcType=VARCHAR}
</if>
<if test="flightno != null">
and FLIGHTNO = #{flightno,jdbcType=VARCHAR}
</if>
<if test="flightdate != null">
and FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP}
</if>
</select>
<select id="delByAutoidList" parameterType="java.util.List">
DELETE FROM FFM_INFO where AUTOID in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from FFM_INFO
where AUTOID = #{autoid,jdbcType=VARCHAR}
... ...