|
@@ -8,6 +8,7 @@ import com.dayou.enums.MainBusinessEnum;
|
|
|
import com.dayou.enums.TakeNumberEnum;
|
|
|
import com.dayou.exception.ErrorCode;
|
|
|
import com.dayou.mapper.BusinessNumberMapper;
|
|
|
+import com.dayou.mapper.MajorProductionMapper;
|
|
|
import com.dayou.service.IBusinessNumberService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.dayou.utils.DateUtils;
|
|
@@ -41,6 +42,12 @@ public class BusinessNumberServiceImpl extends ServiceImpl<BusinessNumberMapper,
|
|
|
private static DecimalFormat zero3 = new DecimalFormat("000");
|
|
|
|
|
|
private static DecimalFormat zero2 = new DecimalFormat("00");
|
|
|
+ private final MajorProductionMapper majorProductionMapper;
|
|
|
+
|
|
|
+
|
|
|
+ public BusinessNumberServiceImpl(MajorProductionMapper majorProductionMapper) {
|
|
|
+ this.majorProductionMapper = majorProductionMapper;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public synchronized String takeMainNumber(TakeNumberDTO taskRecordDTO) {
|
|
@@ -149,13 +156,14 @@ public class BusinessNumberServiceImpl extends ServiceImpl<BusinessNumberMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public synchronized List<IdNameVO> takeLetterSubNumber(String orderId, TakeNumberEnum takeNumberEnum, String mainNumber,List<IdNameVO> targets) {
|
|
|
+ public synchronized List<IdNameVO> takeLetterSubNumber(String orderId, TakeNumberEnum takeNumberEnum, String mainNumber,List<IdNameVO> targets,Long businessId) {
|
|
|
if (StrUtil.isEmpty(mainNumber)){
|
|
|
mainNumber = takeLetterMainNumber(orderId, takeNumberEnum);
|
|
|
}
|
|
|
return generateSubNumber(mainNumber,targets);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 取项目编号
|
|
|
* 资产项目订单号取号:年份4位 + 月份2位 + 序号3位(当月下单量)
|
|
@@ -189,6 +197,31 @@ public class BusinessNumberServiceImpl extends ServiceImpl<BusinessNumberMapper,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 在一个订单中按顺序取复评函号
|
|
|
+ * @param businessId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public synchronized String takeLetterByOrder(Long businessId,String orderId,TakeNumberEnum takeNumberEnum) {
|
|
|
+ String maxLetterNo = majorProductionMapper.findMaxLetterNoByBusinessId(businessId);
|
|
|
+ if (StrUtil.isEmpty(maxLetterNo)){
|
|
|
+ if (takeNumberEnum.equals(TakeNumberEnum.LAND_NUMBER)){
|
|
|
+ return new StringBuffer(LETTER_LAND_FORMAT_X.replace(NUMBER, orderId)).append(BRI).append("1").append(HAO).toString();
|
|
|
+ }else{
|
|
|
+ return new StringBuffer(LETTER_REALTY_FORMAT_X.replace(NUMBER, orderId)).append(BRI).append("1").append(HAO).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ String[] split = maxLetterNo.split(BRI);
|
|
|
+ String mainNumber = split[0];
|
|
|
+ Integer index = Integer.valueOf(split[1].replace(HAO,""));
|
|
|
+ StringBuilder subNumber = new StringBuilder(mainNumber);
|
|
|
+ return subNumber.append(BRI + (index + 1) + HAO).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 根据主号生成字号
|
|
|
* @param mainNumber
|
|
|
* @param targets
|