|
|
@ -187,14 +187,6 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
|
|
|
|
public ResultBean saveOrUpdateDto(BaseOutsourcingApplicationDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String orgPath = ""; |
|
|
|
if (StringUtils.isNotBlank(dto.getOrgPath())) { |
|
|
|
orgPath = dto.getOrgPath(); |
|
|
|
} else { |
|
|
|
//取组织架构的全路径sid
|
|
|
|
SysStaffOrg sysStaffOrg = sysStaffOrgFeign.getOrgByStaffSid(dto.getStaffSid()).getData(); |
|
|
|
orgPath = sysStaffOrg.getOrgSidPath(); |
|
|
|
} |
|
|
|
List<BaseOutsourcingApplicationVehicleDto> baseOutsourcingApplicationVehicleDtos = dto.getBaseOutsourcingApplicationVehicleDtos(); |
|
|
|
CommonAppendix contract = dto.getContract(); |
|
|
|
String sid = dto.getSid(); |
|
|
@ -208,32 +200,13 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(sid)) {//新增
|
|
|
|
BaseOutsourcingApplication entity = new BaseOutsourcingApplication(); |
|
|
|
String billNo = getApplyCode(orgPath); |
|
|
|
String billNo = getApplyCode(dto.getOrgPath()); |
|
|
|
dto.setApplicationCode(billNo); |
|
|
|
BeanUtil.copyProperties(dto, entity, "sid"); |
|
|
|
entity.setApplicationCode(billNo); |
|
|
|
entity.setApplicationDate(DateUtil.formatDate(new Date())); |
|
|
|
String staffSid = dto.getStaffSid(); |
|
|
|
ResultBean<List<SysStaffOrgVo>> sysStaffOrgListByStaffSid = sysStaffOrgFeign.getSysStaffOrgListByStaffSid(staffSid); |
|
|
|
List<SysStaffOrgVo> data = sysStaffOrgListByStaffSid.getData(); |
|
|
|
String orgSidPath = ""; |
|
|
|
for (SysStaffOrgVo datum : data) { |
|
|
|
orgSidPath = datum.getOrgSidPath(); |
|
|
|
String[] split = orgSidPath.split("/"); |
|
|
|
for (String s : split) {//TODO 封装到组织架构的feign中
|
|
|
|
ResultBean<SysOrganizationVo> sysOrganizationVoResultBean = sysOrganizationFeign.fetchBySid(s); |
|
|
|
SysOrganizationVo data1 = sysOrganizationVoResultBean.getData(); |
|
|
|
Integer isDept = data1.getIsDept(); |
|
|
|
String psid = data1.getPsid(); |
|
|
|
if (isDept != null) { |
|
|
|
if (isDept == 0 && !psid.equals(0)) { |
|
|
|
orgSidPath = s; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setUseOrgSid(orgSidPath); |
|
|
|
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()).getData(); |
|
|
|
entity.setUseOrgSid(useOrgSid); |
|
|
|
entity.setCreateBySid(dto.getUserSid()); |
|
|
|
entity.setNodeState("待提交"); |
|
|
|
String carBrandSid = dto.getCarBrandSid(); |
|
|
@ -246,10 +219,9 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
String purchasingUnitSid = dto.getPurchasingUnitSid(); |
|
|
|
String manufacturerCode = baseManufacturerService.fetchBySid(purchasingUnitSid).getManufacturerCode(); |
|
|
|
entity.setSupplierCode(manufacturerCode); |
|
|
|
String useOrgSid = dto.getUseOrgSid(); |
|
|
|
String orgCode = sysOrganizationFeign.fetchBySid(useOrgSid).getData().getOrgCode(); |
|
|
|
entity.setOrgCode(orgCode); |
|
|
|
entity.setOrgSidPath(orgPath); |
|
|
|
entity.setOrgSidPath(dto.getOrgPath()); |
|
|
|
save(entity); |
|
|
|
for (BaseOutsourcingApplicationVehicleDto baseOutsourcingApplicationVehicleDto : baseOutsourcingApplicationVehicleDtos) { |
|
|
|
BaseOutsourcingApplicationVehicle baseOutsourcingApplicationVehicle = new BaseOutsourcingApplicationVehicle(); |
|
|
@ -267,7 +239,7 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
} |
|
|
|
return rb.success().setMsg("添加成功").setData(entity.getSid()); |
|
|
|
} |
|
|
|
dto.setOrgSidPath(orgPath); |
|
|
|
dto.setOrgSidPath(dto.getOrgPath()); |
|
|
|
updateBySid(dto, sid); |
|
|
|
baseOutsourcingApplicationVehicleService.deleteByOutAppSid(sid); |
|
|
|
for (BaseOutsourcingApplicationVehicleDto baseOutsourcingApplicationVehicleDto : baseOutsourcingApplicationVehicleDtos) { |
|
|
|