修改基础数据往来单位导入导出格式

master
郑明梁 2 years ago
parent 8a4c97aa56
commit 597794c096

@ -110,12 +110,14 @@ public class BasicCorpExportLogController {
public BaseResponse excelDownload(@RequestBody BasicCorpsExportRequest basicCorpsExportRequest) {
String fileName = "D:\\udiwms\\exportFile\\" + "往来单位信息导出" + System.currentTimeMillis() + ".UpperIn";
BasicCorpsExportLogEntity corpExportLogEntity = new BasicCorpsExportLogEntity();
List<Integer> ids=basicCorpsExportRequest.getIds();
corpExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
String genKey = CustomUtil.getId();
corpExportLogEntity.setGenKey(genKey);
corpExportLogEntity.setFilePath(fileName);
corpExportLogEntity.setUpdateTime(new Date());
corpExportLogEntity.setDlCount(0);
corpExportLogEntity.setRemark("本次导出数据"+ids.size()+"条");
corpExportLogEntity.setType(BasicProcessStatus.EXPORT_JSON);
basicCorpExportLogService.insertCorpExportLog(corpExportLogEntity);
//basicGenExcelService.exportCorp(genKey, corpsExportRequest);

@ -10,12 +10,10 @@ import com.glxp.api.constant.BasicProcessStatus;
import com.glxp.api.entity.basic.BasicCorpsImportDetailEntity;
import com.glxp.api.entity.basic.BasicCorpsImportLogEntity;
import com.glxp.api.req.basic.FilterCorpImportLogRequest;
import com.glxp.api.req.basic.PostBasicCorpRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.basic.BasicCorpExportLogResponse;
import com.glxp.api.service.auth.CustomerService;
import com.glxp.api.service.basic.BasicCorpImportDetailService;
import com.glxp.api.service.basic.BasicCorpImportLogService;
import com.glxp.api.service.thrsys.ThrSystemService;
import com.glxp.api.util.CustomUtil;
@ -35,8 +33,6 @@ public class BasicCorpImportLogController {
@Resource
BasicCorpImportLogService basicCorpImportLogService;
@Resource
BasicCorpImportDetailService basicCorpImportDetailService;
@Resource
ThrSystemService thrSystemService;
@Resource
CustomerService customerService;
@ -59,23 +55,6 @@ public class BasicCorpImportLogController {
return ResultVOUtils.success(pageSimpleResponse);
}
@GetMapping("/udiwms/corps/importLog/filterDetail")
public BaseResponse filterDetail(FilterCorpImportLogRequest filterCorpImportLogRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<BasicCorpsImportDetailEntity> corpImportDetailEntities = basicCorpImportDetailService.filterCorpImport(filterCorpImportLogRequest);
PageInfo<BasicCorpsImportDetailEntity> pageInfo;
pageInfo = new PageInfo<>(corpImportDetailEntities);
PageSimpleResponse<BasicCorpsImportDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(corpImportDetailEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("/udiwms/corps/importLog/deleteLog")
public BaseResponse deleteLog(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
@ -89,25 +68,11 @@ public class BasicCorpImportLogController {
if (corpImportLogEntities != null && corpImportLogEntities.size() > 0) {
BasicCorpsImportLogEntity corpImportLogEntity = corpImportLogEntities.get(0);
basicCorpImportLogService.deleteById(corpImportLogEntity.getId() + "");
basicCorpImportDetailService.deleteByGenkey(corpImportLogEntity.getGenKey());
}
return ResultVOUtils.success("删除成功");
}
@PostMapping("/udiwms/corps/importLog/delete")
public BaseResponse delete(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
if (basicCorpImportDetailService.deleteById(deleteRequest.getId()))
return ResultVOUtils.success("删除成功");
else
return ResultVOUtils.error(500, "删除成功");
}
//往来单位信息文件导入
@PostMapping("/udiwms/corps/importLog/upload")
public BaseResponse uploadCorp(@RequestParam("file") List<MultipartFile> files, @RequestParam("thirdSys") String thirdSys) {
@ -136,12 +101,12 @@ public class BasicCorpImportLogController {
corpImportLogEntity.setFromType("文件导入");
corpImportLogEntity.setUpdateTime(new Date());
corpImportLogEntity.setCreateTime(new Date());
corpImportLogEntity.setCreateUser(String.valueOf(customerService.getUserId()));
corpImportLogEntity.setUpdateUser(String.valueOf(customerService.getUserId()));
// corpImportLogEntity.setCreateUser(String.valueOf(customerService.getUserId()));
// corpImportLogEntity.setUpdateUser(String.valueOf(customerService.getUserId()));
corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS);
corpImportLogEntity.setUpdateTime(new Date(System.currentTimeMillis()));
basicCorpImportLogService.insertImportLog(corpImportLogEntity);
basicCorpImportLogService.importJsonData(data);
basicCorpImportLogService.importJsonData(data,corpImportLogEntity.getGenKey());
corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
basicCorpImportLogService.updateImportLog(corpImportLogEntity);
} else {

@ -20,10 +20,9 @@ public interface BasicCorpImportLogService {
boolean deleteById(@Param("id") String id);
void importCorps(String genKey);
void importJsonData(BasicCorpExportLogResponse importData);
void importJsonData(BasicCorpExportLogResponse importData,String genKey);

@ -14,9 +14,9 @@ import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
import com.glxp.api.req.basic.FilterCorpImportLogRequest;
import com.glxp.api.res.basic.BasicCorpExportLogResponse;
import com.glxp.api.res.thrsys.ThrCorpsResponse;
import com.glxp.api.service.basic.BasicCorpImportDetailService;
import com.glxp.api.service.basic.BasicCorpImportLogService;
import com.glxp.api.service.basic.BasicUnitMaintainService;
import com.glxp.api.util.IpUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@ -36,12 +36,8 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
@Resource
BasicCorpImportLogDao basicCorpImportLogDao;
@Resource
BasicCorpImportDetailService basicCorpImportDetailService;
@Resource
BasicUnitMaintainService basicUnitMaintainService;
BasicCorpImportLogService basicCorpImportLogService;
@Resource
SqlSessionFactory sqlSessionFactory;
@ -85,40 +81,6 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
return basicCorpImportLogDao.deleteById(id);
}
@Async
@Override
public void importCorps(String genKey) {
BasicCorpsImportLogEntity corpImportLogEntity =selectByGenKey(genKey);
if (corpImportLogEntity != null && corpImportLogEntity.getStatus() == BasicProcessStatus.UDIINFO_IMPORT_UNPROCESS) {
FilterCorpImportLogRequest filterUdiIpLogRequest = new FilterCorpImportLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<BasicCorpsImportDetailEntity> corpImportDetailEntities
= basicCorpImportDetailService.filterCorpImport(filterUdiIpLogRequest);
if (corpImportDetailEntities != null) {
for (BasicCorpsImportDetailEntity corpImportDetailEntity : corpImportDetailEntities) {
BasicCorpEntity basicCorpEntity = new BasicCorpEntity();
BeanUtils.copyProperties(corpImportDetailEntity, basicCorpEntity);
BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest = new BasicUnitMaintainFilterRequest();
BeanUtils.copyProperties(corpImportDetailEntity, basicUnitMaintainFilterRequest);
List<BasicCorpEntity> basicUnitMaintainEntities = basicUnitMaintainService.filterList(basicUnitMaintainFilterRequest);
if (basicUnitMaintainEntities != null && basicUnitMaintainEntities.size() > 0) {
basicUnitMaintainService.insertBasicUnitMaintain(basicCorpEntity);
corpImportDetailEntity.setImportStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_SUCESS);
} else {
corpImportDetailEntity.setImportStatus(BasicProcessStatus.UDIINFO_IMPORT_CODE_FAIL);
corpImportDetailEntity.setRemark("重复导入!");
}
basicCorpImportDetailService.updateCorpImport(corpImportDetailEntity);
}
}
corpImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
updateImportLog(corpImportLogEntity);
}
}
/**
*
@ -126,10 +88,7 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
* @param
*/
@Async
public void importJsonData(BasicCorpExportLogResponse importData) {
public void importJsonData(BasicCorpExportLogResponse importData,String genKey) {
if (null != importData) {
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
@ -142,8 +101,16 @@ public class BasicCorpImportLogServiceImpl implements BasicCorpImportLogService
}
batchSession.commit();
log.info("导入往来单位数据成功,导入数量为:{} 条", corpList.size());
BasicCorpsImportLogEntity basicCorpsImportLogEntity=new BasicCorpsImportLogEntity();
basicCorpsImportLogEntity.setGenKey(genKey);
basicCorpsImportLogEntity.setRemark("导入数据成功,导入数量为:"+ corpList.size()+"条");
basicCorpImportLogService.updateImportLog(basicCorpsImportLogEntity);
} catch (Exception e) {
log.error("导入往来单位信息异常", e);
BasicCorpsImportLogEntity basicCorpsImportLogEntity=new BasicCorpsImportLogEntity();
basicCorpsImportLogEntity.setGenKey(genKey);
basicCorpsImportLogEntity.setRemark("导入数据失败");
basicCorpImportLogService.updateImportLog(basicCorpsImportLogEntity);
}
}

Loading…
Cancel
Save