|
@ -8,30 +8,35 @@ import com.lzbi.common.core.domain.entity.SysDept; |
|
|
import com.lzbi.common.utils.DateUtils; |
|
|
import com.lzbi.common.utils.DateUtils; |
|
|
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.DcBusiTargetDraftDayDao; |
|
|
import com.lzbi.draft.domain.DcBusiTargetDraftDay; |
|
|
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.DcBusiTargetDraftDayMapper; |
|
|
import com.lzbi.draft.mapper.DcBusiTargetDraftDayMapper; |
|
|
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 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; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.concurrent.locks.Lock; |
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 资产指标调整单主(日)Service业务层处理 |
|
|
* 资产指标调整单主(日)Service业务层处理 |
|
|
* |
|
|
* |
|
|
* @author lienbo |
|
|
* @author lienbo |
|
|
* @date 2023-12-05 |
|
|
* @date 2023-12-05 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTargetAdjustDayMasterMapper, DcBusiTargetAdjustDayMasterDao> implements IService<DcBusiTargetAdjustDayMasterDao> |
|
|
public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTargetAdjustDayMasterMapper, DcBusiTargetAdjustDayMasterDao> implements IService<DcBusiTargetAdjustDayMasterDao> { |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
@Resource |
|
|
private DcBaseAssetInfoMapper dcBaseAssetInfoMapper; |
|
|
private DcBaseAssetInfoMapper dcBaseAssetInfoMapper; |
|
@ -51,37 +56,36 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget |
|
|
@Resource |
|
|
@Resource |
|
|
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper; |
|
|
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper; |
|
|
|
|
|
|
|
|
|
|
|
private static final Lock lock = new ReentrantLock(); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询资产指标调整单主(日) |
|
|
* 查询资产指标调整单主(日) |
|
|
* |
|
|
* |
|
|
* @param id 资产指标调整单主(日)主键 |
|
|
* @param id 资产指标调整单主(日)主键 |
|
|
* @return 资产指标调整单主(日) |
|
|
* @return 资产指标调整单主(日) |
|
|
*/ |
|
|
*/ |
|
|
public DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoById(Long id) |
|
|
public DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoById(Long id) { |
|
|
{ |
|
|
|
|
|
return baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
return baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询资产指标调整单主(日)列表 |
|
|
* 查询资产指标调整单主(日)列表 |
|
|
* |
|
|
* |
|
|
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主(日) |
|
|
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主(日) |
|
|
* @return 资产指标调整单主(日) |
|
|
* @return 资产指标调整单主(日) |
|
|
*/ |
|
|
*/ |
|
|
public List<DcBusiTargetAdjustDayMasterDao> selectDcBusiTargetAdjustDayMasterDaoList(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) |
|
|
public List<DcBusiTargetAdjustDayMasterDao> selectDcBusiTargetAdjustDayMasterDaoList(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) { |
|
|
{ |
|
|
|
|
|
return baseMapper.selectDcBusiTargetAdjustDayMasterDaoList(dcBusiTargetAdjustDayMasterDao); |
|
|
return baseMapper.selectDcBusiTargetAdjustDayMasterDaoList(dcBusiTargetAdjustDayMasterDao); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 新增资产指标调整单主(日) |
|
|
* 新增资产指标调整单主(日) |
|
|
* |
|
|
* |
|
|
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主(日) |
|
|
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主(日) |
|
|
* @return 结果 |
|
|
* @return 结果 |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public int insertDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) |
|
|
public int insertDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) { |
|
|
{ |
|
|
|
|
|
String assetCode = dcBusiTargetAdjustDayMasterDao.getAssetCode(); |
|
|
String assetCode = dcBusiTargetAdjustDayMasterDao.getAssetCode(); |
|
|
// 查询公司
|
|
|
// 查询公司
|
|
|
SysDept company = sysDeptService.selectDeptById(dcBusiTargetAdjustDayMasterDao.getCompanyId()); |
|
|
SysDept company = sysDeptService.selectDeptById(dcBusiTargetAdjustDayMasterDao.getCompanyId()); |
|
@ -118,38 +122,35 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 修改资产指标调整单主(日) |
|
|
* 修改资产指标调整单主(日) |
|
|
* |
|
|
* |
|
|
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主(日) |
|
|
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主(日) |
|
|
* @return 结果 |
|
|
* @return 结果 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
public int updateDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) |
|
|
public int updateDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) { |
|
|
{ |
|
|
|
|
|
dcBusiTargetAdjustDayMasterDao.setUpdatedTime(DateUtils.getNowDate()); |
|
|
dcBusiTargetAdjustDayMasterDao.setUpdatedTime(DateUtils.getNowDate()); |
|
|
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 批量删除资产指标调整单主(日) |
|
|
* 批量删除资产指标调整单主(日) |
|
|
* |
|
|
* |
|
|
* @param ids 需要删除的资产指标调整单主(日)主键 |
|
|
* @param ids 需要删除的资产指标调整单主(日)主键 |
|
|
* @return 结果 |
|
|
* @return 结果 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
public int deleteDcBusiTargetAdjustDayMasterDaoByIds(Long[] ids) |
|
|
public int deleteDcBusiTargetAdjustDayMasterDaoByIds(Long[] ids) { |
|
|
{ |
|
|
|
|
|
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoByIds(ids); |
|
|
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoByIds(ids); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 删除资产指标调整单主(日)信息 |
|
|
* 删除资产指标调整单主(日)信息 |
|
|
* |
|
|
* |
|
|
* @param id 资产指标调整单主(日)主键 |
|
|
* @param id 资产指标调整单主(日)主键 |
|
|
* @return 结果 |
|
|
* @return 结果 |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
public int deleteDcBusiTargetAdjustDayMasterDaoById(Long id) |
|
|
public int deleteDcBusiTargetAdjustDayMasterDaoById(Long id) { |
|
|
{ |
|
|
|
|
|
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -173,21 +174,62 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public int dispose(Long id) { |
|
|
public int dispose(Long id) throws RuntimeException { |
|
|
// 查询审核资产指标调整单主表数据
|
|
|
lock.lock(); |
|
|
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
try { |
|
|
// 查询审核资产指标调整单子表集合
|
|
|
// 查询审核资产指标调整单主表数据
|
|
|
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao(); |
|
|
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id); |
|
|
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial()); |
|
|
// 调整单未审核不能处理
|
|
|
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params); |
|
|
if (DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PENDING_CHECK.equals(dcBusiTargetAdjustDayMasterDao.getCheckStauts())) { |
|
|
// 遍历子表集合,向指标数据底稿表(日)中同步数据
|
|
|
throw new RuntimeException("调整单未审核不能处理"); |
|
|
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) { |
|
|
} |
|
|
DcBusiTargetDraftDayDao dcBusiTargetDraftDayDao = new DcBusiTargetDraftDayDao(); |
|
|
// 调整单已处理
|
|
|
// dcBusiTargetDraftDayDao.setCompanyCode();
|
|
|
if (DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PROCESSED.equals(dcBusiTargetAdjustDayMasterDao.getCheckStauts())) { |
|
|
// dcBusiTargetDraftDayMapper.disposeDcBusiTargetDraftDayDao(dcBusiTargetAdjustDaySubDao);
|
|
|
throw new RuntimeException("调整单已处理"); |
|
|
|
|
|
} |
|
|
|
|
|
// 查询审核资产指标调整单子表集合
|
|
|
|
|
|
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao(); |
|
|
|
|
|
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial()); |
|
|
|
|
|
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params); |
|
|
|
|
|
// 遍历子表集合,向指标数据底稿表(日)中同步数据
|
|
|
|
|
|
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) { |
|
|
|
|
|
DcBusiTargetDraftDay dcBusiTargetDraftDay = new DcBusiTargetDraftDay(); |
|
|
|
|
|
dcBusiTargetDraftDay.setCompanyId(dcBusiTargetAdjustDayMasterDao.getCompanyId()); |
|
|
|
|
|
dcBusiTargetDraftDay.setOrgId(dcBusiTargetAdjustDayMasterDao.getOragnizeId()); |
|
|
|
|
|
dcBusiTargetDraftDay.setAssetCode(dcBusiTargetAdjustDayMasterDao.getAssetCode()); |
|
|
|
|
|
dcBusiTargetDraftDay.setFieldCode(dcBusiTargetAdjustDayMasterDao.getFieldCode()); |
|
|
|
|
|
dcBusiTargetDraftDay.setTargetCode(dcBusiTargetDraftDay.getTargetCode()); |
|
|
|
|
|
List<DcBusiTargetDraftDay> dcBusiTargetDraftDayList = dcBusiTargetDraftDayMapper.selectDcBusiTargetDraftDayList(dcBusiTargetDraftDay); |
|
|
|
|
|
// 如果未查询出来指标数据底稿数据,就新增,否则修改
|
|
|
|
|
|
if (CollectionUtils.isEmpty(dcBusiTargetDraftDayList)) { |
|
|
|
|
|
dcBusiTargetDraftDay.setCompanyName(dcBusiTargetAdjustDayMasterDao.getCompanyName()); |
|
|
|
|
|
dcBusiTargetDraftDay.setOrgName(dcBusiTargetAdjustDayMasterDao.getOrganizeName()); |
|
|
|
|
|
dcBusiTargetDraftDay.setAssetName(dcBusiTargetAdjustDayMasterDao.getAssetName()); |
|
|
|
|
|
dcBusiTargetDraftDay.setFieldName(dcBusiTargetAdjustDayMasterDao.getFieldName()); |
|
|
|
|
|
dcBusiTargetDraftDay.setTargetName(dcBusiTargetAdjustDaySubDao.getTargetName()); |
|
|
|
|
|
dcBusiTargetDraftDay.setTargetUint(dcBusiTargetAdjustDaySubDao.getTagetUnit()); |
|
|
|
|
|
dcBusiTargetDraftDay.setCountDate(dcBusiTargetAdjustDayMasterDao.getDateAdjust()); |
|
|
|
|
|
dcBusiTargetDraftDay.setValOriginal(dcBusiTargetAdjustDaySubDao.getValOrigin()); |
|
|
|
|
|
dcBusiTargetDraftDay.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
|
|
|
dcBusiTargetDraftDay.setValResult(dcBusiTargetAdjustDaySubDao.getValResult()); |
|
|
|
|
|
dcBusiTargetDraftDayMapper.insertDcBusiTargetDraftDay(dcBusiTargetDraftDay); |
|
|
|
|
|
} else { |
|
|
|
|
|
dcBusiTargetDraftDay = dcBusiTargetDraftDayList.get(0); |
|
|
|
|
|
BigDecimal valResult = dcBusiTargetDraftDay.getValResult().add(new BigDecimal(0)); |
|
|
|
|
|
dcBusiTargetDraftDay.setValOriginal(valResult); |
|
|
|
|
|
dcBusiTargetDraftDay.setValAdjust(dcBusiTargetAdjustDaySubDao.getValAdjust()); |
|
|
|
|
|
dcBusiTargetDraftDay.setValResult(valResult.add(dcBusiTargetAdjustDaySubDao.getValAdjust())); |
|
|
|
|
|
dcBusiTargetDraftDayMapper.updateDcBusiTargetDraftDay(dcBusiTargetDraftDay); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 修改审核状态为已处理
|
|
|
|
|
|
dcBusiTargetAdjustDayMasterDao.setCheckStauts(DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PROCESSED); |
|
|
|
|
|
return this.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
|
|
|
} catch (RuntimeException e) { |
|
|
|
|
|
log.error("处理异常", e); |
|
|
|
|
|
throw e; |
|
|
|
|
|
}finally { |
|
|
|
|
|
lock.unlock(); |
|
|
} |
|
|
} |
|
|
// 修改审核状态为已处理
|
|
|
|
|
|
dcBusiTargetAdjustDayMasterDao.setCheckStauts(DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PROCESSED); |
|
|
|
|
|
return this.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|