| | |
| | | import com.vci.ubcs.code.service.MdmIOService; |
| | | import com.vci.ubcs.code.vo.pagemodel.*; |
| | | import com.vci.ubcs.starter.annotation.VciBusinessLog; |
| | | import com.vci.ubcs.starter.revision.model.BaseModel; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.starter.util.LocalFileUtil; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.pagemodel.*; |
| | | import com.vci.ubcs.starter.web.util.ControllerUtil; |
| | | import com.vci.ubcs.starter.web.util.LangBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.AllArgsConstructor; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | //@AllArgsConstructor |
| | |
| | | @GetMapping("/downloadImportExcel") |
| | | @VciBusinessLog(operateName = "下载批量申请编码的导入模板") |
| | | public void downloadImportExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{ |
| | | // String excelName = mdmIOService.createImportExcel(codeClassifyOid,false); |
| | | // try { |
| | | // ControllerUtil.writeFileToResponse(response,excelName); |
| | | // } catch (Throwable e) { |
| | | // //如果出错,把错误信息写到text |
| | | // String msg = LangBaseUtil.getErrorMsg(e); |
| | | // if(StringUtils.isBlank(msg)){ |
| | | // msg = "未知错误"; |
| | | // } |
| | | // ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | // } |
| | | String excelName = mdmIOService.createImportExcel(codeClassifyOid,false); |
| | | try { |
| | | ControllerUtil.writeFileToResponse(response,excelName); |
| | | } catch (Throwable e) { |
| | | //如果出错,把错误信息写到text |
| | | String msg = LangBaseUtil.getErrorMsg(e); |
| | | if(StringUtils.isBlank(msg)){ |
| | | msg = "未知错误"; |
| | | } |
| | | ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); |
| | | File file1 = new File(excelFileName); |
| | | try { |
| | | // file.transferTo(new File(excelFileName)); |
| | | // CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1); |
| | | // if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){ |
| | | // //放到map里 |
| | | // R result = R.fail("导入失败"); |
| | | // if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) { |
| | | // String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath()); |
| | | // codeImProtRusultVO.setFileOid(filedUUid); |
| | | // } |
| | | // result.setData(codeImProtRusultVO); |
| | | // return result; |
| | | // }else { |
| | | // return R.success("操作成功!"); |
| | | // } |
| | | file.transferTo(new File(excelFileName)); |
| | | CodeImProtRusultVO codeImProtRusultVO = mdmIOService.batchImportCode(orderDTO,file1); |
| | | if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){ |
| | | //放到map里 |
| | | R result = R.fail("导入失败"); |
| | | if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) { |
| | | String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath()); |
| | | codeImProtRusultVO.setFileOid(filedUUid); |
| | | } |
| | | result.setData(codeImProtRusultVO); |
| | | return result; |
| | | }else { |
| | | return R.success("操作成功!"); |
| | | } |
| | | }catch (Throwable e) { |
| | | logger.error("导入错误",e); |
| | | String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "错误.txt"; |
| | |
| | | }finally { |
| | | file1.delete(); |
| | | } |
| | | return null; |
| | | // return null; |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @PostMapping("/addSaveCode") |
| | | @VciBusinessLog(operateName = "申请单个编码") |
| | | public R addSaveCode(@RequestBody CodeOrderDTO orderDTO){ |
| | | public R addSaveCode(@RequestBody CodeOrderDTO orderDTO) throws Exception { |
| | | return R.success(engineService.addSaveCode(orderDTO)); |
| | | } |
| | | |
| | |
| | | public MdmUIInfoVO getUIInfoByClassifyOid(String codeClassifyOid,String functionId){ |
| | | return engineService.getUIInfoByClassifyOid(codeClassifyOid,functionId); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/thisistest") |
| | | @ResponseBody |
| | | public Integer thisistest(String codeClassifyOid, String functionId) throws Exception { |
| | | // return engineService.selectByTypeAndOid("wupin", "b1511bb3-a773-43e2-ac85-a7fde7314a0f,3e08970024835e69f6c2b2ecd90c48c3,582ff205-0dfb-43e0-8223-e772ff1851ab,db0400fe-cc90-4d9d-8da7-1edf06b1481b"); |
| | | |
| | | List<BaseModel> models = new ArrayList<>(); |
| | | BaseModel baseModel = new BaseModel(); |
| | | Map<String,String > map = new HashMap<>(); |
| | | map.put("JZL","6789"); |
| | | map.put("JZRXX","67891"); |
| | | map.put("JZXZB","67892"); |
| | | map.put("JSZGL","67893"); |
| | | map.put("JSSXT","67894"); |
| | | baseModel.setBtmname("djii"); |
| | | baseModel.setCreator("fjivis"); |
| | | baseModel.setId("vcia"); |
| | | baseModel.setOid("0d86b1ba-9e9e-4d3d-9ae4-f862c3684e74"); |
| | | baseModel.setCreateTime(new Date()); |
| | | baseModel.setTs(new Date()); |
| | | baseModel.setData(map); |
| | | models.add(baseModel); |
| | | |
| | | BaseModel baseModel1 = new BaseModel(); |
| | | Map<String,String > map1 = new HashMap<>(); |
| | | map1.put("JZL","6789z"); |
| | | map1.put("JZRXX","67891z"); |
| | | map1.put("JZXZB","67892z"); |
| | | map1.put("JSZGL","67893z"); |
| | | map1.put("JSSXT","67894z"); |
| | | baseModel1.setBtmname("djiiz"); |
| | | baseModel1.setCreator("fjivisz"); |
| | | baseModel1.setId("vciaz"); |
| | | baseModel1.setTs(new Date()); |
| | | baseModel1.setOid("4a00be07-f5a8-4a9b-88fb-d52a0d9cf546"); |
| | | baseModel1.setCreateTime(new Date()); |
| | | baseModel1.setData(map1); |
| | | models.add(baseModel1); |
| | | |
| | | BaseModel baseModel2 = new BaseModel(); |
| | | Map<String,String > map2 = new HashMap<>(); |
| | | map2.put("JZL","67892"); |
| | | map2.put("JZRXX","678912"); |
| | | map2.put("JZXZB","678922"); |
| | | map2.put("JSZGL","678932"); |
| | | map2.put("JSSXT","678942"); |
| | | baseModel2.setBtmname("djii2"); |
| | | baseModel2.setCreator("fjivis2"); |
| | | baseModel2.setTs(new Date()); |
| | | baseModel2.setId("vcia2"); |
| | | baseModel2.setOid("fa430ff9-f141-4dcf-8809-6f87905c1dea"); |
| | | baseModel2.setCreateTime(new Date()); |
| | | baseModel2.setData(map2); |
| | | models.add(baseModel2); |
| | | |
| | | return 0; |
| | | |
| | | |
| | | |
| | | // return engineService.updateBatchByBaseModel("wupin", models); |
| | | // return engineService.getUIInfoByClassifyOid(codeClassifyOid,functionId); |
| | | } |
| | | |
| | | /** |
| | | * 默认的参照列表 |
| | | * @param referConfigVO 参照的配置信息 |
| | | * @return 执行的结果 |
| | | */ |
| | | @GetMapping("/defaultReferDataGrid") |
| | | public DataGrid defaultReferDataGrid(UIFormReferVO referConfigVO, PageHelper pageHelper){ |
| | | return engineService.referDataGrid(referConfigVO,pageHelper); |
| | | } |
| | | |
| | | /** |
| | | * 默认的树形参照列表 |
| | | * @param referConfigVO 参照的配置信息 |
| | | * @return 执行的结果 |
| | | */ |
| | | @GetMapping("/defaultReferTree") |
| | | public List<Tree> defaultReferTree(UIFormReferVO referConfigVO, TreeQueryObject queryObject){ |
| | | return engineService.referTree(referConfigVO,queryObject); |
| | | } |
| | | |
| | | } |