|
|
@@ -6,28 +6,34 @@ import com.railway.common.core.controller.BaseController;
|
|
|
import com.railway.common.core.domain.AjaxResult;
|
|
|
import com.railway.common.core.page.TableDataInfo;
|
|
|
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.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-import javax.validation.Valid;
|
|
|
-import java.io.InputStream;
|
|
|
-import java.net.URLEncoder;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import javax.validation.Valid;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+/**
|
|
|
+ * @author fenghao
|
|
|
+ */
|
|
|
@Api(value = "rest/catenary/bus/jcb/glkg", tags = "检查表 - 隔离开关检查表")
|
|
|
@RestController
|
|
|
@Validated
|
|
|
@RequestMapping(value = "business/catenary/bus/jcb/glkg")
|
|
|
public class BusJcbGlkgController extends BaseController {
|
|
|
- @Autowired
|
|
|
- private IBusJcbGlkgService busJcbGlkgService;
|
|
|
+
|
|
|
+ private final IBusJcbGlkgService busJcbGlkgService;
|
|
|
+ private final ISysFileService sysFileService;
|
|
|
+
|
|
|
+ public BusJcbGlkgController(IBusJcbGlkgService busJcbGlkgService,
|
|
|
+ ISysFileService sysFileService) {
|
|
|
+ this.busJcbGlkgService = busJcbGlkgService;
|
|
|
+ this.sysFileService = sysFileService;
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "新增")
|
|
|
@PostMapping("/add")
|
|
|
@@ -97,62 +103,58 @@ public class BusJcbGlkgController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "导出")
|
|
|
- @GetMapping("/export/{id}")
|
|
|
- public void export(@PathVariable(value = "id") String id, HttpServletResponse response) {
|
|
|
-
|
|
|
- try {
|
|
|
- BusJcbGlkg info = busJcbGlkgService.getInfo(id);
|
|
|
- WordUtils wordUtil = new WordUtils();
|
|
|
- //填充变量
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("${kgh}", info.getKgh());
|
|
|
- params.put("${qj}", info.getStationName());
|
|
|
- params.put("${wd}", info.getWd());
|
|
|
- String[] jcrqArr = info.getJcrq().split("-");
|
|
|
- String jcrq = jcrqArr[0] + "年" + jcrqArr[1] + "月" +jcrqArr[2] + "日";
|
|
|
- params.put("${jcrq}", jcrq);
|
|
|
- params.put("${jgxA}", info.getJgxA().equals("0") ? "√" : "×");
|
|
|
- params.put("${jgxB}", info.getJgxB().equals("0") ? "√" : "×");
|
|
|
- params.put("${jgxC}", info.getJgxC().equals("0") ? "√" : "×");
|
|
|
- params.put("${qdzzA}", info.getQdzzA().equals("0") ? "√" : "×");
|
|
|
- params.put("${cdgA}", info.getCdgA().equals("0") ? "√" : "×");
|
|
|
- params.put("${cdgB}", info.getCdgB().equals("0") ? "√" : "×");
|
|
|
- params.put("${cdgC}", info.getCdgC().equals("0") ? "√" : "×");
|
|
|
- params.put("${gbA}", info.getGbA().equals("0") ? "√" : "×");
|
|
|
- params.put("${ctztA}", info.getCtztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${ctmtztA}", info.getCtmtztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${hjkztA}", info.getHjkztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${zcjyzztA}", info.getZcjyzztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${yxztA}", info.getYxztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${yxztB}", info.getYxztB().equals("0") ? "√" : "×");
|
|
|
- params.put("${yxztC}", info.getYxztC().equals("0") ? "√" : "×");
|
|
|
- params.put("${swyx1Lcz}", StringUtils.isNoneBlank(info.getSwyx1Lcz()) ? info.getSwyx1Lcz() : "/");
|
|
|
- params.put("${swyx1Dg}", StringUtils.isNoneBlank(info.getSwyx1Dg()) ? info.getSwyx1Dg() : "/");
|
|
|
- params.put("${swyx2Lcz}", StringUtils.isNoneBlank(info.getSwyx2Lcz()) ? info.getSwyx2Lcz() : "/");
|
|
|
- params.put("${swyx2Dg}", StringUtils.isNoneBlank(info.getSwyx2Dg()) ? info.getSwyx2Dg() : "/");
|
|
|
- params.put("${zxjl}", StringUtils.isNoneBlank(info.getZxjl()) ? info.getZxjl() : "/");
|
|
|
- params.put("${xjztA}", info.getXjztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${xjztB}", info.getXjztB().equals("0") ? "√" : "×");
|
|
|
- params.put("${sdfhsyA}", info.getSdfhsyA().equals("0") ? "√" : "×");
|
|
|
- params.put("${ddfhsyA}", info.getDdfhsyA().equals("0") ? "√" : "×");
|
|
|
- params.put("${ydfhsyA}", info.getYdfhsyA().equals("0") ? "√" : "×");
|
|
|
- params.put("${kgztjdztA}", info.getKgztjdztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${kgztjdztDzz}", StringUtils.isNoneBlank(info.getKgztjdztDzz()) ? info.getKgztjdztDzz() : "/");
|
|
|
- params.put("${kgjgxjdztA}", info.getKgjgxjdztA().equals("0") ? "√" : "×");
|
|
|
- params.put("${kgjgxjdztDzz}", StringUtils.isNoneBlank(info.getKgjgxjdztDzz()) ? info.getKgjgxjdztDzz() : "/");
|
|
|
- params.put("${sbzt}", info.getSbzt().equals("0") ? "合格" : "不合格");
|
|
|
- params.put("${jcr}", info.getJcr());
|
|
|
- params.put("${qrr}", info.getQrr());
|
|
|
- params.put("${czwt}", info.getCzwt());
|
|
|
-
|
|
|
- InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("word/template/隔离开关手册.docx");
|
|
|
- //生成word文件的文件名
|
|
|
- String fileName= URLEncoder.encode("隔离开关手册.docx", "UTF-8");
|
|
|
- //调用生成导出方法
|
|
|
- wordUtil.getWord(inputStream,params,null,fileName,response);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult export(@RequestParam String id) {
|
|
|
+
|
|
|
+ BusJcbGlkg info = busJcbGlkgService.getInfo(id);
|
|
|
+ WordUtils wordUtil = new WordUtils();
|
|
|
+ //填充变量
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("${kgh}", info.getKgh());
|
|
|
+ params.put("${qj}", info.getStationName());
|
|
|
+ params.put("${wd}", info.getWd());
|
|
|
+ String[] jcrqArr = info.getJcrq().split("-");
|
|
|
+ String jcrq = jcrqArr[0] + "年" + jcrqArr[1] + "月" +jcrqArr[2] + "日";
|
|
|
+ params.put("${jcrq}", jcrq);
|
|
|
+ params.put("${jgxA}", info.getJgxA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${jgxB}", info.getJgxB().equals("1") ? "√" : "×");
|
|
|
+ params.put("${jgxC}", info.getJgxC().equals("1") ? "√" : "×");
|
|
|
+ params.put("${qdzzA}", info.getQdzzA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${cdgA}", info.getCdgA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${cdgB}", info.getCdgB().equals("1") ? "√" : "×");
|
|
|
+ params.put("${cdgC}", info.getCdgC().equals("1") ? "√" : "×");
|
|
|
+ params.put("${gbA}", info.getGbA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${ctztA}", info.getCtztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${ctmtztA}", info.getCtmtztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${hjkztA}", info.getHjkztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${zcjyzztA}", info.getZcjyzztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${yxztA}", info.getYxztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${yxztB}", info.getYxztB().equals("1") ? "√" : "×");
|
|
|
+ params.put("${yxztC}", info.getYxztC().equals("1") ? "√" : "×");
|
|
|
+ params.put("${swyx1Lcz}", StringUtils.isNoneBlank(info.getSwyx1Lcz()) ? info.getSwyx1Lcz() : "/");
|
|
|
+ params.put("${swyx1Dg}", StringUtils.isNoneBlank(info.getSwyx1Dg()) ? info.getSwyx1Dg() : "/");
|
|
|
+ params.put("${swyx2Lcz}", StringUtils.isNoneBlank(info.getSwyx2Lcz()) ? info.getSwyx2Lcz() : "/");
|
|
|
+ params.put("${swyx2Dg}", StringUtils.isNoneBlank(info.getSwyx2Dg()) ? info.getSwyx2Dg() : "/");
|
|
|
+ params.put("${zxjl}", StringUtils.isNoneBlank(info.getZxjl()) ? info.getZxjl() : "/");
|
|
|
+ params.put("${xjztA}", info.getXjztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${xjztB}", info.getXjztB().equals("1") ? "√" : "×");
|
|
|
+ params.put("${sdfhsyA}", info.getSdfhsyA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${ddfhsyA}", info.getDdfhsyA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${ydfhsyA}", info.getYdfhsyA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${kgztjdztA}", info.getKgztjdztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${kgztjdztDzz}", StringUtils.isNoneBlank(info.getKgztjdztDzz()) ? info.getKgztjdztDzz() : "/");
|
|
|
+ params.put("${kgjgxjdztA}", info.getKgjgxjdztA().equals("1") ? "√" : "×");
|
|
|
+ params.put("${kgjgxjdztDzz}", StringUtils.isNoneBlank(info.getKgjgxjdztDzz()) ? info.getKgjgxjdztDzz() : "/");
|
|
|
+ params.put("${sbzt}", info.getSbzt().equals("1") ? "合格" : "不合格");
|
|
|
+ params.put("${jcr}", info.getJcr());
|
|
|
+ params.put("${qrr}", info.getQrr());
|
|
|
+ params.put("${czwt}", info.getCzwt());
|
|
|
+
|
|
|
+ //生成word文件的文件名
|
|
|
+ String fileName = "隔离开关手册.docx";
|
|
|
+ String template = "word/template/隔离开关手册.docx";
|
|
|
+ String localFilePath = wordUtil.getWord(params, template, fileName);
|
|
|
+ return sysFileService.uploadFile(localFilePath);
|
|
|
}
|
|
|
|
|
|
}
|