|
@@ -27,6 +27,7 @@ import net.lingala.zip4j.core.ZipFile;
|
|
|
import net.lingala.zip4j.exception.ZipException;
|
|
|
import net.lingala.zip4j.model.ZipParameters;
|
|
|
import net.lingala.zip4j.util.Zip4jConstants;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.fileupload.FileItem;
|
|
|
import org.apache.commons.fileupload.FileItemFactory;
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
|
@@ -103,6 +104,9 @@ public class GenerateCodeServiceImpl implements GenerateCodeService {
|
|
|
@Value("${qms.encode.key}")
|
|
|
private String encodeKey;
|
|
|
|
|
|
+ @Value("${qms.route.url}")
|
|
|
+ private String qmsRouteUrl;
|
|
|
+
|
|
|
/** 允许单个码生成重复的次数 */
|
|
|
private static final int REPEAT_BUILD_CODE_TIMES = 10;
|
|
|
|
|
@@ -504,6 +508,15 @@ public class GenerateCodeServiceImpl implements GenerateCodeService {
|
|
|
List<QrRepertoryColumnVO> qrRepertoryColumnList = qrRepertory.getQrRepertoryColumnList();
|
|
|
List<String> columnNameList = new ArrayList<>();
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
+ //文件是否需要输出系统url(只有当码库只有一列)
|
|
|
+ boolean isSystemUrl = false;
|
|
|
+ if(CollectionUtils.isNotEmpty(qrRepertoryColumnList) && qrRepertoryColumnList.size()==1){
|
|
|
+ QrRepertoryColumnVO qrRepertoryColumnVO = qrRepertoryColumnList.get(0);
|
|
|
+ isSystemUrl = QrFormatUrlEnum.SYSTEM_URL.is(qrRepertoryColumnVO.getUrlType());
|
|
|
+ }
|
|
|
+ Map<Long, Integer> colUrlTypeMap = qrRepertoryColumnList.stream().collect(Collectors.toMap(QrRepertoryColumnVO::getId, QrRepertoryColumnVO::getUrlType));
|
|
|
+
|
|
|
+
|
|
|
// 第一行为每列的名称,用“,”分隔
|
|
|
for(QrRepertoryColumnVO colVO:qrRepertoryColumnList){
|
|
|
int splitNum = splitCache.containsKey(colVO.getId()) ? splitCache.get(colVO.getId()).getSplitNum() : 0;
|
|
@@ -537,10 +550,15 @@ public class GenerateCodeServiceImpl implements GenerateCodeService {
|
|
|
codeTextList.add(String.valueOf(chars));
|
|
|
}
|
|
|
} else {
|
|
|
+ //如果需要系统url则拼上(有拆分的列就不给url了,没有意义)
|
|
|
+ if(QrFormatUrlEnum.SYSTEM_URL.is(colUrlTypeMap.get(qrInnerData.getQrRepertoryColumnId()))){
|
|
|
+ code = String.format("%s/%s",qmsRouteUrl,code);
|
|
|
+ }
|
|
|
codeTextList.add(code);
|
|
|
}
|
|
|
}
|
|
|
String innerData = String.join(",",codeTextList);
|
|
|
+ //拼上码
|
|
|
content.append(innerData).append("\r\n");
|
|
|
}
|
|
|
//如果文件不存在,创建一个文件
|