提交 | 用户 | 时间
|
0255ea
|
1 |
package com.iailab.module.model.mpk.service.impl; |
D |
2 |
|
|
3 |
import com.iailab.framework.common.service.impl.BaseServiceImpl; |
587b43
|
4 |
import com.iailab.framework.common.util.object.ConvertUtils; |
0425a3
|
5 |
import com.iailab.module.model.mpk.common.MdkConstant; |
0255ea
|
6 |
import com.iailab.module.model.mpk.dao.MethodSettingDao; |
587b43
|
7 |
import com.iailab.module.model.mpk.dto.MethodSettingDTO; |
0255ea
|
8 |
import com.iailab.module.model.mpk.entity.MethodSettingEntity; |
D |
9 |
import com.iailab.module.model.mpk.service.MethodSettingService; |
587b43
|
10 |
import com.iailab.module.model.mpk.service.SettingSelectService; |
0255ea
|
11 |
import lombok.extern.slf4j.Slf4j; |
D |
12 |
import org.apache.commons.lang3.StringUtils; |
587b43
|
13 |
import org.springframework.beans.factory.annotation.Autowired; |
0255ea
|
14 |
import org.springframework.stereotype.Service; |
587b43
|
15 |
import org.springframework.util.CollectionUtils; |
0255ea
|
16 |
|
587b43
|
17 |
import java.util.List; |
D |
18 |
import java.util.UUID; |
0255ea
|
19 |
|
D |
20 |
/** |
|
21 |
* @description: |
|
22 |
* @author: dzd |
|
23 |
* @date: 2024/9/14 15:12 |
|
24 |
**/ |
|
25 |
@Slf4j |
|
26 |
@Service |
|
27 |
public class MethodSettingServiceImpl extends BaseServiceImpl<MethodSettingDao, MethodSettingEntity> implements MethodSettingService { |
587b43
|
28 |
@Autowired |
D |
29 |
private SettingSelectService settingSelectService; |
|
30 |
|
|
31 |
@Override |
|
32 |
public void insertList(List<MethodSettingDTO> list, String MethodId) { |
|
33 |
List<MethodSettingEntity> entityList = ConvertUtils.sourceToTarget(list, MethodSettingEntity.class); |
0425a3
|
34 |
// pyFile排第一 |
D |
35 |
entityList.sort((e1,e2) -> e1.getSettingKey().equals(MdkConstant.PY_FILE_KEY) ? -1 : e2.getSettingKey().equals(MdkConstant.PY_FILE_KEY) ? 1 : 0); |
587b43
|
36 |
for(int i = 0; i < entityList.size(); i++){ |
D |
37 |
MethodSettingEntity entity = entityList.get(i); |
8a74e9
|
38 |
if (StringUtils.isNotBlank(entity.getValue())){ |
潘 |
39 |
// 去掉空格 |
fcb855
|
40 |
entity.setValue(entity.getValue().trim().replaceAll("\\s+", "")); |
8a74e9
|
41 |
} |
587b43
|
42 |
entity.setId(UUID.randomUUID().toString()); |
D |
43 |
entity.setMethodId(MethodId); |
|
44 |
entity.setSort(i); |
|
45 |
baseDao.insert(entity); |
|
46 |
if (!CollectionUtils.isEmpty(list.get(i).getSettingSelects())) { |
|
47 |
settingSelectService.insertList(list.get(i).getSettingSelects(), entity.getId()); |
|
48 |
} |
|
49 |
} |
|
50 |
} |
0255ea
|
51 |
} |