Commit bac1ffea authored by wangqiang's avatar wangqiang

季报自定义编码规则

parent 003f75ad
package com.yonde.dcs.plan.core.encode;
import com.yonde.dcs.plan.common.utils.SearchUtil;
import com.yonde.dcs.plan.common.vo.ExtQuarterlyReportVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import com.yonde.dcs.plan.core.service.ExtQuarterlyReportService;
import com.yonde.dcs.plan.core.service.ExtSupplierManageService;
import com.yonde.dex.basedata.data.search.SearchItem;
import com.yonde.dex.basedata.entity.data.DxPageImpl;
import com.yonde.dex.basedata.exception.DxBusinessException;
import com.yonde.dex.initialization.encoder.CustomizeEncode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.Year;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 工艺规程自定义编码规则
*/
@Slf4j
@Component
public class QuarterlyReportEncode implements CustomizeEncode<ExtQuarterlyReportVO> {
@Autowired
private ExtQuarterlyReportService extQuarterlyReportService;
@Override
public synchronized String generateEncode(ExtQuarterlyReportVO extQuarterlyReportVO) {
// 季报文件编码格式:DWD-XMB-JD-年月-02-1/2
String code = "DWD-XMB-JD-年月-02-"+extQuarterlyReportVO.getQuarterlyReportType();
String replace = extQuarterlyReportVO.getQuarterlyReportTime().toString().replace("-", "");
String yearMonth = replace.substring(0,6);
code = code.replace("年月",yearMonth);
log.info("Quarterly Report Generate Encode.code={}", code);
List content = extQuarterlyReportService.findRecursion(
SearchUtil.buildQuery("fileNumber", SearchItem.Operator.EQ, code)).getContent();
if(ObjectUtils.isNotEmpty(content) && content.size() > 0){
throw new DxBusinessException("500","文件编码:"+code+"已存在");
}
return code;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment