分组
This commit is contained in:
parent
6dc21982d9
commit
9ddba6243d
@ -22,6 +22,7 @@ import com.xinelu.manage.vo.labelfieldcontent.LabelField;
|
||||
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldContentVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -30,6 +31,7 @@ import java.lang.reflect.Field;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -249,8 +251,17 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
List<GroupingValue> groupingValues = new ArrayList<>();
|
||||
for (List<GroupingValue> groupingValue : labelField.getGroupingValues()) {
|
||||
groupingValues.addAll(groupingValue);
|
||||
try {
|
||||
for (List<GroupingValue> groupingValue : labelField.getGroupingValues()) {
|
||||
if (StringUtils.isBlank(groupingValue.get(0).getPortraitSn())) {
|
||||
String portraitSn = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
|
||||
groupingValue.forEach(item -> item.setPortraitSn(portraitSn));
|
||||
}
|
||||
groupingValues.addAll(groupingValue);
|
||||
TimeUnit.MILLISECONDS.sleep(10);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
List<GroupingValue> updateGroupingValues = new ArrayList<>();
|
||||
List<GroupingValue> insertGroupingValues = new ArrayList<>();
|
||||
@ -267,16 +278,24 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
|
||||
labelFieldContentMapper.deleteLabelFieldContentByIds(subtractLabelFieldContentIds.toArray(new Long[0]));
|
||||
}
|
||||
for (GroupingValue groupingValue : groupingValues) {
|
||||
groupingValue.setFieldId(groupingValue.getLabelFieldInfoId());
|
||||
if (Objects.isNull(groupingValue.getLabelFieldContentId())) {
|
||||
groupingValue.setPortraitSn(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
|
||||
groupingValue.setCreateBy(SecurityUtils.getUsername());
|
||||
groupingValue.setCreateTime(LocalDateTime.now());
|
||||
insertGroupingValues.add(groupingValue);
|
||||
}
|
||||
if (Objects.nonNull(groupingValue.getLabelFieldContentId())) {
|
||||
groupingValue.setCreateTime(LocalDateTime.now());
|
||||
groupingValue.setCreateBy(SecurityUtils.getUsername());
|
||||
updateGroupingValues.add(groupingValue);
|
||||
}
|
||||
}
|
||||
int insert = labelFieldContentMapper.insertLabelFieldContentList(insertGroupingValues);
|
||||
int update = labelFieldContentMapper.updateContentRemarkLabelFieldContentList(updateGroupingValues);
|
||||
if (CollectionUtils.isNotEmpty(insertGroupingValues)) {
|
||||
int insert = labelFieldContentMapper.insertLabelFieldContentList(insertGroupingValues);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updateGroupingValues)) {
|
||||
int update = labelFieldContentMapper.updateContentRemarkLabelFieldContentList(updateGroupingValues);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,8 +306,8 @@
|
||||
#{GroupingValue.portraitStatus},
|
||||
#{GroupingValue.contentSort},
|
||||
#{GroupingValue.contentRemark},
|
||||
#{GroupingValue.create_by},
|
||||
#{GroupingValue.create_time}
|
||||
#{GroupingValue.createBy},
|
||||
#{GroupingValue.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@ -348,7 +348,7 @@
|
||||
<if test="item.updateTime != null">update_time =
|
||||
#{item.updateTime},
|
||||
</if>
|
||||
where id = #{item.id}
|
||||
where id = #{item.labelFieldContentId}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user