智慧保安后台管理-外网项目备份
src/main/java/org/springblade/modules/equipage/controller/EquipageController.java
@@ -18,6 +18,7 @@
import org.springblade.modules.equipage.vo.EquipageVo;
import org.springblade.modules.exam.excel.ExamScoreExcel;
import org.springblade.modules.exam.excel.ExamScoreImporter;
import org.springblade.modules.system.service.MyAsyncService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -38,10 +39,12 @@
public class EquipageController {
   private final EquipageService equipageService;
   private final MyAsyncService myAsyncService;
   /**
    * 自定义分页
    * @param query page,size
    *
    * @param query    page,size
    * @param equipage 装备信息对象
    */
   @GetMapping("/page")
@@ -52,6 +55,7 @@
   /**
    * 新增
    *
    * @param equipage 装备信息对象
    */
   @PostMapping("/save")
@@ -62,6 +66,7 @@
   /**
    * 修改
    *
    * @param equipage 装备信息对象
    */
   @PostMapping("/update")
@@ -71,69 +76,78 @@
   /**
    * 新增或修改
    *
    * @param equipage 装备信息对象
    */
   @PostMapping("/submit")
   public R submit(@RequestBody Equipage equipage){
   public R submit(@RequestBody Equipage equipage) {
      boolean status = false;
      if (equipage.getId()==null){
      if (equipage.getId() == null) {
         //新增
         status = equipageService.save(equipage);
         //数据推送
         String s1 =
            "insert into sys_equipage(id,name,number,specifications,mode,dept_id,brand,date_for_production,jurisdiction,person_in_charge,num) " +
               "values(" + "'" + equipage.getId() + "'" + "," +
               "'" + equipage.getName() + "'" + "," +
               "'" + equipage.getNumber() + "'" + "," +
               "'" + equipage.getSpecifications() + "'" + "," +
               "'" + equipage.getMode() + "'" + "," +
               "'" + equipage.getDeptId() + "'" + "," +
               "'" + equipage.getBrand() + "'" + "," +
               "'" + new SimpleDateFormat("yyyy-MM-dd").format(equipage.getDateForProduction()) + "'" + "," +
               "'" + equipage.getJurisdiction() + "'" + "," +
               "'" + equipage.getPersonInCharge() + "'" + "," +
               "'" +equipage.getNum() + "'" + ")";
         FtpUtil.sqlFileUpload(s1);
      }else {
         if (status) {
            //数据推送
            String s1 =
               "insert into sys_equipage(id,name,number,specifications,mode,dept_id,brand,date_for_production,jurisdiction,person_in_charge,num) " +
                  "values(" + "'" + equipage.getId() + "'" + "," +
                  "'" + equipage.getName() + "'" + "," +
                  "'" + equipage.getNumber() + "'" + "," +
                  "'" + equipage.getSpecifications() + "'" + "," +
                  "'" + equipage.getMode() + "'" + "," +
                  "'" + equipage.getDeptId() + "'" + "," +
                  "'" + equipage.getBrand() + "'" + "," +
                  "'" + new SimpleDateFormat("yyyy-MM-dd").format(equipage.getDateForProduction()) + "'" + "," +
                  "'" + equipage.getJurisdiction() + "'" + "," +
                  "'" + equipage.getPersonInCharge() + "'" + "," +
                  "'" + equipage.getNum() + "'" + ")";
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.dataSync(s1);
         }
      } else {
         //修改
         status = equipageService.updateById(equipage);
         //内网同步
         String s1 =
            "update sys_equipage set name = " + "'" + equipage.getName() + "'" +
               ",number = " + "'" + equipage.getDeptId() + "'" +
               ",specifications = " + "'" + equipage.getSpecifications() + "'" +
               ",mode = " + "'" + equipage.getMode() + "'" +
               ",dept_id = " + "'" + equipage.getDeptId() + "'" +
               ",brand = " + "'" + equipage.getBrand() + "'" +
               ",date_for_production = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(equipage.getDateForProduction()) + "'" +
               ",jurisdiction = " + "'" + equipage.getJurisdiction() + "'" +
               ",num = " + "'" + equipage.getNum() + "'" +
               ",person_in_charge = " + "'" + equipage.getPersonInCharge() + "'" +
               " " +"where id = " + "'" + equipage.getId() + "'";
         FtpUtil.sqlFileUpload(s1);
         if (status) {
            //内网同步
            String s1 =
               "update sys_equipage set name = " + "'" + equipage.getName() + "'" +
                  ",number = " + "'" + equipage.getDeptId() + "'" +
                  ",specifications = " + "'" + equipage.getSpecifications() + "'" +
                  ",mode = " + "'" + equipage.getMode() + "'" +
                  ",dept_id = " + "'" + equipage.getDeptId() + "'" +
                  ",brand = " + "'" + equipage.getBrand() + "'" +
                  ",date_for_production = " + "'" + new SimpleDateFormat("yyyy-MM-dd").format(equipage.getDateForProduction()) + "'" +
                  ",jurisdiction = " + "'" + equipage.getJurisdiction() + "'" +
                  ",num = " + "'" + equipage.getNum() + "'" +
                  ",person_in_charge = " + "'" + equipage.getPersonInCharge() + "'" +
                  " " + "where id = " + "'" + equipage.getId() + "'";
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.dataSync(s1);
         }
      }
      return R.status(status);
   }
   /**
    * 删除
    *
    * @param ids 装备信息ids 数组
    */
   @PostMapping("/remove")
   public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
      //内网删除
      List<Long> list = Func.toLongList(ids);
      list.forEach(id ->{
      list.forEach(id -> {
         //内网同步
         String s1 = "delete from sys_equipage where id = " + "'" + id + "'";
         FtpUtil.sqlFileUpload(s1);
         //FtpUtil.sqlFileUpload(s1);
         myAsyncService.dataSync(s1);
      });
      return R.status(equipageService.removeByIds(Func.toLongList(ids)));
   }
   /**
    * 详情
    *
    * @param equipage 装备信息对象
    */
   @GetMapping("/detail")
@@ -145,6 +159,7 @@
   /**
    * 导入装备数据
    *
    * @param isCovered 1 覆盖  0不覆盖
    * @return
    */