|
|
@@ -24,6 +24,7 @@ import com.xjrsoft.module.material.vo.MaterialTypeVo;
|
|
|
import com.xjrsoft.module.system.entity.File;
|
|
|
import com.xjrsoft.module.system.service.IFileService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -188,6 +189,45 @@ public class MaterialTypeServiceImpl extends MPJBaseServiceImpl<MaterialTypeMapp
|
|
|
return materialTypeVo;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<MaterialTypeVo> listMaterialTypeVo() {
|
|
|
+ List<MaterialTypeVo> pageOutput = this.selectJoinList(MaterialTypeVo.class, new MPJLambdaWrapper<MaterialType>()
|
|
|
+ .disableSubLogicDel()
|
|
|
+ //.eq(MaterialTypeAssign::getUserId, StpUtil.getLoginIdAsLong())
|
|
|
+ .select(MaterialType::getId)
|
|
|
+ .select(MaterialType.class,x -> VoToColumnUtil.fieldsToColumns(MaterialTypeVo.class).contains(x.getProperty()))
|
|
|
+ //.innerJoin(MaterialTypeAssign.class, MaterialTypeAssign::getMaterialTypeId, MaterialType::getId)
|
|
|
+ );
|
|
|
+
|
|
|
+ for(MaterialTypeVo materialTypeVo : pageOutput){
|
|
|
+ String materialCategoryStr = materialTypeVo.getMaterialCategory();
|
|
|
+ String[] materialCategoryStrArr = materialCategoryStr.split(",");
|
|
|
+
|
|
|
+ for (String category : materialCategoryStrArr) {
|
|
|
+ if (category != null) {
|
|
|
+ String categoryValue = MaterialCategoryEnum.getValue(category);
|
|
|
+ if (categoryValue != null) {
|
|
|
+ if (materialTypeVo.getMaterialCategoryCn() != null && materialTypeVo.getMaterialCategoryCn().length() > 0) {
|
|
|
+ materialTypeVo.setMaterialCategoryCn(materialTypeVo.getMaterialCategoryCn() + "," + categoryValue);
|
|
|
+ } else {
|
|
|
+ materialTypeVo.setMaterialCategoryCn(categoryValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ handleFileAndTemplate(materialTypeVo, category);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return pageOutput;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleFileAndTemplate(MaterialTypeVo materialTypeVo, String category) {
|
|
|
+ MaterialTypePageVo materialTypePageVo = new MaterialTypePageVo();
|
|
|
+ BeanUtils.copyProperties(materialTypeVo, materialTypePageVo);
|
|
|
+ handleFileAndTemplate(materialTypePageVo, category);
|
|
|
+ BeanUtils.copyProperties(materialTypePageVo, materialTypeVo);
|
|
|
+ }
|
|
|
+
|
|
|
private void handleFileAndTemplate(MaterialTypePageVo materialTypePageVo, String category) {
|
|
|
if (MaterialCategoryEnum.MT0001.getCode().equals(category) && materialTypePageVo.getFolderId() != null) {
|
|
|
List<File> files = getFileListByFolderId(materialTypePageVo.getFolderId());
|