智慧保安后台管理-外网项目备份
tangzy
2022-02-24 d4b00c05321d9373a33bfb26618735e2a5868a81
src/main/java/org/springblade/modules/equipage/controller/GunController.java
@@ -20,6 +20,7 @@
import org.springblade.modules.equipage.excel.GunImporter;
import org.springblade.modules.equipage.service.GunService;
import org.springblade.modules.equipage.vo.GunVo;
import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -42,9 +43,11 @@
public class GunController {
   private final GunService gunService;
   private final MyAsyncService myAsyncService;
   /**
    * 自定义分页
    *
    * @param query page,size
    * @param gun 枪支信息对象
    */
@@ -56,6 +59,7 @@
   /**
    * 新增
    *
    * @param gun 枪支信息对象
    */
   @PostMapping("/save")
@@ -66,6 +70,7 @@
   /**
    * 修改
    *
    * @param gun 枪支信息对象
    */
   @PostMapping("/update")
@@ -75,6 +80,7 @@
   /**
    * 新增或修改
    *
    * @param gun 枪支信息对象
    */
   @PostMapping("/submit")
@@ -83,7 +89,7 @@
      if (null==gun.getId()) {
         //新增
         status = gunService.save(gun);
         if (status) {
         //数据同步
         String s1 =
            "insert into sys_gun(id,issue_unit,card_number,gun_mode," +
@@ -98,10 +104,13 @@
               "'" + new SimpleDateFormat("yyyy-MM-dd").format(gun.getValidTime()) + "'" + "," +
               "'" +gun.getCardNo() + "'" + "," +
               "'" +gun.getJurisdiction() + "'" + ")";
         FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      }else {
         //修改
         status = gunService.updateById(gun);
         if (status) {
         //内网同步
         String s1 =
            "update sys_gun set issue_unit = " + "'" + gun.getIssueUnit() + "'" +
@@ -114,13 +123,16 @@
               ",jurisdiction = " + "'" + gun.getJurisdiction() + "'" +
               ",card_no = " + "'" + gun.getCardNo() + "'" +
               " " +"where id = " + "'" + gun.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.FTP(s1);
         }
      }
      return R.status(status);
   }
   /**
    * 删除
    *
    * @param ids 枪支信息ids 数组
    */
   @PostMapping("/remove")
@@ -130,13 +142,15 @@
      list.forEach(id ->{
         //内网同步
         String s1 = "delete from sys_gun where id = " + "'" + id + "'";
         FtpUtil.sqlFileUpload(s1);
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.FTP(s1);
      });
      return R.status(gunService.removeByIds(Func.toLongList(ids)));
   }
   /**
    * 详情
    *
    * @param gun 枪支信息对象
    */
   @GetMapping("/detail")