Browse Source

资产指标调整单处理接口

develop
bobol 11 months ago
parent
commit
edb454077e
  1. 21
      lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetAdjustDayMasterController.java
  2. 64
      lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetAdjustDaySubDao.java
  3. 116
      lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDayMasterService.java
  4. 16
      lzbi-module/src/main/resources/mapper/asset/DcBusiTargetAdjustDayMasterMapper.xml

21
lzbi-module/src/main/java/com/lzbi/draft/controller/DcBusiTargetAdjustDayMasterController.java

@ -110,16 +110,33 @@ public class DcBusiTargetAdjustDayMasterController extends BaseController
}
/**
* 新增资产指标调整单主()
* 审核资产指标调整单()
*/
@ApiOperation("审核资产指标调整单")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", dataTypeClass = Long.class, paramType = "path")
@PreAuthorize("@ss.hasPermi('lzbi:master:add')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.OTHER)
@PostMapping("/{id}")
@PostMapping("/audit/{id}")
public AjaxResult audit(@PathVariable("id") Long id)
{
return toAjax(dcBusiTargetAdjustDayMasterService.audit(id));
}
/**
* 处理资产指标调整单主()
*/
@ApiOperation("处理资产指标调整单")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", dataTypeClass = Long.class, paramType = "path")
@PreAuthorize("@ss.hasPermi('lzbi:master:add')")
@Log(title = "资产指标调整单主(日)", businessType = BusinessType.OTHER)
@PostMapping("/dispose/{id}")
public AjaxResult dispose(@PathVariable("id") Long id)
{
try{
return toAjax(dcBusiTargetAdjustDayMasterService.dispose(id));
} catch (RuntimeException e) {
return error(e.getMessage());
}
}
}

64
lzbi-module/src/main/java/com/lzbi/draft/domain/DcBusiTargetAdjustDaySubDao.java

@ -2,6 +2,7 @@ package com.lzbi.draft.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -13,76 +14,103 @@ import com.lzbi.module.base.BaseModuleEntity;
/**
* 统计单元指标调整单子()对象 dc_busi_target_adjust_day_sub
*
*
* @author win
* @date 2023-12-05
*/
@ApiModel(value = "DcBusiTargetAdjustDaySubDao对象", description = "资产指标调整单子表对象")
@Data
public class DcBusiTargetAdjustDaySubDao extends BaseModuleEntity
{
@Data
public class DcBusiTargetAdjustDaySubDao extends BaseModuleEntity {
private static final long serialVersionUID = 1L;
/** 创建人 */
/**
* 创建人
*/
@ApiModelProperty(hidden = true)
private String createdBy;
/** 创建时间 */
/**
* 创建时间
*/
@ApiModelProperty(hidden = true)
private Date createdTime;
/** 更新人 */
/**
* 更新人
*/
@ApiModelProperty(hidden = true)
private String updatedBy;
/** 更新时间 */
/**
* 更新时间
*/
@ApiModelProperty(hidden = true)
private Date updatedTime;
/** 主键 */
/**
* 主键
*/
private Long id;
/** 主单据编号 */
/**
* 主单据编号
*/
@ApiModelProperty(hidden = true)
@Excel(name = "主单据编号")
private String billNoMaster;
/** 指标编码 */
/**
* 指标编码
*/
@ApiModelProperty(value = "指标编码")
@Excel(name = "指标编码")
private String targetCode;
/** 指标名称 */
/**
* 指标名称
*/
@ApiModelProperty(hidden = true)
@Excel(name = "指标名称")
private String targetName;
/** 指标单位 */
/**
* 指标单位
*/
@ApiModelProperty(value = "指标单位")
@Excel(name = "指标单位")
private String tagetUnit;
/** 日期调整日期 */
/**
* 日期调整日期
*/
@ApiModelProperty(value = "日期调整日期")
@Excel(name = "日期调整日期")
private String adjustDate;
/** 调整时间 */
/**
* 调整时间
*/
@ApiModelProperty(value = "调整时间")
@Excel(name = "调整时间")
private Long adjstTime;
/** 原值 */
/**
* 原值
*/
@ApiModelProperty(value = "原值")
@Excel(name = "原值")
private BigDecimal valOrigin;
/** 调整值 */
/**
* 调整值
*/
@ApiModelProperty(value = "调整值")
@Excel(name = "调整值")
private BigDecimal valAdjust;
/** 结果值 */
/**
* 结果值
*/
@ApiModelProperty(value = "结果值")
@Excel(name = "结果值")
private BigDecimal valResult;

116
lzbi-module/src/main/java/com/lzbi/draft/service/DcBusiTargetAdjustDayMasterService.java

@ -8,30 +8,35 @@ import com.lzbi.common.core.domain.entity.SysDept;
import com.lzbi.common.utils.DateUtils;
import com.lzbi.draft.domain.DcBusiTargetAdjustDayMasterDao;
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.DcBusiTargetAdjustDaySubMapper;
import com.lzbi.draft.mapper.DcBusiTargetDraftDayMapper;
import com.lzbi.special.domain.DcBaseWorkSpecial;
import com.lzbi.special.mapper.DcBaseWorkSpecialMapper;
import com.lzbi.system.service.impl.SysDeptServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* 资产指标调整单主()Service业务层处理
*
*
* @author lienbo
* @date 2023-12-05
*/
@Slf4j
@Service
public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTargetAdjustDayMasterMapper, DcBusiTargetAdjustDayMasterDao> implements IService<DcBusiTargetAdjustDayMasterDao>
{
public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTargetAdjustDayMasterMapper, DcBusiTargetAdjustDayMasterDao> implements IService<DcBusiTargetAdjustDayMasterDao> {
@Resource
private DcBaseAssetInfoMapper dcBaseAssetInfoMapper;
@ -51,37 +56,36 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
@Resource
private DcBusiTargetDraftDayMapper dcBusiTargetDraftDayMapper;
private static final Lock lock = new ReentrantLock();
/**
* 查询资产指标调整单主()
*
*
* @param id 资产指标调整单主()主键
* @return 资产指标调整单主()
*/
public DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoById(Long id)
{
public DcBusiTargetAdjustDayMasterDao selectDcBusiTargetAdjustDayMasterDaoById(Long id) {
return baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id);
}
/**
* 查询资产指标调整单主()列表
*
*
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主()
* @return 资产指标调整单主()
*/
public List<DcBusiTargetAdjustDayMasterDao> selectDcBusiTargetAdjustDayMasterDaoList(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao)
{
public List<DcBusiTargetAdjustDayMasterDao> selectDcBusiTargetAdjustDayMasterDaoList(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) {
return baseMapper.selectDcBusiTargetAdjustDayMasterDaoList(dcBusiTargetAdjustDayMasterDao);
}
/**
* 新增资产指标调整单主()
*
*
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主()
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
public int insertDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao)
{
public int insertDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) {
String assetCode = dcBusiTargetAdjustDayMasterDao.getAssetCode();
// 查询公司
SysDept company = sysDeptService.selectDeptById(dcBusiTargetAdjustDayMasterDao.getCompanyId());
@ -118,38 +122,35 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
/**
* 修改资产指标调整单主()
*
*
* @param dcBusiTargetAdjustDayMasterDao 资产指标调整单主()
* @return 结果
*/
public int updateDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao)
{
public int updateDcBusiTargetAdjustDayMasterDao(DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao) {
dcBusiTargetAdjustDayMasterDao.setUpdatedTime(DateUtils.getNowDate());
return baseMapper.updateDcBusiTargetAdjustDayMasterDao(dcBusiTargetAdjustDayMasterDao);
}
/**
* 批量删除资产指标调整单主()
*
*
* @param ids 需要删除的资产指标调整单主()主键
* @return 结果
*/
public int deleteDcBusiTargetAdjustDayMasterDaoByIds(Long[] ids)
{
public int deleteDcBusiTargetAdjustDayMasterDaoByIds(Long[] ids) {
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoByIds(ids);
}
/**
* 删除资产指标调整单主()信息
*
*
* @param id 资产指标调整单主()主键
* @return 结果
*/
public int deleteDcBusiTargetAdjustDayMasterDaoById(Long id)
{
public int deleteDcBusiTargetAdjustDayMasterDaoById(Long id) {
return baseMapper.deleteDcBusiTargetAdjustDayMasterDaoById(id);
}
@ -173,21 +174,62 @@ public class DcBusiTargetAdjustDayMasterService extends ServiceImpl<DcBusiTarget
* @return
*/
@Transactional(rollbackFor = Exception.class)
public int dispose(Long id) {
// 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id);
// 查询审核资产指标调整单子表集合
DcBusiTargetAdjustDaySubDao params = new DcBusiTargetAdjustDaySubDao();
params.setBillNoMaster(dcBusiTargetAdjustDayMasterDao.getBillSerial());
List<DcBusiTargetAdjustDaySubDao> dcBusiTargetAdjustDaySubDaoList = dcBusiTargetAdjustDaySubMapper.selectDcBusiTargetAdjustDaySubDaoList(params);
// 遍历子表集合,向指标数据底稿表(日)中同步数据
for (DcBusiTargetAdjustDaySubDao dcBusiTargetAdjustDaySubDao : dcBusiTargetAdjustDaySubDaoList) {
DcBusiTargetDraftDayDao dcBusiTargetDraftDayDao = new DcBusiTargetDraftDayDao();
// dcBusiTargetDraftDayDao.setCompanyCode();
// dcBusiTargetDraftDayMapper.disposeDcBusiTargetDraftDayDao(dcBusiTargetAdjustDaySubDao);
public int dispose(Long id) throws RuntimeException {
lock.lock();
try {
// 查询审核资产指标调整单主表数据
DcBusiTargetAdjustDayMasterDao dcBusiTargetAdjustDayMasterDao = baseMapper.selectDcBusiTargetAdjustDayMasterDaoById(id);
// 调整单未审核不能处理
if (DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PENDING_CHECK.equals(dcBusiTargetAdjustDayMasterDao.getCheckStauts())) {
throw new RuntimeException("调整单未审核不能处理");
}
// 调整单已处理
if (DcBusiTargetAdjustDayMasterDao.CHECK_STATUS_PROCESSED.equals(dcBusiTargetAdjustDayMasterDao.getCheckStauts())) {
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);
}
}

16
lzbi-module/src/main/resources/mapper/asset/DcBusiTargetAdjustDayMasterMapper.xml

@ -2,9 +2,9 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.lzbi.mapper.DcBusiTargetAdjustDayMasterMapper">
<mapper namespace="com.lzbi.draft.mapper.DcBusiTargetAdjustDayMasterMapper">
<resultMap type="com.lzbi.domain.DcBusiTargetAdjustDayMasterDao" id="DcBusiTargetAdjustDayMasterResult">
<resultMap type="com.lzbi.draft.domain.DcBusiTargetAdjustDayMasterDao" id="DcBusiTargetAdjustDayMasterResult">
<result property="billSerial" column="bill_serial"/>
<result property="biilType" column="biil_type"/>
<result property="companyId" column="company_id"/>
@ -55,7 +55,7 @@
from dc_busi_target_adjust_day_master
</sql>
<select id="selectDcBusiTargetAdjustDayMasterList" parameterType="DcBusiTargetAdjustDayMaster"
<select id="selectDcBusiTargetAdjustDayMasterDaoList" parameterType="DcBusiTargetAdjustDayMasterDao"
resultMap="DcBusiTargetAdjustDayMasterResult">
<include refid="selectDcBusiTargetAdjustDayMasterVo"/>
<where>
@ -79,13 +79,13 @@
</where>
</select>
<select id="selectDcBusiTargetAdjustDayMasterById" parameterType="Long"
<select id="selectDcBusiTargetAdjustDayMasterDaoById" parameterType="Long"
resultMap="DcBusiTargetAdjustDayMasterResult">
<include refid="selectDcBusiTargetAdjustDayMasterVo"/>
where id = #{id}
</select>
<insert id="insertDcBusiTargetAdjustDayMaster" parameterType="DcBusiTargetAdjustDayMaster" useGeneratedKeys="true"
<insert id="insertDcBusiTargetAdjustDayMasterDao" parameterType="DcBusiTargetAdjustDayMasterDao" useGeneratedKeys="true"
keyProperty="id">
insert into dc_busi_target_adjust_day_master
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -136,7 +136,7 @@
</trim>
</insert>
<update id="updateDcBusiTargetAdjustDayMaster" parameterType="DcBusiTargetAdjustDayMaster">
<update id="updateDcBusiTargetAdjustDayMasterDao" parameterType="DcBusiTargetAdjustDayMasterDao">
update dc_busi_target_adjust_day_master
<trim prefix="SET" suffixOverrides=",">
<if test="billSerial != null">bill_serial = #{billSerial},</if>
@ -164,13 +164,13 @@
where id = #{id}
</update>
<delete id="deleteDcBusiTargetAdjustDayMasterById" parameterType="Long">
<delete id="deleteDcBusiTargetAdjustDayMasterDaoById" parameterType="Long">
delete
from dc_busi_target_adjust_day_master
where id = #{id}
</delete>
<delete id="deleteDcBusiTargetAdjustDayMasterByIds" parameterType="String">
<delete id="deleteDcBusiTargetAdjustDayMasterDaoByIds" parameterType="String">
delete from dc_busi_target_adjust_day_master where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}

Loading…
Cancel
Save