作者 xudada

舱单解析表接口

  1 +package com.tianbo.analysis.controller;
  2 +
  3 +import com.github.pagehelper.PageInfo;
  4 +import com.tianbo.analysis.model.FFMInfo;
  5 +import com.tianbo.analysis.model.ResultJson;
  6 +import com.tianbo.analysis.model.TRANSTOARRIVEEXPORT;
  7 +import com.tianbo.analysis.service.FFMResolve;
  8 +import com.tianbo.util.Date.DateUtil;
  9 +import io.swagger.annotations.Api;
  10 +import io.swagger.annotations.ApiOperation;
  11 +import org.apache.commons.lang.StringUtils;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.web.bind.annotation.*;
  14 +
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +
  18 +@Api(description = "舱单解析表接口")
  19 +@RestController
  20 +@RequestMapping("/ffminfo/")
  21 +public class FFMInfoController {
  22 + @Autowired
  23 + FFMResolve ffmResolve;
  24 + @ApiOperation(value = "查询未解析的入业务表的航班列表")
  25 + @RequestMapping("/selectFlightnoList")
  26 + public ResultJson<List<FFMInfo>> unresolvedFlightnoList(){
  27 + List<FFMInfo> list=ffmResolve.unresolvedFlightnoList();
  28 + return new ResultJson("200","success",list);
  29 + }
  30 + @ApiOperation(value = "查询未解析入业务表的舱单列表(参数:航班号,航班日期)")
  31 + @GetMapping("/selectFFMList")
  32 + public ResultJson<List<FFMInfo>> selectFFMList(@RequestParam(value = "flightno", required = false) String flightno,
  33 + @RequestParam(value = "flightdate", required = false) String flightdate){
  34 + FFMInfo ffmInfo=new FFMInfo();
  35 + ffmInfo.setFlightno(flightno);
  36 + if(StringUtils.isNotEmpty(flightdate)){
  37 + Date flight_Date = DateUtil.parseDate(flightdate,"yyyy-MM-dd");
  38 + ffmInfo.setFlightdate(flight_Date);
  39 + }
  40 + List<FFMInfo> list=ffmResolve.unresolvedFFMList(ffmInfo);
  41 + return new ResultJson("200","success",list);
  42 + }
  43 + @ApiOperation(value = "删除航班舱单临时表接口 (接口参数:航班号,航班日期,autoid,都为条件项)")
  44 + @GetMapping("/delFlightno")
  45 + public ResultJson delFlightno(@RequestParam(value = "flightno", required = false) String flightno,
  46 + @RequestParam(value = "flightdate", required = false) String flightdate,
  47 + @RequestParam(value = "autoid", required = false) String autiod){
  48 + FFMInfo ffmInfo=new FFMInfo();
  49 + ffmInfo.setFlightno(flightno);
  50 + if(StringUtils.isNotEmpty(flightdate)){
  51 + Date flight_Date = DateUtil.parseDate(flightdate,"yyyy-MM-dd");
  52 + ffmInfo.setFlightdate(flight_Date);
  53 + }
  54 + ffmInfo.setAutoid(autiod);
  55 + int result=ffmResolve.delFlightno(ffmInfo);
  56 + return result>0?new ResultJson("200","删除成功!"):new ResultJson("201","删除失败");
  57 + }
  58 + @ApiOperation(value = "批量删除舱单临时表接口(接口参数:list[autoid])")
  59 + @PostMapping("/batchSend")
  60 + public ResultJson batchSend(@RequestBody List<String> autoIDlist){
  61 + int result=ffmResolve.delByAutoidList(autoIDlist);
  62 + return result>0?new ResultJson("200","删除成功!"):new ResultJson("201","删除失败");
  63 + }
  64 +
  65 +}
@@ -2,6 +2,8 @@ package com.tianbo.analysis.dao; @@ -2,6 +2,8 @@ package com.tianbo.analysis.dao;
2 2
3 import com.tianbo.analysis.model.FFMInfo; 3 import com.tianbo.analysis.model.FFMInfo;
4 4
  5 +import java.util.List;
  6 +
5 public interface FFMInfoDao { 7 public interface FFMInfoDao {
6 int deleteByPrimaryKey(String autoid); 8 int deleteByPrimaryKey(String autoid);
7 9
@@ -14,4 +16,12 @@ public interface FFMInfoDao { @@ -14,4 +16,12 @@ public interface FFMInfoDao {
14 int updateByPrimaryKeySelective(FFMInfo record); 16 int updateByPrimaryKeySelective(FFMInfo record);
15 17
16 int updateByPrimaryKey(FFMInfo record); 18 int updateByPrimaryKey(FFMInfo record);
  19 +
  20 + List<FFMInfo> unresolvedFlightnoList();
  21 +
  22 + List<FFMInfo> unresolvedFFMList(FFMInfo record);
  23 +
  24 + int delFlightno(FFMInfo record);
  25 +
  26 + int delByAutoidList(List<String> idList);
17 } 27 }
@@ -2,6 +2,15 @@ package com.tianbo.analysis.service; @@ -2,6 +2,15 @@ package com.tianbo.analysis.service;
2 2
3 import com.tianbo.analysis.model.FFMInfo; 3 import com.tianbo.analysis.model.FFMInfo;
4 4
  5 +import java.util.List;
  6 +
5 public interface FFMResolve { 7 public interface FFMResolve {
6 boolean resolve(FFMInfo ffmInfo); 8 boolean resolve(FFMInfo ffmInfo);
  9 + List<FFMInfo> unresolvedFlightnoList();
  10 +
  11 + List<FFMInfo> unresolvedFFMList(FFMInfo record);
  12 +
  13 + int delFlightno(FFMInfo record);
  14 +
  15 + int delByAutoidList(List<String> idList);
7 } 16 }
@@ -65,4 +65,24 @@ public class FFMResolveImpl implements FFMResolve { @@ -65,4 +65,24 @@ public class FFMResolveImpl implements FFMResolve {
65 65
66 return false; 66 return false;
67 } 67 }
  68 +
  69 + @Override
  70 + public List<FFMInfo> unresolvedFlightnoList() {
  71 + return ffmInfoDao.unresolvedFlightnoList();
  72 + }
  73 +
  74 + @Override
  75 + public List<FFMInfo> unresolvedFFMList(FFMInfo record) {
  76 + return ffmInfoDao.unresolvedFFMList(record);
  77 + }
  78 +
  79 + @Override
  80 + public int delFlightno(FFMInfo record) {
  81 + return ffmInfoDao.delFlightno(record);
  82 + }
  83 +
  84 + @Override
  85 + public int delByAutoidList(List<String> idList) {
  86 + return ffmInfoDao.delByAutoidList(idList);
  87 + }
68 } 88 }
@@ -36,6 +36,34 @@ @@ -36,6 +36,34 @@
36 from FFM_INFO 36 from FFM_INFO
37 where AUTOID = #{autoid,jdbcType=VARCHAR} 37 where AUTOID = #{autoid,jdbcType=VARCHAR}
38 </select> 38 </select>
  39 + <select id="unresolvedFlightnoList" parameterType="java.lang.String" resultMap="BaseResultMap">
  40 + select distinct flightno,flightdate from FFM_INFO where dealstatus = '0'
  41 + </select>
  42 + <select id="unresolvedFFMList" parameterType="com.tianbo.analysis.model.FFMInfo" resultMap="BaseResultMap">
  43 + SELECT
  44 + <include refid="Base_Column_List" />
  45 + FROM FFM_INFO WHERE
  46 + FLIGHTNO = #{flightno,jdbcType=VARCHAR} AND FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP}
  47 + AND dealstatus = '0' order by REPORTORDER asc
  48 + </select>
  49 + <select id="delFlightno" parameterType="com.tianbo.analysis.model.FFMInfo">
  50 + DELETE FROM FFM_INFO where dealstatus = '0'
  51 + <if test="autoid != null">
  52 + and AUTOID = #{autoid,jdbcType=VARCHAR}
  53 + </if>
  54 + <if test="flightno != null">
  55 + and FLIGHTNO = #{flightno,jdbcType=VARCHAR}
  56 + </if>
  57 + <if test="flightdate != null">
  58 + and FLIGHTDATE = #{flightdate,jdbcType=TIMESTAMP}
  59 + </if>
  60 + </select>
  61 + <select id="delByAutoidList" parameterType="java.util.List">
  62 + DELETE FROM FFM_INFO where AUTOID in
  63 + <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  64 + #{item}
  65 + </foreach>
  66 + </select>
39 <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> 67 <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
40 delete from FFM_INFO 68 delete from FFM_INFO
41 where AUTOID = #{autoid,jdbcType=VARCHAR} 69 where AUTOID = #{autoid,jdbcType=VARCHAR}