skyouc
6 天以前 de010011aa92785f04b6f0345411c584d49a92d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.vincent.rsf.server.system.utils;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.framework.common.SpringUtils;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.utils.CommonUtil;
import com.vincent.rsf.server.system.entity.Fields;
import com.vincent.rsf.server.system.entity.FieldsItem;
import com.vincent.rsf.server.system.service.FieldsItemService;
import com.vincent.rsf.server.system.service.FieldsService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.*;
 
/**
 * @author Ryan
 * @version 1.0
 * @title ExtendFieldsUtils
 * @description
 * @create 2025/3/15 12:40
 */
public class ExtendFieldsUtils {
 
//    /**
//     * @author Ryan
//     * @description 明细单据保存扩展字段
//     * @param
//     * @return
//     * @time 2025/3/15 13:36
//     */
//    @Transactional(rollbackFor = Exception.class)
//    public static Boolean saveFields(Map<String, Object> params, String uuid) throws Exception{
//        FieldsService fieldsService = SpringUtils.getBean(FieldsService.class);
//        List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>()
//                .eq(Fields::getStatus, 1)
//                .eq(Fields::getFlagEnable, 1));
//        List<FieldsItem> fieldsItems = new ArrayList<>();
//        if (!fields.isEmpty()) {
//            for (Fields obj : fields) {
//                if (!Objects.isNull(params.get(obj.getFields())) && StringUtils.isNotBlank(params.get(obj.getFields()).toString())) {
//                    FieldsItem item = new FieldsItem();
//                    item.setUuid(uuid)
//                            .setValue(params.get(obj.getFields()).toString())
//                            .setMatnrId(Long.parseLong(params.get("matnrId").toString()))
//                            .setFieldsId(obj.getId());
//                    fieldsItems.add(item);
//                }
//            }
//            if (fieldsItems.isEmpty()) {
//                return false;
//            }
//            FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class);
//            if (!fieldsItemService.saveBatch(fieldsItems)) {
//                throw new CoolException("扩展字段保存失败!!");
//            }
//            return true;
//        }
//        return false;
//    }
 
}