|
|
@ -256,33 +256,14 @@ public class BsSgcjsjdBuiProInfoController extends BaseController |
|
|
|
|
|
|
|
@PostMapping("/importData") |
|
|
|
@Transactional |
|
|
|
public AjaxResult importData(@RequestParam(value = "file") MultipartFile file) { |
|
|
|
ExcelUtil<BsSgcjsjdBuiProInfo> util = new ExcelUtil<>(BsSgcjsjdBuiProInfo.class); |
|
|
|
try { |
|
|
|
List<BsSgcjsjdBuiProInfo> list = util.importExcel(file.getInputStream()); |
|
|
|
list.remove(0); |
|
|
|
for (BsSgcjsjdBuiProInfo bsSgcjsjdBuiProInfo:list){ |
|
|
|
if (bsSgcjsjdBuiProInfo.getProjectUnitLegal().contains("1")) { |
|
|
|
String[] split = bsSgcjsjdBuiProInfo.getProjectUnitLegal().split( |
|
|
|
bsSgcjsjdBuiProInfo.getProjectUnitLegal().substring(bsSgcjsjdBuiProInfo.getProjectUnitLegal().indexOf("1") - 1, bsSgcjsjdBuiProInfo.getProjectUnitLegal().indexOf("1"))); |
|
|
|
|
|
|
|
if (split.length>=2){ |
|
|
|
bsSgcjsjdBuiProInfo.setProjectUnitLegal(split[0]); |
|
|
|
bsSgcjsjdBuiProInfo.setProjectUnitLegalPhone(split[1]); |
|
|
|
} |
|
|
|
SysXzqh one = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().eq("NAME",bsSgcjsjdBuiProInfo.getParentAcad())); |
|
|
|
if (ObjectUtil.isNotEmpty(one)){ |
|
|
|
SysXzqh adcd = sysXzqhService.getOne(new QueryWrapper<SysXzqh>().eq("NAME",bsSgcjsjdBuiProInfo.getAdcd()).eq("PARENTID",one.getXzqhdm())); |
|
|
|
if (ObjectUtil.isNotEmpty(adcd)){ |
|
|
|
bsSgcjsjdBuiProInfo.setAdcd(adcd.getXzqhdm()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
bsSgcjsjdBuiProInfoService.saveOrUpdate(bsSgcjsjdBuiProInfo); |
|
|
|
} |
|
|
|
return AjaxResult.success(list); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
public AjaxResult importData() { |
|
|
|
List<BsSgcjsjdBuiProInfo> list = bsSgcjsjdBuiProInfoService.list(null); |
|
|
|
for (BsSgcjsjdBuiProInfo bsSgcjsjdBuiProInfo:list){ |
|
|
|
bsSgcjsjdBuiProInfo.setProNo(bsSgcjsjdBuiProInfo.getId()); |
|
|
|
bsSgcjsjdBuiProInfo.setProCode(bsSgcjsjdBuiProInfo.getId()); |
|
|
|
bsSgcjsjdBuiProInfo.setIsApproval("0"); |
|
|
|
bsSgcjsjdBuiProInfoService.saveOrUpdate(bsSgcjsjdBuiProInfo); |
|
|
|
} |
|
|
|
return AjaxResult.success(); |
|
|
|
} |
|
|
|
} |
|
|
|