业务编号格式

master
shijie 4 years ago
parent d909f94e58
commit c303fef94d
  1. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/mapper/DgApplyAmountInfoMapper.java
  2. 36
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
  3. 11
      dq-financial-guarantee/src/main/resources/mapper/guarantee/DgApplyAmountInfoMapper.xml

@ -29,4 +29,8 @@ public interface DgApplyAmountInfoMapper extends BaseMapper<DgApplyAmountInfo> {
DgApplyAmountInfoResponse selectApplyAmountInfoById(Integer id); DgApplyAmountInfoResponse selectApplyAmountInfoById(Integer id);
List<BusinessApplicationListResponse> selectListByIds(List<String> ids); List<BusinessApplicationListResponse> selectListByIds(List<String> ids);
int selectBusinessTaday(@Param("dateTime") String dateTime);
String selectMaxBusinessTaday(String dateTime);
} }

@ -10,10 +10,7 @@ import com.daqing.financial.guarantee.feign.CrmsFeignService;
import com.daqing.financial.guarantee.feign.HrmsFeignService; import com.daqing.financial.guarantee.feign.HrmsFeignService;
import com.daqing.financial.guarantee.mapper.*; import com.daqing.financial.guarantee.mapper.*;
import com.daqing.financial.guarantee.model.request.BusinessApplicationRequest; import com.daqing.financial.guarantee.model.request.BusinessApplicationRequest;
import com.daqing.financial.guarantee.model.response.BusinessApplicationDetailResponse; import com.daqing.financial.guarantee.model.response.*;
import com.daqing.financial.guarantee.model.response.BusinessApplicationListResponse;
import com.daqing.financial.guarantee.model.response.DgApplyAmountInfoResponse;
import com.daqing.financial.guarantee.model.response.DgEnclosureInfoResponse;
import com.daqing.financial.guarantee.service.IDgApplyAmountInfoService; import com.daqing.financial.guarantee.service.IDgApplyAmountInfoService;
import com.daqing.financial.guarantee.util.ArraysUtil; import com.daqing.financial.guarantee.util.ArraysUtil;
import com.daqing.financial.guarantee.util.AuditProcessUtil; import com.daqing.financial.guarantee.util.AuditProcessUtil;
@ -40,10 +37,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.*;
import java.util.LinkedHashMap;
import java.util.List;
/** /**
* <p> * <p>
@ -125,7 +120,30 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
dgApplyAmountInfo.setDescription(businessApplication.getDescription());//反担保措施描述 dgApplyAmountInfo.setDescription(businessApplication.getDescription());//反担保措施描述
dgApplyAmountInfo.setBusinessType(businessApplication.getBusinessType());//业务类型 dgApplyAmountInfo.setBusinessType(businessApplication.getBusinessType());//业务类型
dgApplyAmountInfo.setCustomerType(businessApplication.getCustomerType());//客户类型 dgApplyAmountInfo.setCustomerType(businessApplication.getCustomerType());//客户类型
dgApplyAmountInfo.setBusinessCode(RandomUtil.getRandomNum(12)); //设置业务编号,查询今天是否申请过业务
String businessCode=null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateTime=sdf.format(new Date());
String timeCode=dateTime.replaceAll("-","");
int count = dgApplyAmountInfoMapper.selectBusinessTaday(dateTime);
if(count ==0){//今天没有申请过业务,所以编号从001开始
if(businessApplication.getBusinessType().equals("融资担保")){//融资业务:RZ-20201231001
businessCode="RZ-"+timeCode+"001";
}else{//非融资业务:FRZ-20201231001
businessCode="FRZ-"+timeCode+"001";
}
}else{
//查询最大业务编号
String code = dgApplyAmountInfoMapper.selectMaxBusinessTaday(dateTime);
int codeNumber = Integer.parseInt(code.substring(code.length() - 3));
String newBusinessCode = String.format("%03d", (codeNumber + 1));
if(businessApplication.getBusinessType().equals("融资担保")){//融资业务:RZ-20201231001
businessCode="RZ-"+timeCode+newBusinessCode;
}else{//非融资业务:FRZ-20201231001
businessCode="FRZ-"+timeCode+newBusinessCode;
}
}
dgApplyAmountInfo.setBusinessCode(businessCode);
dgApplyAmountInfoMapper.insert(dgApplyAmountInfo); dgApplyAmountInfoMapper.insert(dgApplyAmountInfo);

@ -60,4 +60,15 @@
</foreach> </foreach>
</select> </select>
<select id="selectBusinessTaday" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(0) from dg_apply_amount_info where create_time LIKE CONCAT('%',#{dateTime},'%')
</select>
<select id="selectMaxBusinessTaday" parameterType="java.lang.String" resultType="java.lang.String">
select business_code
from dg_apply_amount_info
where create_time LIKE CONCAT('%',#{dateTime},'%')
order by id desc limit 1
</select>
</mapper> </mapper>

Loading…
Cancel
Save