指标占用
This commit is contained in:
parent
97752629d2
commit
7f0d7280d5
|
@ -0,0 +1,14 @@
|
||||||
|
package com.hzya.frame.grpU8.nxproof.controlindex.dao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.hzya.frame.basedao.dao.IBaseDao;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.controlindex.entity.ControlIndexEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IControlIndexDao extends IBaseDao<ControlIndexEntity,String> {
|
||||||
|
|
||||||
|
//根据状态查询数据
|
||||||
|
List<ControlIndexEntity> queryControlIndexByStatus(ControlIndexEntity controlIndexEntity);
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.hzya.frame.grpU8.nxproof.controlindex.dao.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.hzya.frame.basedao.dao.MybatisGenericDao;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.controlindex.dao.IControlIndexDao;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.controlindex.entity.ControlIndexEntity;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Repository(value = "controlIndexDaoImpl")
|
||||||
|
public class ControlIndexDaoImpl extends MybatisGenericDao<ControlIndexEntity,String> implements IControlIndexDao {
|
||||||
|
@Override
|
||||||
|
public List<ControlIndexEntity> queryControlIndexByStatus(ControlIndexEntity controlIndexEntity) {
|
||||||
|
List<ControlIndexEntity> list =(List<ControlIndexEntity>) super.selectList("ControlIndexEntity_list_base", controlIndexEntity);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.hzya.frame.grpU8.nxproof.controlindex.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import com.hzya.frame.web.entity.BaseEntity;
|
||||||
|
|
||||||
|
public class ControlIndexEntity extends BaseEntity {
|
||||||
|
private String YSDH;
|
||||||
|
private String ZBID;
|
||||||
|
private int JE;
|
||||||
|
private String KJND;
|
||||||
|
private String ZT;
|
||||||
|
private String ZCMC;
|
||||||
|
|
||||||
|
private String ZBTBZT;
|
||||||
|
|
||||||
|
public String getZBTBZT() {
|
||||||
|
return ZBTBZT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZBTBZT(String ZBTBZT) {
|
||||||
|
this.ZBTBZT = ZBTBZT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYSDH() {
|
||||||
|
return YSDH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYSDH(String YSDH) {
|
||||||
|
this.YSDH = YSDH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZBID() {
|
||||||
|
return ZBID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZBID(String ZBID) {
|
||||||
|
this.ZBID = ZBID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getJE() {
|
||||||
|
return JE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJE(int JE) {
|
||||||
|
this.JE = JE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKJND() {
|
||||||
|
return KJND;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKJND(String KJND) {
|
||||||
|
this.KJND = KJND;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZT() {
|
||||||
|
return ZT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZT(String ZT) {
|
||||||
|
this.ZT = ZT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZCMC() {
|
||||||
|
return ZCMC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZCMC(String ZCMC) {
|
||||||
|
this.ZCMC = ZCMC;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
<resultMap id="get-ControlIndexEntity-result" type="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
<result property="YSDH" column="YSDH" />
|
||||||
|
<result property="ZBID" column="ZBID" />
|
||||||
|
<result property="JE" column="JE" />
|
||||||
|
<result property="KJND" column="KJND" />
|
||||||
|
<result property="ZT" column="ZT" />
|
||||||
|
<result property="ZCMC" column="ZCMC"/>
|
||||||
|
<result property="ZBTBZT" column="ZBTBZT"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="ControlIndexEntity_Base_Column_List">
|
||||||
|
YSDH,ZBID,JE,KJND,ZT,ZCMC,ZBTBZT
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--根据状态查询数据-->
|
||||||
|
<select id="ControlIndexEntity_list_base" resultMap="get-ControlIndexEntity-result" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
select
|
||||||
|
YSDH,ZBID,JE,KJND,ZT,ZCMC,ZBTBZT
|
||||||
|
from T_ZCCW_CONTROLINDEX where ZT= #{ZT}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 查询最大单据编号+1-->
|
||||||
|
<select id="ControlIndexEntity_list_base_djbhMax" resultMap="get-ControlIndexEntity-result" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
select
|
||||||
|
case when
|
||||||
|
len(isnull(max(right(DJBH,'4')), '0')+1)=2 then
|
||||||
|
concat(#{fph}+'BXD'+#{djdate}+'00',isnull(max(right(DJBH,'4')), '0')+1)
|
||||||
|
when len(isnull(max(right(DJBH,'4')), '0')+1)=1 then
|
||||||
|
concat(#{fph}+'BXD'+#{djdate}+'000',isnull(max(right(DJBH,'4')), '0')+1)
|
||||||
|
when len(isnull(max(right(DJBH,'4')), '0')+1)=3 then
|
||||||
|
concat(#{fph}+'BXD'+#{djdate}+'0',isnull(max(right(DJBH,'4')), '0')+1)
|
||||||
|
else concat(#{fph}+'BXD'+#{djdate}+'',isnull(max(right(DJBH,'4')), '0')+1) end
|
||||||
|
as djbh from T_ZCCW_CONTROLINDEX where GSDM=#{gsdm} and DJBH like '%BXD'+#{djdate}+'%';
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询最大mlid+1-->
|
||||||
|
<!--<select id="ControlIndexEntity_list_base_mlidMax" resultMap="get-ControlIndexEntity-result" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
select
|
||||||
|
case when
|
||||||
|
length(ifnull(max(right(mlid,'4')), '0')+1)=2 then
|
||||||
|
concat(concat(substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,6),'00'),ifnull(max(right(mlid,'4')), '0')+1)
|
||||||
|
when length(ifnull(max(right(mlid,'4')), '0')+1)=1 then
|
||||||
|
concat(concat(substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,6),'000'),ifnull(max(right(mlid,'4')), '0')+1)
|
||||||
|
when length(ifnull(max(right(mlid,'4')), '0')+1)=3 then
|
||||||
|
concat(concat(substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,6),'0'),ifnull(max(right(mlid,'4')), '0')+1)
|
||||||
|
else concat(substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,6),ifnull(max(right(mlid,'4')), '0')+1) end
|
||||||
|
as mlId from T_ZCCW_CONTROLINDEX where GSDM=#{gsdm} and mlid like concat(substring(replace(DATE_FORMAT(now(),'%Y-%m-%d'),'-',''),1,6),'%')
|
||||||
|
</select>-->
|
||||||
|
<select id="ControlIndexEntity_list_base_mlidMax" resultMap="get-ControlIndexEntity-result" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
select (isnull(max(MLID),concat(substring(#{djdate},0,7),0000)) + 1) as mlId
|
||||||
|
from T_ZCCW_CONTROLINDEX where 1=1 and GSDM=#{gsdm} and MLID like concat(substring(#{djdate},0,7),'%')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="ControlIndexEntity_insert" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
insert into T_ZCCW_CONTROLINDEX(
|
||||||
|
<if test="gsdm != null and gsdm !='' "> GSDM, </if>
|
||||||
|
<if test="kjnd != null and kjnd !='' "> KJND, </if>
|
||||||
|
<if test="djlxId != null and djlxId !='' "> DJLXID, </if>
|
||||||
|
<if test="mlId != null and mlId !='' "> MLID, </if>
|
||||||
|
<if test="zt != null and zt !='' "> ZT, </if>
|
||||||
|
<if test="crerdm != null and crerdm !=''"> CRerDM, </if>
|
||||||
|
<if test="crermc != null and crermc !='' "> CRerMC, </if>
|
||||||
|
<if test="crerdate != null and crerdate !='' "> CRerDate, </if>
|
||||||
|
<if test="flowcode != null and flowcode !='' "> FlowCode,</if>
|
||||||
|
<if test="curshjd != null and curshjd !='' "> CurSHJD, </if>
|
||||||
|
<if test="nextshjd != null and nextshjd !='' "> NextSHJD,</if>
|
||||||
|
<if test="shrs != null and shrs !='' "> SHR,</if>
|
||||||
|
<if test="shrId != null and shrId !=''"> SHRID, </if>
|
||||||
|
<if test="shrq != null and shrq !='' "> SHRQ, </if>
|
||||||
|
<if test="jsfs != null and jsfs !='' "> JSFS, </if>
|
||||||
|
<if test="djbh != null and djbh !='' "> DJBH, </if>
|
||||||
|
<if test="djdate != null and djdate !='' "> DJDate, </if>
|
||||||
|
<if test="fjs != null and fjs !='' "> FJS,</if>
|
||||||
|
<if test="bmdm != null and bmdm !='' "> BMDM, </if>
|
||||||
|
<if test="bmmc != null and bmmc !='' "> BMMC,</if>
|
||||||
|
<if test="grdm != null and grdm !='' ">GRDM, </if>
|
||||||
|
<if test="grmc != null and grmc !='' ">GRMC,</if>
|
||||||
|
<if test="tel != null and tel !='' "> TEL, </if>
|
||||||
|
<if test="yjje != null and yjje !='' "> YJJE, </if>
|
||||||
|
<if test="thje != null and thje !='' "> THJE,</if>
|
||||||
|
<if test="blje != null and blje !='' "> BLJE, </if>
|
||||||
|
<if test="je != null and je !='' "> JE, </if>
|
||||||
|
<if test="whje != null and whje !='' "> WHJE,</if>
|
||||||
|
<if test="jedx != null and jedx !='' "> JEDX </if>
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
<if test="gsdm != null and gsdm !='' "> #{gsdm}, </if>
|
||||||
|
<if test="kjnd != null and kjnd !='' "> #{kjnd}, </if>
|
||||||
|
<if test="djlxId != null and djlxId !='' "> ${djlxId}, </if>
|
||||||
|
<if test="mlId != null and mlId !='' "> ${mlId}, </if>
|
||||||
|
<if test="zt != null and zt !='' "> #{zt}, </if>
|
||||||
|
<if test="crerdm != null and crerdm !=''"> #{crerdm}, </if>
|
||||||
|
<if test="crermc != null and crermc !='' "> #{crermc}, </if>
|
||||||
|
<if test="crerdate != null and crerdate !='' "> #{crerdate}, </if>
|
||||||
|
<if test="flowcode != null and flowcode !='' "> #{flowcode},</if>
|
||||||
|
<if test="curshjd != null and curshjd !='' "> ${curshjd}, </if>
|
||||||
|
<if test="nextshjd != null and nextshjd !='' "> ${nextshjd},</if>
|
||||||
|
<if test="shrs != null and shrs !='' "> #{shrs}, </if>
|
||||||
|
<if test="shrId != null and shrId !='' "> #{shrId}, </if>
|
||||||
|
<if test="shrq != null and shrq !='' "> #{shrq}, </if>
|
||||||
|
<if test="jsfs != null and jsfs !='' "> #{jsfs}, </if>
|
||||||
|
<if test="djbh != null and djbh !='' "> #{djbh}, </if>
|
||||||
|
<if test="djdate != null and djdate !='' "> #{djdate}, </if>
|
||||||
|
<if test="fjs != null and fjs !='' "> ${fjs},</if>
|
||||||
|
<if test="bmdm != null and bmdm !='' "> #{bmdm}, </if>
|
||||||
|
<if test="bmmc != null and bmmc !='' "> #{bmmc},</if>
|
||||||
|
<if test="grdm != null and grdm !='' "> #{grdm}, </if>
|
||||||
|
<if test="grmc != null and grmc !='' "> #{grmc},</if>
|
||||||
|
<if test="tel != null and tel !='' "> #{tel}, </if>
|
||||||
|
<if test="yjje != null and yjje !='' "> #{yjje}, </if>
|
||||||
|
<if test="thje != null and thje !='' "> #{thje},</if>
|
||||||
|
<if test="blje != null and blje !='' "> #{blje}, </if>
|
||||||
|
<if test="je != null and je !='' "> #{je}, </if>
|
||||||
|
<if test="whje != null and whje !='' "> #{whje},</if>
|
||||||
|
<if test="jedx != null and jedx !='' "> #{jedx} </if>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="ControlIndexEntity_update" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
update T_ZCCW_CONTROLINDEX set ZBTBZT= #{ZBTBZT}
|
||||||
|
where KJND = #{KJND} and YSDH=#{YSDH} and ZBID=${ZBID}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--删除,用于单据删除时使用-->
|
||||||
|
<delete id="ControlIndexEntity_delete" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
T_ZCCW_CONTROLINDEX
|
||||||
|
WHERE
|
||||||
|
GSDM = #{gsdm}
|
||||||
|
AND KJND = #{kjnd}
|
||||||
|
AND DJLXID = #{djlxId}
|
||||||
|
AND MLID = #{mlId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!--修改 用于单据送审和审批时使用-->
|
||||||
|
<update id="ControlIndexEntity_update_songs" parameterType="com.hzya.frame.online.expense.controlindex.entity.ControlIndexEntity">
|
||||||
|
UPDATE T_ZCCW_CONTROLINDEX
|
||||||
|
SET ZT = #{zt},
|
||||||
|
FlowCode = #{flowcode},
|
||||||
|
CurSHJD =#{curshjd},
|
||||||
|
NextSHJD = #{nextshjd},
|
||||||
|
SHRID =#{shrId},
|
||||||
|
SHR = #{shrs},
|
||||||
|
SHRQ = #{shrq}
|
||||||
|
WHERE
|
||||||
|
gsdm = #{gsdm}
|
||||||
|
AND kjnd = #{kjnd}
|
||||||
|
AND djlxid = #{djlxId}
|
||||||
|
AND mlid = #{mlId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.hzya.frame.grpU8.nxproof.controlindex.service;
|
||||||
|
|
||||||
|
public interface IControlIndexService {
|
||||||
|
|
||||||
|
//查询数据库表状态为1的数据,写入指标执行表
|
||||||
|
String queryControlIndexByStatus(String status);
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.hzya.frame.grpU8.nxproof.controlindex.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.controlindex.entity.ControlIndexEntity;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.controlindex.service.IControlIndexService;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.dao.IGbiZbsyrecDao;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.gbizbsyrec.entity.GbiZbsyrecEntity;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.oerdjml.dao.IOerDjmlDao;
|
||||||
|
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
||||||
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service(value = "controlIndexServiceImpl")
|
||||||
|
public class ControlIndexServiceImpl implements IControlIndexService {
|
||||||
|
|
||||||
|
private static Logger logger= LogManager.getLogger(ControlIndexServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGbiZbsyrecDao gbiZbsyrecDao;
|
||||||
|
@Autowired
|
||||||
|
private IOerDjmlDao oerDjmlDao;
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("sqlSessionMaster")
|
||||||
|
private SqlSession sqlSession;
|
||||||
|
//查询数据库表状态为1的数据,写入指标执行表
|
||||||
|
@Override
|
||||||
|
public String queryControlIndexByStatus(String stauts) {
|
||||||
|
ControlIndexEntity controlIndexEntity=new ControlIndexEntity();
|
||||||
|
List<ControlIndexEntity> controlIndexEntities=null;
|
||||||
|
OerDjmlEntity oerDjmlEntity=new OerDjmlEntity();
|
||||||
|
oerDjmlEntity.setGsdm("001");
|
||||||
|
oerDjmlEntity.setDjlxId("102");
|
||||||
|
switch (stauts){
|
||||||
|
case "1":
|
||||||
|
logger.info("========开始查询数据库表状态为1的数据========");
|
||||||
|
controlIndexEntity.setZT("1");
|
||||||
|
controlIndexEntities= sqlSession.selectList("ControlIndexEntity_list_base", controlIndexEntity);
|
||||||
|
logger.info("根据状态为1查询出来的数据有{}条",controlIndexEntities.size());
|
||||||
|
if(CollUtil.isNotEmpty(controlIndexEntities) && controlIndexEntities.size()>0){
|
||||||
|
for (ControlIndexEntity indexEntity : controlIndexEntities) {
|
||||||
|
logger.info("循环遍历中得验收单号为:{}",indexEntity.getYSDH());
|
||||||
|
if(null == indexEntity.getYSDH() || null ==indexEntity.getZBID()){
|
||||||
|
throw new BaseSystemException("验收单号或者指标id不能为空");
|
||||||
|
}
|
||||||
|
//将查询出来的状态为1的数据写入到指标占用表中
|
||||||
|
GbiZbsyrecEntity gbiZbsyrecEntity=new GbiZbsyrecEntity();
|
||||||
|
gbiZbsyrecEntity.setDjId(indexEntity.getYSDH());//单据id
|
||||||
|
logger.info("开始根据编号查询指标占用表的数据");
|
||||||
|
//根据编号查询指标占用表里面是否存在数据,如果存在,则不新增
|
||||||
|
GbiZbsyrecEntity gbiZbsyrecEntityOne =(GbiZbsyrecEntity) gbiZbsyrecDao.selectOne("GbiZbsyrecEntity_list_base_one", gbiZbsyrecEntity);
|
||||||
|
if(null ==gbiZbsyrecEntityOne || !indexEntity.getYSDH().equals(gbiZbsyrecEntityOne.getDjId())) {
|
||||||
|
logger.info("验收单号:{}在指标占用表中不存在,开始保存到占用表中",indexEntity.getYSDH());
|
||||||
|
try {
|
||||||
|
gbiZbsyrecEntity.setJhId(indexEntity.getZBID());//指标id
|
||||||
|
gbiZbsyrecEntity.setDjje(String.valueOf(indexEntity.getJE()));//金额
|
||||||
|
gbiZbsyrecEntity.setKjnd(indexEntity.getKJND());
|
||||||
|
gbiZbsyrecEntity.setGsdm("001");//公司代码
|
||||||
|
gbiZbsyrecEntity.setModule("OER");//模块
|
||||||
|
gbiZbsyrecEntity.setDjlx("102");//单据类型
|
||||||
|
gbiZbsyrecEntity.setDjflh("148001");//单据分录数
|
||||||
|
gbiZbsyrecEntity.setDjzt(indexEntity.getZT());
|
||||||
|
gbiZbsyrecEntity.setSzfx("1");
|
||||||
|
gbiZbsyrecEntity.setJdzb("0");
|
||||||
|
gbiZbsyrecEntity.setCzlx("0");
|
||||||
|
gbiZbsyrecEntity.setDjflmx(indexEntity.getYSDH());
|
||||||
|
gbiZbsyrecDao.save(gbiZbsyrecEntity);
|
||||||
|
//保存报销单
|
||||||
|
oerDjmlEntity.setDjdate(DateUtil.formatDate(new Date()).replace("-",""));
|
||||||
|
String djbh = oerDjmlDao.getMaxDjbgByGsdmZy(oerDjmlEntity);
|
||||||
|
oerDjmlEntity.setDjbh(djbh);
|
||||||
|
oerDjmlEntity.setMlId(indexEntity.getYSDH());
|
||||||
|
oerDjmlEntity.setKjnd(indexEntity.getKJND());
|
||||||
|
oerDjmlEntity.setZt("1");
|
||||||
|
oerDjmlEntity.setJe(String.valueOf(indexEntity.getJE()));
|
||||||
|
oerDjmlEntity.setGrdm("123456");
|
||||||
|
oerDjmlEntity.setGrmc("占用测试");
|
||||||
|
//oerDjmlEntity.setJedx(AmountConvert.toChinese(String.valueOf(indexEntity.getJE())));
|
||||||
|
OerDjmlEntity save = oerDjmlDao.save(oerDjmlEntity);
|
||||||
|
logger.info("验收单号:{}在指标占用表中占用成功",indexEntity.getYSDH());
|
||||||
|
if(save!=null){
|
||||||
|
//修改T_ZCCW_CONTROLINDEX的指标同步状态为1
|
||||||
|
indexEntity.setZBTBZT("1");
|
||||||
|
logger.info("保存中开始根据验收单号:{},会计年度:{},指标id:{}更新指标同步状态",indexEntity.getYSDH(),indexEntity.getKJND(),indexEntity.getZBID());
|
||||||
|
sqlSession.update("ControlIndexEntity_update",indexEntity);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("指标占用失败:{}",e.getMessage());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.info("验收单号:{}在指标占用表中已经存在,不再保存到占用表中",indexEntity.getYSDH());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.info("========没有查询到状态为1,需要写入指标占用表的数据========");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
logger.info("========开始查询数据库表状态为3的数据========");
|
||||||
|
controlIndexEntity.setZT("3");
|
||||||
|
controlIndexEntities= sqlSession.selectList("ControlIndexEntity_list_base", controlIndexEntity);
|
||||||
|
logger.info("根据状态为3查询出来的数据有{}条",controlIndexEntities.size());
|
||||||
|
if(CollUtil.isNotEmpty(controlIndexEntities) && controlIndexEntities.size()>0){
|
||||||
|
for (ControlIndexEntity indexEntity : controlIndexEntities) {
|
||||||
|
if(null == indexEntity.getYSDH() || null ==indexEntity.getZBID()){
|
||||||
|
throw new BaseSystemException("验收单号或者指标id不能为空");
|
||||||
|
}
|
||||||
|
GbiZbsyrecEntity gbiZbsyrecEntity=new GbiZbsyrecEntity();
|
||||||
|
gbiZbsyrecEntity.setDjId(indexEntity.getYSDH());
|
||||||
|
//根据编号查询指标占用表中是否存在,存在就删除
|
||||||
|
GbiZbsyrecEntity gbiZbsyrecEntityOne =(GbiZbsyrecEntity) gbiZbsyrecDao.selectOne("GbiZbsyrecEntity_list_base_one", gbiZbsyrecEntity);
|
||||||
|
if(null !=gbiZbsyrecEntityOne && indexEntity.getYSDH().equals(gbiZbsyrecEntityOne.getDjId())) {
|
||||||
|
logger.info("验收单号:{}在指标占用表中存在,开始删除指标占用表",indexEntity.getYSDH());
|
||||||
|
try {
|
||||||
|
//根据编号删除指标占用表
|
||||||
|
gbiZbsyrecEntity.setKjnd(indexEntity.getKJND());
|
||||||
|
logger.info("指标占用表中的djid为:{},会计年度为:{}",gbiZbsyrecEntity.getDjId(),gbiZbsyrecEntity.getKjnd());
|
||||||
|
gbiZbsyrecDao.delete("GbiZbsyrecEntity_delete",gbiZbsyrecEntity);
|
||||||
|
//根据编号删除报销单
|
||||||
|
oerDjmlEntity.setKjnd(indexEntity.getKJND());
|
||||||
|
oerDjmlEntity.setMlId(indexEntity.getYSDH());
|
||||||
|
logger.info("报销单中的mlid为:{},会计年度为:{},公司代码为:{},单据类型id为:{}",oerDjmlEntity.getMlId(),oerDjmlEntity.getKjnd(),oerDjmlEntity.getGsdm(),oerDjmlEntity.getDjlxId());
|
||||||
|
int delete = oerDjmlDao.delete("OerDjmlEntity_delete", oerDjmlEntity);
|
||||||
|
logger.info("根据验收单号:{}在指标占用表中已删除",indexEntity.getYSDH());
|
||||||
|
if(delete>0){
|
||||||
|
//修改T_ZCCW_CONTROLINDEX的指标同步状态为1
|
||||||
|
indexEntity.setZBTBZT("1");
|
||||||
|
logger.info("删除中开始根据验收单号:{},会计年度:{},指标id:{}更新指标同步状态",indexEntity.getYSDH(),indexEntity.getKJND(),indexEntity.getZBID());
|
||||||
|
sqlSession.update("ControlIndexEntity_update",indexEntity);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.info("指标删除失败:{}",e.getMessage());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.info("验收单号:{}在指标占用表中不存在",indexEntity.getYSDH());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
logger.info("========没有查询到状态为3,需要删除指标占用表的数据========");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue