1.调整单据类型接口

master
x_z 2 years ago
parent 7f5c21cc64
commit 25c1e6e0b1

@ -5,6 +5,7 @@ import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
import com.glxp.api.req.basic.FilterBussinessTypeRequest;
import com.glxp.api.res.basic.BasicBussinessTypeResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -38,8 +39,16 @@ public interface BasicBussinessTypeDao extends BaseMapper<BasicBussinessTypeEnti
/**
*
*
* @return
*/
List<BasicBussinessTypeEntity> selectForThirdSys();
/**
*
*
* @param mainAction
* @return
*/
List<BasicBussinessTypeEntity> selectCandidateBusType(@Param("mainAction") String mainAction);
}

@ -339,5 +339,9 @@ public class BasicBussinessTypeEntity {
@TableField(value = "createTime")
private Date createTime;
/**
* 使Mybatis Plus
*/
@TableField(exist = false)
private boolean select;
}

@ -44,6 +44,7 @@ public class BasicBussinessTypeServiceImpl implements IBasicBussinessTypeService
public boolean insertBussinessType(BasicBussinessTypeEntity bussinessTypeEntity) {
//设置创建时间和更新时间数据
setUpdateInfo(bussinessTypeEntity);
setSupplementOrderType(bussinessTypeEntity);
return basicBussinessTypeDao.insert(bussinessTypeEntity) != 0;
}
@ -51,23 +52,44 @@ public class BasicBussinessTypeServiceImpl implements IBasicBussinessTypeService
public boolean updateBussinessType(BasicBussinessTypeEntity basicBussinessTypeEntity) {
//设置更新时间等数据
setUpdateInfo(basicBussinessTypeEntity);
//更新时处理补单类型逻辑
if (StrUtil.isBlank(basicBussinessTypeEntity.getSupplementOrderType())) {
//查询当前单据类型完整数据
BasicBussinessTypeEntity currentBusType = findByAction(basicBussinessTypeEntity.getAction());
//查询补单类型的数据
BasicBussinessTypeEntity supplementType = findByAction(currentBusType.getSupplementOrderType());
if (null != supplementType) {
supplementType.setSupplementOrderType("");
basicBussinessTypeDao.updateById(supplementType);
setSupplementOrderType(basicBussinessTypeEntity);
return basicBussinessTypeDao.updateById(basicBussinessTypeEntity) != 0;
}
/**
*
*
* @param basicBussinessTypeEntity
*/
private void setSupplementOrderType(BasicBussinessTypeEntity basicBussinessTypeEntity) {
if (null == basicBussinessTypeEntity.getId()) {
//处理添加新单据类型时的平衡补单逻辑
if (StrUtil.isNotBlank(basicBussinessTypeEntity.getSupplementOrderType())) {
//查询平衡补单的单据类型数据是否存在
BasicBussinessTypeEntity supplementType = findByAction(basicBussinessTypeEntity.getSupplementOrderType());
if (null != supplementType) {
supplementType.setSupplementOrderType(basicBussinessTypeEntity.getAction());
basicBussinessTypeDao.updateById(supplementType);
}
}
} else {
//补单类型不为空,查询出补单类型数据,将对向单据设置为当前单据类型的编码
BasicBussinessTypeEntity supplementType = findByAction(basicBussinessTypeEntity.getSupplementOrderType());
supplementType.setSupplementOrderType(basicBussinessTypeEntity.getAction());
basicBussinessTypeDao.updateById(supplementType);
//更新时处理补单类型逻辑
if (StrUtil.isBlank(basicBussinessTypeEntity.getSupplementOrderType())) {
//查询当前单据类型完整数据
BasicBussinessTypeEntity currentBusType = findByAction(basicBussinessTypeEntity.getAction());
//查询补单类型的数据
BasicBussinessTypeEntity supplementType = findByAction(currentBusType.getSupplementOrderType());
if (null != supplementType) {
supplementType.setSupplementOrderType("");
basicBussinessTypeDao.updateById(supplementType);
}
} else {
//补单类型不为空,查询出补单类型数据,将对向单据设置为当前单据类型的编码
BasicBussinessTypeEntity supplementType = findByAction(basicBussinessTypeEntity.getSupplementOrderType());
supplementType.setSupplementOrderType(basicBussinessTypeEntity.getAction());
basicBussinessTypeDao.updateById(supplementType);
}
}
return basicBussinessTypeDao.updateById(basicBussinessTypeEntity) != 0;
}
@Override
@ -110,12 +132,7 @@ public class BasicBussinessTypeServiceImpl implements IBasicBussinessTypeService
} else {
mainAction = ConstantType.TYPE_OUT;
}
QueryWrapper<BasicBussinessTypeEntity> query = new QueryWrapper<>();
query.select("name", "action")
.eq("mainAction", mainAction)
.eq("corpType", 1)
.isNull("supplementOrderType").or().eq("supplementOrderType", "");
return basicBussinessTypeDao.selectList(query);
return basicBussinessTypeDao.selectCandidateBusType(mainAction);
}
@Override

@ -172,4 +172,12 @@
where action not in (
select code from thr_system_bus_api)
</select>
<select id="selectCandidateBusType" resultType="com.glxp.api.entity.basic.BasicBussinessTypeEntity">
select name, action
from basic_bussiness_type
where mainAction = #{mainAction}
and corpType = 1
and (supplementOrderType is null or supplementOrderType = '')
</select>
</mapper>

Loading…
Cancel
Save