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