|
@ -0,0 +1,45 @@
|
|
|
package com.yihu.wlyy.figure.label.convert;
|
|
|
|
|
|
import com.yihu.figure_label.entity.FLlabelDict;
|
|
|
import com.yihu.wlyy.figure.label.model.DataModel;
|
|
|
import com.yihu.wlyy.figure.label.model.SaveModel;
|
|
|
import com.yihu.wlyy.figure.label.util.ConstantUtil;
|
|
|
import com.yihu.wlyy.figure.label.util.IdCardUtil;
|
|
|
import com.yihu.wlyy.figure.label.util.MakeModelIDUtil;
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
@Component
|
|
|
public class SignIsOnlineConvert implements Convert {
|
|
|
|
|
|
@Override
|
|
|
public List<SaveModel> convert(List<DataModel> models,List<FLlabelDict> flLabelDictList) {
|
|
|
List<SaveModel> saveModels = new ArrayList<>();
|
|
|
if(CollectionUtils.isEmpty(flLabelDictList)){
|
|
|
return saveModels;
|
|
|
}
|
|
|
FLlabelDict one = flLabelDictList.get(0);
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
flLabelDictList.forEach(
|
|
|
fLlabelDict -> {
|
|
|
map.put(fLlabelDict.getLabelCode(),fLlabelDict.getLabelName());
|
|
|
}
|
|
|
);
|
|
|
models.forEach(
|
|
|
model -> {
|
|
|
SaveModel saveModel = new SaveModel();
|
|
|
saveModel.setModelId(MakeModelIDUtil.makeModelID(model,""));
|
|
|
saveModel.setIdcard(model.getIdcard());
|
|
|
saveModel.setLabelType(one.getParentCode());
|
|
|
saveModel.setLabelCode(model.getLabelCode());
|
|
|
saveModel.setLabeName(map.get(model.getLabelCode()));
|
|
|
saveModel.setCreateTime(DateFormatUtils.format(new Date(), ConstantUtil.date_format));
|
|
|
saveModels.add(saveModel);
|
|
|
}
|
|
|
);
|
|
|
return saveModels;
|
|
|
}
|
|
|
}
|