最大编号生成规则调整
This commit is contained in:
parent
fd6ec2e156
commit
0054805d6b
|
@ -22,7 +22,7 @@ public class OerDjmlDaoImpl extends MybatisGenericDao<OerDjmlEntity,String> impl
|
||||||
@DS("#oerDjmlEntity.dataSourceCode")
|
@DS("#oerDjmlEntity.dataSourceCode")
|
||||||
@Override
|
@Override
|
||||||
public String getMaxDjbgByGsdm(OerDjmlEntity oerDjmlEntity) {
|
public String getMaxDjbgByGsdm(OerDjmlEntity oerDjmlEntity) {
|
||||||
oerDjmlEntity = (OerDjmlEntity) super.selectOne("OerDjmlEntity_list_base_djbhMax",oerDjmlEntity);
|
oerDjmlEntity = (OerDjmlEntity) super.selectOne("OerDjmlEntity_list_base_djbhMax_wx",oerDjmlEntity);
|
||||||
if(null == oerDjmlEntity){
|
if(null == oerDjmlEntity){
|
||||||
throw new RuntimeException("查询最大单据号错误!请联系管理员");
|
throw new RuntimeException("查询最大单据号错误!请联系管理员");
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -71,6 +71,20 @@ GSDM,KJND,mlId
|
||||||
as djbh from OER_DJML where GSDM=#{gsdm} and DJBH like '%ZYBXD'+#{djdate}+'%';
|
as djbh from OER_DJML where GSDM=#{gsdm} and DJBH like '%ZYBXD'+#{djdate}+'%';
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询最大单据编号+1 指标占用时候使用-->
|
||||||
|
<select id="OerDjmlEntity_list_base_djbhMax_wx" resultMap="get-OerDjmlEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity">
|
||||||
|
select
|
||||||
|
case when
|
||||||
|
len(isnull(max(right(DJBH,'4')), '0')+1)=2 then
|
||||||
|
concat('BXD'+#{djdate}+'00',isnull(max(right(DJBH,'4')), '0')+1)
|
||||||
|
when len(isnull(max(right(DJBH,'4')), '0')+1)=1 then
|
||||||
|
concat('BXD'+#{djdate}+'000',isnull(max(right(DJBH,'4')), '0')+1)
|
||||||
|
when len(isnull(max(right(DJBH,'4')), '0')+1)=3 then
|
||||||
|
concat('BXD'+#{djdate}+'0',isnull(max(right(DJBH,'4')), '0')+1)
|
||||||
|
else concat('BXD'+#{djdate}+'',isnull(max(right(DJBH,'4')), '0')+1) end
|
||||||
|
as djbh from OER_DJML where GSDM=#{gsdm} and DJBH like '%ZYBXD'+#{djdate}+'%';
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 查询最大mlid+1-->
|
<!-- 查询最大mlid+1-->
|
||||||
<!--<select id="OerDjmlEntity_list_base_mlidMax" resultMap="get-OerDjmlEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity">
|
<!--<select id="OerDjmlEntity_list_base_mlidMax" resultMap="get-OerDjmlEntity-result" parameterType="com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity">
|
||||||
select
|
select
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
import com.hzya.frame.grpU8.nxproof.oerdjml.entity.OerDjmlEntity;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:hecan
|
* @Author:hecan
|
||||||
|
@ -34,5 +35,5 @@ public interface IOerDjmlService {
|
||||||
* @return java.lang.Object
|
* @return java.lang.Object
|
||||||
**/
|
**/
|
||||||
@DSTransactional()
|
@DSTransactional()
|
||||||
Object handleOerDjml(JSONObject jsonObject);
|
JsonResultEntity handleOerDjml(JSONObject jsonObject);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.hzya.frame.grpU8.nxproof.oerdjml.service.impl;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
@ -35,6 +36,7 @@ import com.hzya.frame.grpU8.nxproof.pubobjflow.entity.PubObjFlowEntity;
|
||||||
import com.hzya.frame.mdm.entity.MdmDto;
|
import com.hzya.frame.mdm.entity.MdmDto;
|
||||||
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity;
|
||||||
import com.hzya.frame.web.entity.BaseResult;
|
import com.hzya.frame.web.entity.BaseResult;
|
||||||
|
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||||
import com.hzya.frame.web.exception.BaseSystemException;
|
import com.hzya.frame.web.exception.BaseSystemException;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
@ -740,7 +742,7 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
||||||
* @Date 9:54 上午 2024/8/14
|
* @Date 9:54 上午 2024/8/14
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public Object handleOerDjml(JSONObject jsonObject) {
|
public JsonResultEntity handleOerDjml(JSONObject jsonObject) {
|
||||||
OerDjmlEntity entity = getData("jsonStr", jsonObject, OerDjmlEntity.class);
|
OerDjmlEntity entity = getData("jsonStr", jsonObject, OerDjmlEntity.class);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
return BaseResult.getFailureMessageEntity("参数不允许为空");
|
||||||
|
@ -1143,11 +1145,10 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
||||||
* @param entity
|
* @param entity
|
||||||
* @return java.lang.Object
|
* @return java.lang.Object
|
||||||
**/
|
**/
|
||||||
private Object saveOrUpdateData(String dataSourceCode,OerDjmlEntity entity) {
|
private JsonResultEntity saveOrUpdateData(String dataSourceCode, OerDjmlEntity entity) {
|
||||||
//获取主表数据
|
//获取主表数据
|
||||||
logger.info("开始处理数据:------>");
|
logger.info("开始处理数据:------>");
|
||||||
String gsdm = entity.getGsdm();
|
String gsdm = entity.getGsdm();
|
||||||
logger.info("根据公司代码查询最大单据编号,公司代码:------>"+gsdm);
|
|
||||||
if(StrUtil.isEmpty(gsdm)){
|
if(StrUtil.isEmpty(gsdm)){
|
||||||
return BaseResult.getFailureMessageEntity("公司代码不能为空!请排查参数gsdm");
|
return BaseResult.getFailureMessageEntity("公司代码不能为空!请排查参数gsdm");
|
||||||
}
|
}
|
||||||
|
@ -1163,26 +1164,41 @@ public class OerDjmlServiceImpl implements IOerDjmlService {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
String maxDjbh = null;
|
String maxDjbh = null;
|
||||||
String maxMlId = null;
|
String maxMlId = null;
|
||||||
if (entity.getDjbh() == null || "".equals(entity.getDjbh())) {
|
// if (entity.getDjbh() == null || "".equals(entity.getDjbh())) {
|
||||||
OerDjmlEntity oerDjmlEntity = new OerDjmlEntity();
|
// OerDjmlEntity oerDjmlEntity = new OerDjmlEntity();
|
||||||
oerDjmlEntity.setDataSourceCode(dataSourceCode);
|
// oerDjmlEntity.setDataSourceCode(dataSourceCode);
|
||||||
oerDjmlEntity.setGsdm(gsdm);
|
// oerDjmlEntity.setGsdm(gsdm);
|
||||||
oerDjmlEntity.setDjdate(entity.getDjdate());
|
// oerDjmlEntity.setDjdate(entity.getDjdate());
|
||||||
oerDjmlEntity.setFph(nullConvert(entity.getFph()));
|
// oerDjmlEntity.setFph(nullConvert(entity.getFph()));
|
||||||
maxDjbh = iOerDjmlDao.getMaxDjbgByGsdm(oerDjmlEntity);
|
// maxDjbh = iOerDjmlDao.getMaxDjbgByGsdm(oerDjmlEntity);
|
||||||
entity.setDjbh(maxDjbh);
|
// entity.setDjbh(maxDjbh);
|
||||||
}else {
|
// }else {
|
||||||
|
// OerDjmlEntity oerDjmlAllEntity = new OerDjmlEntity();
|
||||||
|
// oerDjmlAllEntity.setDataSourceCode(dataSourceCode);
|
||||||
|
// oerDjmlAllEntity.setDjbh(entity.getDjbh());
|
||||||
|
// List<OerDjmlEntity> oerDjmlAllEntities = iOerDjmlDao.queryOerDjml(oerDjmlAllEntity);
|
||||||
|
// if(oerDjmlAllEntities != null && oerDjmlAllEntities.size() == 1){
|
||||||
|
// flag = true;
|
||||||
|
// maxDjbh = oerDjmlAllEntities.get(0).getDjbh();
|
||||||
|
// maxMlId = oerDjmlAllEntities.get(0).getMlId();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//查询最大单据号
|
||||||
|
OerDjmlEntity maxDjml = new OerDjmlEntity();
|
||||||
|
maxDjml.setDataSourceCode(dataSourceCode);
|
||||||
|
maxDjml.setGsdm(gsdm);
|
||||||
|
maxDjml.setDjdate(entity.getDjdate());
|
||||||
|
maxDjbh = iOerDjmlDao.getMaxDjbgByGsdm(maxDjml);
|
||||||
|
Assert.notEmpty(maxDjbh,"生成单号出错");
|
||||||
OerDjmlEntity oerDjmlAllEntity = new OerDjmlEntity();
|
OerDjmlEntity oerDjmlAllEntity = new OerDjmlEntity();
|
||||||
oerDjmlAllEntity.setDataSourceCode(dataSourceCode);
|
oerDjmlAllEntity.setDataSourceCode(dataSourceCode);
|
||||||
oerDjmlAllEntity.setDjbh(entity.getDjbh());
|
oerDjmlAllEntity.setDjbh(maxDjbh);
|
||||||
List<OerDjmlEntity> oerDjmlAllEntities = iOerDjmlDao.queryOerDjml(oerDjmlAllEntity);
|
List<OerDjmlEntity> oerDjmlAllEntities = iOerDjmlDao.queryOerDjml(oerDjmlAllEntity);
|
||||||
if(oerDjmlAllEntities != null && oerDjmlAllEntities.size() == 1){
|
if(oerDjmlAllEntities != null && oerDjmlAllEntities.size() == 1){
|
||||||
flag = true;
|
flag = true;
|
||||||
maxDjbh = oerDjmlAllEntities.get(0).getDjbh();
|
maxDjbh = oerDjmlAllEntities.get(0).getDjbh();
|
||||||
maxMlId = oerDjmlAllEntities.get(0).getMlId();
|
maxMlId = oerDjmlAllEntities.get(0).getMlId();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(!flag){
|
if(!flag){
|
||||||
//logger.info("获取最大单据编号");
|
//logger.info("获取最大单据编号");
|
||||||
|
|
Loading…
Reference in New Issue