作者 shenhailong

消毒记录 删除修改为软删

分单批量挂载功能
分单批量删除功能
  1 +package com.tianbo.analysis.controller;
  2 +
  3 +import com.tianbo.analysis.model.ResultJson;
  4 +import com.tianbo.analysis.service.NmmsImportService;
  5 +import com.tianbo.analysis.service.OriginService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.*;
  8 +
  9 +/**
  10 + * @author shenhl
  11 + * <p>
  12 + * 2022/2/14/11:22
  13 + */
  14 +@RestController
  15 +@RequestMapping("/nmms/imp")
  16 +public class NmmsImportController {
  17 +
  18 +
  19 + @Autowired
  20 + OriginService originService;
  21 +
  22 + @Autowired
  23 + NmmsImportService nmmsImportService;
  24 +
  25 + /**
  26 + * 批量删除
  27 + * @param awbhIds
  28 + * @return
  29 + */
  30 + @RequestMapping(value = "/imp_removes")
  31 + @ResponseBody
  32 + public ResultJson antivirus_log_remove(String[] awbhIds){
  33 + int r = 0;
  34 + for (int i=0; i< awbhIds.length; i++){
  35 + r += originService.deleteAwbh(awbhIds[i]);
  36 + }
  37 +
  38 + return r > 0 ? new ResultJson("200", "批量删除成功")
  39 + : new ResultJson("201", "批量删除失败");
  40 + }
  41 +
  42 + /**
  43 + *
  44 + * @param awbhIds
  45 + * @param flightNo
  46 + * @param flightDate
  47 + * @return
  48 + */
  49 + @RequestMapping(value = "/mountAwbh")
  50 + @ResponseBody
  51 + public ResultJson antivirus_log_remove(@RequestParam(value ="awbhIds")String[] awbhIds,
  52 + @RequestParam(value ="flightNo") String flightNo,
  53 + @RequestParam(value ="flightDate") String flightDate){
  54 +
  55 + return nmmsImportService.mountAwbh(awbhIds,flightNo,flightDate) > 0 ? new ResultJson("200", "分单挂载成功")
  56 + : new ResultJson("201", "分单挂载失败");
  57 + }
  58 +}
@@ -23,7 +23,7 @@ public class TB_ANTIVIRUS_LOGCongtoller { @@ -23,7 +23,7 @@ public class TB_ANTIVIRUS_LOGCongtoller {
23 * 消毒记录查询 23 * 消毒记录查询
24 * @return 24 * @return
25 */ 25 */
26 - @GetMapping(value = "/antivirus_log_list") 26 + @RequestMapping(value = "/antivirus_log_list")
27 @ResponseBody 27 @ResponseBody
28 public ResultJson antivirus_log_list(@RequestParam(value = "pageSize", required = false, defaultValue = "1") int pageSize, 28 public ResultJson antivirus_log_list(@RequestParam(value = "pageSize", required = false, defaultValue = "1") int pageSize,
29 @RequestParam(value = "limitSize", required = false, defaultValue = "10") int limitSize, 29 @RequestParam(value = "limitSize", required = false, defaultValue = "10") int limitSize,
@@ -40,11 +40,11 @@ public class TB_ANTIVIRUS_LOGCongtoller { @@ -40,11 +40,11 @@ public class TB_ANTIVIRUS_LOGCongtoller {
40 * 消毒记录新增 40 * 消毒记录新增
41 * @return 41 * @return
42 */ 42 */
43 - @GetMapping(value = "/antivirus_log_add") 43 + @RequestMapping(value = "/antivirus_log_add")
44 @ResponseBody 44 @ResponseBody
45 public ResultJson antivirus_log_add(TB_ANTIVIRUS_LOG tbAntivirusLog){ 45 public ResultJson antivirus_log_add(TB_ANTIVIRUS_LOG tbAntivirusLog){
46 46
47 - return tbAntivirusLogService.updateByPrimaryKeySelective(tbAntivirusLog) > 0 ? new ResultJson("200", "新增成功") 47 + return tbAntivirusLogService.insertSelective(tbAntivirusLog) > 0 ? new ResultJson("200", "新增成功")
48 : new ResultJson("201", "新增失败"); 48 : new ResultJson("201", "新增失败");
49 } 49 }
50 50
@@ -52,7 +52,7 @@ public class TB_ANTIVIRUS_LOGCongtoller { @@ -52,7 +52,7 @@ public class TB_ANTIVIRUS_LOGCongtoller {
52 * 消毒记录修改 52 * 消毒记录修改
53 * @return 53 * @return
54 */ 54 */
55 - @GetMapping(value = "/antivirus_log_edit") 55 + @RequestMapping(value = "/antivirus_log_edit")
56 @ResponseBody 56 @ResponseBody
57 public ResultJson antivirus_log_edit(TB_ANTIVIRUS_LOG tbAntivirusLog){ 57 public ResultJson antivirus_log_edit(TB_ANTIVIRUS_LOG tbAntivirusLog){
58 58
@@ -64,7 +64,7 @@ public class TB_ANTIVIRUS_LOGCongtoller { @@ -64,7 +64,7 @@ public class TB_ANTIVIRUS_LOGCongtoller {
64 * 消毒记录删除 64 * 消毒记录删除
65 * @return 65 * @return
66 */ 66 */
67 - @GetMapping(value = "/antivirus_log_remove") 67 + @RequestMapping(value = "/antivirus_log_remove")
68 @ResponseBody 68 @ResponseBody
69 public ResultJson antivirus_log_remove(@RequestParam(value = "autoid") String autoid){ 69 public ResultJson antivirus_log_remove(@RequestParam(value = "autoid") String autoid){
70 70
@@ -23,6 +23,11 @@ public interface ORIGINMANIFESTMASTERMapper { @@ -23,6 +23,11 @@ public interface ORIGINMANIFESTMASTERMapper {
23 @Param("flightDate")String var3 23 @Param("flightDate")String var3
24 ); 24 );
25 25
  26 + ORIGINMANIFESTMASTER findAwba(@Param("waybillnomaster") String var1,
  27 + @Param("flightNo")String var2,
  28 + @Param("flightDate")String var3
  29 + );
  30 +
26 List<ORIGINMANIFESTMASTER> searchSec(String autoid); 31 List<ORIGINMANIFESTMASTER> searchSec(String autoid);
27 32
28 ORIGINMANIFESTMASTER selectwaybill(@Param("waybillnomaster") String waybillnomaster); 33 ORIGINMANIFESTMASTER selectwaybill(@Param("waybillnomaster") String waybillnomaster);
1 package com.tianbo.analysis.dao; 1 package com.tianbo.analysis.dao;
2 2
3 import com.tianbo.analysis.model.Originmanifestsecondary; 3 import com.tianbo.analysis.model.Originmanifestsecondary;
  4 +import org.apache.ibatis.annotations.Param;
4 5
5 import java.util.List; 6 import java.util.List;
6 7
@@ -11,8 +12,13 @@ public interface OriginmanifestsecondaryMapper { @@ -11,8 +12,13 @@ public interface OriginmanifestsecondaryMapper {
11 12
12 int updateRECEIPTION(Originmanifestsecondary record); 13 int updateRECEIPTION(Originmanifestsecondary record);
13 14
  15 + int updateMasterAutoId(@Param(value ="awbhAutoId") String awbhAutoId,
  16 + @Param(value ="masterAutoId") String masterAutoId);
  17 +
14 List<Originmanifestsecondary> selectAutoIdByawbAawbH(Originmanifestsecondary record); 18 List<Originmanifestsecondary> selectAutoIdByawbAawbH(Originmanifestsecondary record);
15 19
  20 + Originmanifestsecondary findAwba(@Param(value ="awbhAutoId") String awbhAutoId);
  21 +
16 int deleteAwbh(String awbhAutoId); 22 int deleteAwbh(String awbhAutoId);
17 23
18 int updateByPrimaryKeySelective(Originmanifestsecondary record); 24 int updateByPrimaryKeySelective(Originmanifestsecondary record);
  1 +package com.tianbo.analysis.service;
  2 +
  3 +import com.tianbo.analysis.model.ResultJson;
  4 +
  5 +/**
  6 + * @author shenhl
  7 + * <p>
  8 + * 2022/2/15/15:12
  9 + */
  10 +public interface NmmsImportService {
  11 +
  12 + int mountAwbh(String[] awbhIds,
  13 + String flightNo,
  14 + String flightDate);
  15 +
  16 +}
  1 +package com.tianbo.analysis.service.imp;
  2 +
  3 +import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper;
  4 +import com.tianbo.analysis.dao.OriginmanifestsecondaryMapper;
  5 +import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
  6 +import com.tianbo.analysis.model.Originmanifestsecondary;
  7 +import com.tianbo.analysis.service.NmmsImportService;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Service;
  11 +
  12 +/**
  13 + * @author shenhl
  14 + * <p>
  15 + * 2022/2/15/15:14
  16 + */
  17 +@Service
  18 +@Slf4j
  19 +public class NmmsImportServiceImpl implements NmmsImportService{
  20 +
  21 + @Autowired
  22 + OriginmanifestsecondaryMapper originmanifestsecondaryMapper;
  23 +
  24 + @Autowired
  25 + ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
  26 +
  27 + @Override
  28 + public int mountAwbh(String[] awbhIds, String flightNo, String flightDate) {
  29 +
  30 + int w = 0;
  31 + try {
  32 + String awba = "";
  33 + // 查询该分单绑定的主单id
  34 + for (int i=0; i< awbhIds.length; i++){
  35 + Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(awbhIds[i]);
  36 + log.info("查询的主单id:{}", originmanifestsecondary);
  37 + awba = originmanifestsecondary.getWaybillnomaster();
  38 + // 查询需要挂载的主单id
  39 + ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, flightNo, flightDate);
  40 + log.info("挂载主单的id:{}", originmanifestmaster);
  41 + log.info("修改分单数据参数:{}", awbhIds, originmanifestmaster.getAutoid());
  42 + // 修改分单表 所绑定的主单id
  43 + w = originmanifestsecondaryMapper.updateMasterAutoId(awbhIds[i], originmanifestmaster.getAutoid());
  44 + log.info("修改后的状态:{}", w);
  45 + }
  46 + return w;
  47 + }catch (Exception e){
  48 + e.printStackTrace();
  49 + return w;
  50 + }
  51 + }
  52 +}
@@ -6,11 +6,9 @@ import com.github.pagehelper.PageInfo; @@ -6,11 +6,9 @@ import com.github.pagehelper.PageInfo;
6 import com.tianbo.analysis.dao.TB_ANTIVIRUS_LOGMapper; 6 import com.tianbo.analysis.dao.TB_ANTIVIRUS_LOGMapper;
7 import com.tianbo.analysis.model.TB_ANTIVIRUS_LOG; 7 import com.tianbo.analysis.model.TB_ANTIVIRUS_LOG;
8 import com.tianbo.analysis.service.TB_ANTIVIRUS_LOGService; 8 import com.tianbo.analysis.service.TB_ANTIVIRUS_LOGService;
9 -import org.apache.commons.lang.StringUtils;  
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 11
13 -import java.util.ArrayList;  
14 import java.util.List; 12 import java.util.List;
15 13
16 /** 14 /**
@@ -38,7 +36,9 @@ public class TB_ANTIVIRUS_LOGServiceImpI implements TB_ANTIVIRUS_LOGService { @@ -38,7 +36,9 @@ public class TB_ANTIVIRUS_LOGServiceImpI implements TB_ANTIVIRUS_LOGService {
38 36
39 @Override 37 @Override
40 public int deleteByPrimaryKey(String autoid) { 38 public int deleteByPrimaryKey(String autoid) {
41 - return tbAntivirusLogMapper.deleteByPrimaryKey(autoid); 39 + TB_ANTIVIRUS_LOG tbAntivirusLog = new TB_ANTIVIRUS_LOG();
  40 + tbAntivirusLog.setAutoid(autoid);
  41 + return tbAntivirusLogMapper.updateByPrimaryKey(tbAntivirusLog);
42 } 42 }
43 43
44 @Override 44 @Override
@@ -487,6 +487,14 @@ GROUP BY @@ -487,6 +487,14 @@ GROUP BY
487 messagetype ASC 487 messagetype ASC
488 </select> 488 </select>
489 489
  490 + <select id="findAwba" parameterType="java.lang.String" resultMap="BaseResultMap">
  491 + select * from ORIGINMANIFESTMASTER
  492 + where
  493 + WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
  494 + and FLIGHTNO = #{flightNo,jdbcType=VARCHAR}
  495 + and flight_date = TO_DATE( #{flightDate ,jdbcType=DATE}, 'yyyy-MM-dd' )
  496 + </select>
  497 +
490 <select id="searchSec" parameterType="string" resultMap="BaseResultMap"> 498 <select id="searchSec" parameterType="string" resultMap="BaseResultMap">
491 select autoid, 499 select autoid,
492 waybillnosecondary as waybillnomaster, 500 waybillnosecondary as waybillnomaster,
@@ -206,20 +206,8 @@ @@ -206,20 +206,8 @@
206 </update> 206 </update>
207 <update id="updateByPrimaryKey" parameterType="com.tianbo.analysis.model.TB_ANTIVIRUS_LOG" > 207 <update id="updateByPrimaryKey" parameterType="com.tianbo.analysis.model.TB_ANTIVIRUS_LOG" >
208 update CGONMS.TB_ANTIVIRUS_LOG 208 update CGONMS.TB_ANTIVIRUS_LOG
209 - set FLIGHTNO = #{flightno,jdbcType=VARCHAR},  
210 - FLIGHT_DATE = #{flightDate,jdbcType=TIMESTAMP},  
211 - WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},  
212 - WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR},  
213 - ANTIVIRUS_PC = #{antivirusPc,jdbcType=DECIMAL},  
214 - ANTIVIRUS_WT = #{antivirusWt,jdbcType=DECIMAL},  
215 - ANTIVIRUS_TIME = #{antivirusTime,jdbcType=TIMESTAMP},  
216 - ANTIVIRUS_NAME = #{antivirusName,jdbcType=VARCHAR},  
217 - UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},  
218 - ANTIVIRUS_STATUS = #{antivirusStatus,jdbcType=DECIMAL},  
219 - ANTIVIRUS_DES = #{antivirusDes,jdbcType=VARCHAR},  
220 - TRAY_NUM = #{trayNum,jdbcType=VARCHAR},  
221 - IS_DELETE = #{isDelete,jdbcType=DECIMAL},  
222 - BINDING_AUTOID = #{bindingAutoid,jdbcType=VARCHAR} 209 + set
  210 + IS_DELETE = '1'
223 where AUTOID = #{autoid,jdbcType=VARCHAR} 211 where AUTOID = #{autoid,jdbcType=VARCHAR}
224 </update> 212 </update>
225 </mapper> 213 </mapper>
@@ -272,6 +272,14 @@ @@ -272,6 +272,14 @@
272 AND ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR } 272 AND ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR }
273 </update> 273 </update>
274 274
  275 + <update id="updateMasterAutoId" parameterType="string" >
  276 + UPDATE ORIGINMANIFESTSECONDARY
  277 + SET
  278 + ORIGINMANIFESTMASTERAUTOID = #{masterAutoId,jdbcType=VARCHAR}
  279 + WHERE
  280 + AUTOID = #{awbhAutoId,jdbcType=VARCHAR}
  281 + </update>
  282 +
275 <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.Originmanifestsecondary" resultType="com.tianbo.analysis.model.Originmanifestsecondary"> 283 <select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.Originmanifestsecondary" resultType="com.tianbo.analysis.model.Originmanifestsecondary">
276 SELECT AUTOID 284 SELECT AUTOID
277 FROM ORIGINMANIFESTSECONDARY 285 FROM ORIGINMANIFESTSECONDARY
@@ -281,6 +289,13 @@ @@ -281,6 +289,13 @@
281 AND ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR } 289 AND ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR }
282 </select> 290 </select>
283 291
  292 + <select id="findAwba" parameterType="java.lang.String" resultType="com.tianbo.analysis.model.Originmanifestsecondary">
  293 + SELECT *
  294 + FROM ORIGINMANIFESTSECONDARY
  295 + WHERE
  296 + AUTOID = #{awbhAutoId,jdbcType=VARCHAR}
  297 + </select>
  298 +
284 <delete id="deleteAwbh" parameterType="java.lang.String"> 299 <delete id="deleteAwbh" parameterType="java.lang.String">
285 DELETE FROM ORIGINMANIFESTSECONDARY 300 DELETE FROM ORIGINMANIFESTSECONDARY
286 WHERE 301 WHERE