|
@ -4,19 +4,22 @@ import com.baomidou.mybatisplus.extension.service.IService; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.lzbi.asset.domain.DcBaseAssetInfo; |
|
|
import com.lzbi.asset.domain.DcBaseAssetInfo; |
|
|
import com.lzbi.asset.mapper.DcBaseAssetInfoMapper; |
|
|
import com.lzbi.asset.mapper.DcBaseAssetInfoMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper; |
|
|
|
|
|
import com.lzbi.common.core.domain.entity.SysDept; |
|
|
import com.lzbi.common.core.domain.entity.SysDept; |
|
|
import com.lzbi.common.utils.DateUtils; |
|
|
import com.lzbi.common.utils.DateUtils; |
|
|
import com.lzbi.common.utils.SecurityUtils; |
|
|
import com.lzbi.common.utils.SecurityUtils; |
|
|
import com.lzbi.draft.domain.DcBusiTargetAdjustDayMasterDao; |
|
|
import com.lzbi.draft.domain.DcBusiTargetAdjustDayMasterDao; |
|
|
import com.lzbi.draft.domain.DcBusiTargetAdjustDaySubDao; |
|
|
import com.lzbi.draft.domain.DcBusiTargetAdjustDaySubDao; |
|
|
|
|
|
import com.lzbi.draft.domain.DcBusiTargetDraftDaynew; |
|
|
import com.lzbi.draft.domain.DcBusiTargetDraftMonth; |
|
|
import com.lzbi.draft.domain.DcBusiTargetDraftMonth; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetAdjustDayMasterMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetAdjustDayMasterMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetAdjustDaySubMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetAdjustDaySubMapper; |
|
|
|
|
|
import com.lzbi.draft.mapper.DcBusiTargetDraftDaynewMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetDraftMonthMapper; |
|
|
import com.lzbi.special.domain.DcBaseWorkSpecial; |
|
|
import com.lzbi.special.domain.DcBaseWorkSpecial; |
|
|
import com.lzbi.special.mapper.DcBaseWorkSpecialMapper; |
|
|
import com.lzbi.special.mapper.DcBaseWorkSpecialMapper; |
|
|
import com.lzbi.system.service.impl.SysDeptServiceImpl; |
|
|
import com.lzbi.system.service.impl.SysDeptServiceImpl; |
|
|
|
|
|
import com.lzbi.targetFolder.domain.DcBaseAssetTarget; |
|
|
|
|
|
import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.ObjectUtils; |
|
|
import org.apache.commons.lang3.ObjectUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@ -61,6 +64,9 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget |
|
|
@Resource |
|
|
@Resource |
|
|
private DcBusiTargetDraftDaynewMapper dcBusiTargetDraftDaynewMapper; |
|
|
private DcBusiTargetDraftDaynewMapper dcBusiTargetDraftDaynewMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private DcBaseAssetTargetMapper dcBaseAssetTargetMapper; |
|
|
|
|
|
|
|
|
private static final Lock lock = new ReentrantLock(); |
|
|
private static final Lock lock = new ReentrantLock(); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -216,70 +222,6 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget |
|
|
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 审核资产指标调整单 |
|
|
|
|
|
* |
|
|
|
|
|
* @param id |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public int dispose(Long id) throws RuntimeException { |
|
|
|
|
|
lock.lock(); |
|
|
|
|
|
try { |
|
|
|
|
|
// 查询审核资产指标调整单主表数据
|
|
|
|
|
|
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
|
|
|
if ("0".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) { |
|
|
|
|
|
throw new RuntimeException("审核失败,单据未提交"); |
|
|
|
|
|
} |
|
|
|
|
|
if ("2".equals(dcBusiTargetAdjustDayMasterDao.getCheckStatus())) { |
|
|
|
|
|
throw new RuntimeException("审核失败,单据已审核"); |
|
|
|
|
|
} |
|
|
|
|
|
// 查询审核资产指标调整单子表集合
|
|
|
|
|
|
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao(); |
|
|
|
|
|
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial()); |
|
|
|
|
|
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params); |
|
|
|
|
|
// 遍历子表集合,向指标数据底稿表(日)中同步数据
|
|
|
|
|
|
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) { |
|
|
|
|
|
DcBusiTargetDraftMonth dcBusiTargetDraftMonth = new DcBusiTargetDraftMonth(); |
|
|
|
|
|
dcBusiTargetDraftMonth.setCompanyId(dcBusiTargetAdjustDayMasterDao.getCompanyId()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setOrgId(dcBusiTargetAdjustDayMasterDao.getOragnizeId()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setAssetCode(dcBusiTargetAdjustDayMasterDao.getAssetCode()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setFieldCode(dcBusiTargetAdjustDayMasterDao.getFieldCode()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setTargetCode(dcBusiTargetAdjustDaySubDao.getTargetCode()); |
|
|
|
|
|
List<DcBusiTargetDraftMonth> dcBusiTargetDraftMonthList = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMonthList(dcBusiTargetDraftMonth); |
|
|
|
|
|
// 如果未查询出来指标数据底稿数据,就新增,否则修改
|
|
|
|
|
|
if (CollectionUtils.isEmpty(dcBusiTargetDraftMonthList)) { |
|
|
|
|
|
dcBusiTargetDraftMonth.setCompanyName(dcBusiTargetAdjustDayMasterDao.getCompanyName()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setOrgName(dcBusiTargetAdjustDayMasterDao.getOrganizeName()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setAssetName(dcBusiTargetAdjustDayMasterDao.getAssetName()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setFieldName(dcBusiTargetAdjustDayMasterDao.getFieldName()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setTargetName(dcBusiTargetAdjustDaySubDao.getTargetName()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setTargetUint(dcBusiTargetAdjustDaySubDao.getTagetUnit()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setCountDate(dcBusiTargetAdjustDayMasterDao.getDateAdjust()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setValOriginal(dcBusiTargetAdjustDaySubDao.getValOrigin()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setValResult(dcBusiTargetAdjustDaySubDao.getValResult()); |
|
|
|
|
|
dcBusiTargetDraftMonthMapper.insertDcBusiTargetDraftMonth(dcBusiTargetDraftMonth); |
|
|
|
|
|
} else { |
|
|
|
|
|
dcBusiTargetDraftMonth = dcBusiTargetDraftMonthList.get(0); |
|
|
|
|
|
BigDecimal valResult = dcBusiTargetDraftMonth.getValResult().add(new BigDecimal(0)); |
|
|
|
|
|
dcBusiTargetDraftMonth.setValOriginal(valResult); |
|
|
|
|
|
dcBusiTargetDraftMonth.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
|
|
|
dcBusiTargetDraftMonth.setValResult(valResult.add(dcBusiTargetAdjustDaySubDao.getValAdjust())); |
|
|
|
|
|
dcBusiTargetDraftMonthMapper.updateDcBusiTargetDraftMonth(dcBusiTargetDraftMonth); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 修改审核状态为已处理
|
|
|
|
|
|
dcBusiTargetAdjustDayMasterDao.setCheckStatus("2"); |
|
|
|
|
|
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
|
|
|
} catch (RuntimeException e) { |
|
|
|
|
|
log.error("处理异常", e); |
|
|
|
|
|
throw e; |
|
|
|
|
|
} finally { |
|
|
|
|
|
lock.unlock(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int checkBack(String billNo) { |
|
|
public int checkBack(String billNo) { |
|
|
DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo); |
|
|
DcBusiTargetAdjustDayMasterDao master = baseMapper.selectDcBusiTargetAdjustDayMasterDaoByBillNo(billNo); |
|
|
master.setUpdatedBy(SecurityUtils.getUsername()); |
|
|
master.setUpdatedBy(SecurityUtils.getUsername()); |
|
@ -302,43 +244,55 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget |
|
|
} |
|
|
} |
|
|
String dateAdjust = dcBusiTargetAdjustDayMasterDao.getDateAdjust(); |
|
|
String dateAdjust = dcBusiTargetAdjustDayMasterDao.getDateAdjust(); |
|
|
String[] dataStrArr = dateAdjust.split("-"); |
|
|
String[] dataStrArr = dateAdjust.split("-"); |
|
|
|
|
|
String year = null; |
|
|
|
|
|
String month = null; |
|
|
|
|
|
String day = null; |
|
|
if (dataStrArr.length == 3) { |
|
|
if (dataStrArr.length == 3) { |
|
|
|
|
|
year = dataStrArr[0]; |
|
|
|
|
|
month = dataStrArr[1]; |
|
|
|
|
|
day = dataStrArr[2]; |
|
|
|
|
|
} else { |
|
|
throw new RuntimeException("调整目标日期有误"); |
|
|
throw new RuntimeException("调整目标日期有误"); |
|
|
} |
|
|
} |
|
|
// 查询审核资产指标调整单子表集合
|
|
|
// 查询审核资产指标调整单子表集合
|
|
|
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao(); |
|
|
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao(); |
|
|
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial()); |
|
|
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial()); |
|
|
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params); |
|
|
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params); |
|
|
DcBusiTargetDraftMonth dcBusiTargetDraftMonth; |
|
|
DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew; |
|
|
// 遍历子表集合,向指标数据底稿表(日)中同步数据
|
|
|
// 遍历子表集合,向指标数据底稿表(日)中同步数据
|
|
|
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) { |
|
|
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) { |
|
|
dcBusiTargetDraftMonth = new DcBusiTargetDraftMonth(); |
|
|
dcBusiTargetDraftDaynew = new DcBusiTargetDraftDaynew(); |
|
|
dcBusiTargetDraftMonth.setCompanyId(dcBusiTargetAdjustDayMasterDao.getCompanyId()); |
|
|
dcBusiTargetDraftDaynew.setCompanyId(dcBusiTargetAdjustDayMasterDao.getCompanyId()); |
|
|
dcBusiTargetDraftMonth.setOrgId(dcBusiTargetAdjustDayMasterDao.getOragnizeId()); |
|
|
dcBusiTargetDraftDaynew.setOrganizeId(dcBusiTargetAdjustDayMasterDao.getOragnizeId()); |
|
|
dcBusiTargetDraftMonth.setAssetCode(dcBusiTargetAdjustDayMasterDao.getAssetCode()); |
|
|
dcBusiTargetDraftDaynew.setAssetCode(dcBusiTargetAdjustDayMasterDao.getAssetCode()); |
|
|
dcBusiTargetDraftMonth.setFieldCode(dcBusiTargetAdjustDayMasterDao.getFieldCode()); |
|
|
dcBusiTargetDraftDaynew.setFieldCode(dcBusiTargetAdjustDayMasterDao.getFieldCode()); |
|
|
dcBusiTargetDraftMonth.setTargetCode(dcBusiTargetAdjustDaySubDao.getTargetCode()); |
|
|
dcBusiTargetDraftDaynew.setTargetCode(dcBusiTargetAdjustDaySubDao.getTargetCode()); |
|
|
List<DcBusiTargetDraftMonth> dcBusiTargetDraftMonthList = dcBusiTargetDraftMonthMapper.selectDcBusiTargetDraftMonthList(dcBusiTargetDraftMonth); |
|
|
dcBusiTargetDraftDaynew.setDateYear(year); |
|
|
|
|
|
dcBusiTargetDraftDaynew.setDateMonth(month); |
|
|
|
|
|
dcBusiTargetDraftDaynew.setDateDay(day); |
|
|
|
|
|
List<DcBusiTargetDraftDaynew> dcBusiTargetDraftDaynewList = dcBusiTargetDraftDaynewMapper.selectDcBusiTargetDraftDaynewList(dcBusiTargetDraftDaynew); |
|
|
// 如果未查询出来指标数据底稿数据,就新增,否则修改
|
|
|
// 如果未查询出来指标数据底稿数据,就新增,否则修改
|
|
|
if (CollectionUtils.isEmpty(dcBusiTargetDraftMonthList)) { |
|
|
if (CollectionUtils.isEmpty(dcBusiTargetDraftDaynewList)) { |
|
|
dcBusiTargetDraftMonth.setCompanyName(dcBusiTargetAdjustDayMasterDao.getCompanyName()); |
|
|
dcBusiTargetDraftDaynew.setCompanyName(dcBusiTargetAdjustDayMasterDao.getCompanyName()); |
|
|
dcBusiTargetDraftMonth.setOrgName(dcBusiTargetAdjustDayMasterDao.getOrganizeName()); |
|
|
dcBusiTargetDraftDaynew.setOrganizeName(dcBusiTargetAdjustDayMasterDao.getOrganizeName()); |
|
|
dcBusiTargetDraftMonth.setAssetName(dcBusiTargetAdjustDayMasterDao.getAssetName()); |
|
|
dcBusiTargetDraftDaynew.setAssetName(dcBusiTargetAdjustDayMasterDao.getAssetName()); |
|
|
dcBusiTargetDraftMonth.setFieldName(dcBusiTargetAdjustDayMasterDao.getFieldName()); |
|
|
dcBusiTargetDraftDaynew.setFieldName(dcBusiTargetAdjustDayMasterDao.getFieldName()); |
|
|
dcBusiTargetDraftMonth.setTargetName(dcBusiTargetAdjustDaySubDao.getTargetName()); |
|
|
dcBusiTargetDraftDaynew.setTagetName(dcBusiTargetAdjustDaySubDao.getTargetName()); |
|
|
dcBusiTargetDraftMonth.setTargetUint(dcBusiTargetAdjustDaySubDao.getTagetUnit()); |
|
|
dcBusiTargetDraftDaynew.setValueOriginal(dcBusiTargetAdjustDaySubDao.getValOrigin()); |
|
|
dcBusiTargetDraftMonth.setCountDate(dcBusiTargetAdjustDayMasterDao.getDateAdjust()); |
|
|
dcBusiTargetDraftDaynew.setValueAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
dcBusiTargetDraftMonth.setValOriginal(dcBusiTargetAdjustDaySubDao.getValOrigin()); |
|
|
dcBusiTargetDraftDaynew.setValueResult(dcBusiTargetAdjustDaySubDao.getValResult()); |
|
|
dcBusiTargetDraftMonth.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
DcBaseAssetTarget dcBaseAssetTarget = dcBaseAssetTargetMapper.selectDcBaseAssetTargetByTargetCodeAndAssetCode(dcBusiTargetAdjustDaySubDao.getTargetCode(), dcBusiTargetAdjustDayMasterDao.getAssetCode()); |
|
|
dcBusiTargetDraftMonth.setValResult(dcBusiTargetAdjustDaySubDao.getValResult()); |
|
|
if (ObjectUtils.isNotEmpty(dcBaseAssetTarget)) { |
|
|
dcBusiTargetDraftMonthMapper.insertDcBusiTargetDraftMonth(dcBusiTargetDraftMonth); |
|
|
dcBusiTargetDraftDaynew.setTargetModelCode(dcBaseAssetTarget.getTargetModelCode()); |
|
|
|
|
|
} |
|
|
|
|
|
dcBusiTargetDraftDaynewMapper.insertDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); |
|
|
} else { |
|
|
} else { |
|
|
dcBusiTargetDraftMonth = dcBusiTargetDraftMonthList.get(0); |
|
|
dcBusiTargetDraftDaynew = dcBusiTargetDraftDaynewList.get(0); |
|
|
BigDecimal valResult = dcBusiTargetDraftMonth.getValResult().add(new BigDecimal(0)); |
|
|
BigDecimal valResult = dcBusiTargetDraftDaynew.getValueResult().add(new BigDecimal(0)); |
|
|
dcBusiTargetDraftMonth.setValOriginal(valResult); |
|
|
dcBusiTargetDraftDaynew.setValueOriginal(valResult); |
|
|
dcBusiTargetDraftMonth.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
dcBusiTargetDraftDaynew.setValueAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
dcBusiTargetDraftMonth.setValResult(valResult.add(dcBusiTargetAdjustDaySubDao.getValAdjust())); |
|
|
dcBusiTargetDraftDaynew.setValueResult(valResult.add(dcBusiTargetAdjustDaySubDao.getValAdjust())); |
|
|
dcBusiTargetDraftMonthMapper.updateDcBusiTargetDraftMonth(dcBusiTargetDraftMonth); |
|
|
dcBusiTargetDraftDaynewMapper.updateDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 修改审核状态为已处理
|
|
|
// 修改审核状态为已处理
|
|
|