Browse Source

【CHG】代码格式

ZhaoMn 3 years ago
parent
commit
ebe4ccd4ed

+ 139 - 133
railway-business/src/main/java/com/railway/business/catenary/controller/BusJcbDmcgyqController.java

@@ -11,13 +11,19 @@ import com.railway.common.utils.poi.WordUtils;
 import com.railway.system.service.ISysFileService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import javax.validation.Valid;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * @author zhangcaifeng
@@ -28,134 +34,134 @@ import java.util.Map;
 @RequestMapping(value = "business/catenary/bus/jcb/dmcgyq")
 public class BusJcbDmcgyqController extends BaseController {
 
-    private final IBusJcbDmcgyqService busJcbDmcgyqService;
-    private final ISysFileService sysFileService;
-
-    public BusJcbDmcgyqController(IBusJcbDmcgyqService busJcbDmcgyqService,
-        ISysFileService sysFileService) {
-        this.busJcbDmcgyqService = busJcbDmcgyqService;
-        this.sysFileService = sysFileService;
-    }
-
-    @ApiOperation(value = "新增")
-    @PostMapping("/add")
-    public AjaxResult add(@Validated @RequestBody BusJcbDmcgyq busJcbDmcgyq) {
-        return toAjax(busJcbDmcgyqService.create(busJcbDmcgyq));
-    }
-
-    @ApiOperation(value = "删除")
-    @DeleteMapping("/{ids}")
-    public AjaxResult delete(@PathVariable(value = "ids") String[] ids) {
-        return toAjax(busJcbDmcgyqService.delete(ids));
-    }
-
-    @ApiOperation(value = "更新")
-    @PutMapping("/update")
-    public AjaxResult update(@RequestBody @Valid BusJcbDmcgyq busJcbDmcgyq) {
-        return toAjax(busJcbDmcgyqService.update(busJcbDmcgyq));
-    }
-
-    @ApiOperation(value = "单个")
-    @GetMapping(value = "/info")
-    public AjaxResult getInfo(BusJcbDmcgyq busJcbDmcgyq) {
-        BusJcbDmcgyq info = busJcbDmcgyqService.getInfo(busJcbDmcgyq);
-        AjaxResult ajax = AjaxResult.success();
-        ajax.put("info",info);
-        return ajax;
-    }
-
-    @ApiOperation(value = "列表")
-    @GetMapping(value = "/list")
-    public TableDataInfo getList(BusJcbDmcgyq busJcbDmcgyq) {
-        startPage();
-        List<BusJcbDmcgyq> list = busJcbDmcgyqService.getList(busJcbDmcgyq);
-        return getDataTable(list);
-    }
-
-    @ApiOperation(value = "获取上次检测值")
-    @GetMapping(value = "/getLastOne")
-    public AjaxResult getLastOne() {
-        BusJcbDmcgyq info = busJcbDmcgyqService.getLastRecord();
-        AjaxResult ajax = AjaxResult.success();
-        ajax.put("info",info);
-        return ajax;
-    }
-
-    @ApiOperation(value = "提交")
-    @PutMapping("/submit")
-    public AjaxResult submit(@RequestBody BusJcbDmcgyq busJcbDmcgyq) {
-        return toAjax(busJcbDmcgyqService.submit(busJcbDmcgyq));
-    }
-
-    @ApiOperation(value = "退回")
-    @PutMapping("/reject")
-    public AjaxResult reject(@RequestBody BusJcbDmcgyq busJcbDmcgyq) {
-        return toAjax(busJcbDmcgyqService.reject(busJcbDmcgyq));
-    }
-
-    @ApiOperation(value = "确认")
-    @PutMapping("/confirm")
-    public AjaxResult confirm(@RequestBody BusJcbDmcgyq busJcbDmcgyq) {
-        return toAjax(busJcbDmcgyqService.confirm(busJcbDmcgyq));
-    }
-
-    @ApiOperation(value = "导出")
-    @GetMapping("/export/{id}")
-    public AjaxResult export(@PathVariable(value = "id") String id) {
-        BusJcbDmcgyq info = new BusJcbDmcgyq();
-        info.setId(Long.parseLong(id));
-        info = busJcbDmcgyqService.getInfo(info);
-        WordUtils wordUtil = new WordUtils();
-        //填充变量
-        Map<String, Object> params = new HashMap<>();
-        params.put("${fenxiang}", info.getFenxiang() == null ? "" : info.getFenxiang());
-        params.put("${tianqi}", info.getTianqi() == null ? "" : info.getTianqi());
-        params.put("${wendu}", info.getTemperature() == null ? "" : info.getTemperature());
-        params.put("${zzhfw}", info.getPillarArea() == null ? "" : info.getPillarArea());
-        params.put("${xingbie}", info.getXingbieText());
-        params.put("${dgqwgAzlg}", StringUtils.yesOrNo(info.getDgqwgAzlg()));
-        params.put("${dgqwgWzws}", StringUtils.yesOrNo(info.getDgqwgWzws()));
-        params.put("${dgqwgBmqj}", StringUtils.yesOrNo(info.getDgqwgBmqj()));
-        params.put("${bspwgBsqx}", StringUtils.yesOrNo(info.getBspwgBsqx()));
-        params.put("${bspwgAzlg}", StringUtils.yesOrNo(info.getBspwgAzlg()));
-        params.put("${dgqclG1}", info.getDgqclG1() == null ? "" : info.getDgqclG1());
-        params.put("${dgqclG2}", info.getDgqclG2() == null ? "" : info.getDgqclG2());
-        params.put("${dgqclG3}", info.getDgqclG3() == null ? "" : info.getDgqclG3());
-        params.put("${dgqclG4}", info.getDgqclG4() == null ? "" : info.getDgqclG4());
-        params.put("${jianchariqi}", info.getCheckDate() == null ? "" : info.getCheckDate().toString());
-        params.put("${jcr}", info.getCheckUser());
-        params.put("${sbzt}", StringUtils.YES_VALUE.equals(info.getSbzt()) ? "合格" : "不合格");
-        params.put("${qrr}", info.getConfirmUser() == null ? "" : info.getConfirmUser());
-        params.put("${czwt}", info.getCzwt() == null ? "" : info.getCzwt());
-
-        //生成word文件的文件名
-        String fileName = "地面磁感应手册.docx";
-        String template = "word/template/地面磁感应手册.docx";
-        String localFilePath = wordUtil.getWord(params, template, fileName);
-        return sysFileService.uploadFile(localFilePath);
-    }
-
-    @ApiOperation(value = "导出excel")
-    @GetMapping(value = "exportExcel")
-    public AjaxResult exportExcel(JcebQueryVo query) {
-        String localFilePath = busJcbDmcgyqService.exportExcel(query);
-        return sysFileService.uploadFile(localFilePath);
-    }
-
-    @ApiOperation(value = "检测表list")
-    @GetMapping(value = "jcebList")
-    public TableDataInfo jcebList(JcebQueryVo query) {
-        startPage();
-        return getDataTable(busJcbDmcgyqService.getJcebList(query));
-    }
-
-    @ApiOperation(value = "检测表单个详情")
-    @GetMapping(value = "/jcebInfo")
-    public AjaxResult getJcebInfo(BusJcbDmcgyq busJcbDmcgyq) {
-        BusJcbDmcgyq info = busJcbDmcgyqService.getJcebInfo(busJcbDmcgyq);
-        AjaxResult ajax = AjaxResult.success();
-        ajax.put("info",info);
-        return ajax;
-    }
+  private final IBusJcbDmcgyqService busJcbDmcgyqService;
+  private final ISysFileService sysFileService;
+
+  public BusJcbDmcgyqController(IBusJcbDmcgyqService busJcbDmcgyqService,
+      ISysFileService sysFileService) {
+    this.busJcbDmcgyqService = busJcbDmcgyqService;
+    this.sysFileService = sysFileService;
+  }
+
+  @ApiOperation(value = "新增")
+  @PostMapping("/add")
+  public AjaxResult add(@Validated @RequestBody BusJcbDmcgyq busJcbDmcgyq) {
+    return toAjax(busJcbDmcgyqService.create(busJcbDmcgyq));
+  }
+
+  @ApiOperation(value = "删除")
+  @DeleteMapping("/{ids}")
+  public AjaxResult delete(@PathVariable(value = "ids") String[] ids) {
+    return toAjax(busJcbDmcgyqService.delete(ids));
+  }
+
+  @ApiOperation(value = "更新")
+  @PutMapping("/update")
+  public AjaxResult update(@RequestBody @Valid BusJcbDmcgyq busJcbDmcgyq) {
+    return toAjax(busJcbDmcgyqService.update(busJcbDmcgyq));
+  }
+
+  @ApiOperation(value = "单个")
+  @GetMapping(value = "/info")
+  public AjaxResult getInfo(BusJcbDmcgyq busJcbDmcgyq) {
+    BusJcbDmcgyq info = busJcbDmcgyqService.getInfo(busJcbDmcgyq);
+    AjaxResult ajax = AjaxResult.success();
+    ajax.put("info", info);
+    return ajax;
+  }
+
+  @ApiOperation(value = "列表")
+  @GetMapping(value = "/list")
+  public TableDataInfo getList(BusJcbDmcgyq busJcbDmcgyq) {
+    startPage();
+    List<BusJcbDmcgyq> list = busJcbDmcgyqService.getList(busJcbDmcgyq);
+    return getDataTable(list);
+  }
+
+  @ApiOperation(value = "获取上次检测值")
+  @GetMapping(value = "/getLastOne")
+  public AjaxResult getLastOne() {
+    BusJcbDmcgyq info = busJcbDmcgyqService.getLastRecord();
+    AjaxResult ajax = AjaxResult.success();
+    ajax.put("info", info);
+    return ajax;
+  }
+
+  @ApiOperation(value = "提交")
+  @PutMapping("/submit")
+  public AjaxResult submit(@RequestBody BusJcbDmcgyq busJcbDmcgyq) {
+    return toAjax(busJcbDmcgyqService.submit(busJcbDmcgyq));
+  }
+
+  @ApiOperation(value = "退回")
+  @PutMapping("/reject")
+  public AjaxResult reject(@RequestBody BusJcbDmcgyq busJcbDmcgyq) {
+    return toAjax(busJcbDmcgyqService.reject(busJcbDmcgyq));
+  }
+
+  @ApiOperation(value = "确认")
+  @PutMapping("/confirm")
+  public AjaxResult confirm(@RequestBody BusJcbDmcgyq busJcbDmcgyq) {
+    return toAjax(busJcbDmcgyqService.confirm(busJcbDmcgyq));
+  }
+
+  @ApiOperation(value = "导出")
+  @GetMapping("/export/{id}")
+  public AjaxResult export(@PathVariable(value = "id") String id) {
+    BusJcbDmcgyq info = new BusJcbDmcgyq();
+    info.setId(Long.parseLong(id));
+    info = busJcbDmcgyqService.getInfo(info);
+    WordUtils wordUtil = new WordUtils();
+    //填充变量
+    Map<String, Object> params = new HashMap<>();
+    params.put("${fenxiang}", info.getFenxiang() == null ? "" : info.getFenxiang());
+    params.put("${tianqi}", info.getTianqi() == null ? "" : info.getTianqi());
+    params.put("${wendu}", info.getTemperature() == null ? "" : info.getTemperature());
+    params.put("${zzhfw}", info.getPillarArea() == null ? "" : info.getPillarArea());
+    params.put("${xingbie}", info.getXingbieText());
+    params.put("${dgqwgAzlg}", StringUtils.yesOrNo(info.getDgqwgAzlg()));
+    params.put("${dgqwgWzws}", StringUtils.yesOrNo(info.getDgqwgWzws()));
+    params.put("${dgqwgBmqj}", StringUtils.yesOrNo(info.getDgqwgBmqj()));
+    params.put("${bspwgBsqx}", StringUtils.yesOrNo(info.getBspwgBsqx()));
+    params.put("${bspwgAzlg}", StringUtils.yesOrNo(info.getBspwgAzlg()));
+    params.put("${dgqclG1}", info.getDgqclG1() == null ? "" : info.getDgqclG1());
+    params.put("${dgqclG2}", info.getDgqclG2() == null ? "" : info.getDgqclG2());
+    params.put("${dgqclG3}", info.getDgqclG3() == null ? "" : info.getDgqclG3());
+    params.put("${dgqclG4}", info.getDgqclG4() == null ? "" : info.getDgqclG4());
+    params.put("${jianchariqi}", info.getCheckDate() == null ? "" : info.getCheckDate().toString());
+    params.put("${jcr}", info.getCheckUser());
+    params.put("${sbzt}", StringUtils.YES_VALUE.equals(info.getSbzt()) ? "合格" : "不合格");
+    params.put("${qrr}", info.getConfirmUser() == null ? "" : info.getConfirmUser());
+    params.put("${czwt}", info.getCzwt() == null ? "" : info.getCzwt());
+
+    //生成word文件的文件名
+    String fileName = "地面磁感应手册.docx";
+    String template = "word/template/地面磁感应手册.docx";
+    String localFilePath = wordUtil.getWord(params, template, fileName);
+    return sysFileService.uploadFile(localFilePath);
+  }
+
+  @ApiOperation(value = "导出excel")
+  @GetMapping(value = "exportExcel")
+  public AjaxResult exportExcel(JcebQueryVo query) {
+    String localFilePath = busJcbDmcgyqService.exportExcel(query);
+    return sysFileService.uploadFile(localFilePath);
+  }
+
+  @ApiOperation(value = "检测表list")
+  @GetMapping(value = "jcebList")
+  public TableDataInfo jcebList(JcebQueryVo query) {
+    startPage();
+    return getDataTable(busJcbDmcgyqService.getJcebList(query));
+  }
+
+  @ApiOperation(value = "检测表单个详情")
+  @GetMapping(value = "/jcebInfo")
+  public AjaxResult getJcebInfo(BusJcbDmcgyq busJcbDmcgyq) {
+    BusJcbDmcgyq info = busJcbDmcgyqService.getJcebInfo(busJcbDmcgyq);
+    AjaxResult ajax = AjaxResult.success();
+    ajax.put("info", info);
+    return ajax;
+  }
 
 }