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

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

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

@ -172,4 +172,12 @@
where action not in ( where action not in (
select code from thr_system_bus_api) select code from thr_system_bus_api)
</select> </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> </mapper>

Loading…
Cancel
Save