法规意见收集-保存历史表获取创建人。
This commit is contained in:
+29
-1
@@ -13,13 +13,18 @@ import com.jero.modules.lawsOpinionGather.mapper.LawsProcessHistoryEOMapper;
|
||||
import com.jero.modules.lawsOpinionGather.service.ILawsProcessHistoryEOService;
|
||||
import com.jero.modules.project.enums.OperatorTypeEnum;
|
||||
import com.jero.modules.project.enums.RequestSourceEnum;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.service.ISysUserService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -33,6 +38,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@Service
|
||||
public class LawsProcessHistoryEOServiceImpl extends ServiceImpl<LawsProcessHistoryEOMapper, LawsProcessHistoryEO> implements ILawsProcessHistoryEOService {
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
@@ -142,7 +150,27 @@ public class LawsProcessHistoryEOServiceImpl extends ServiceImpl<LawsProcessHist
|
||||
lawsProcessHistoryEO = JSONObject.parseObject(JSONObject.toJSONString(lawsProcessHistory),LawsProcessHistoryEO.class);
|
||||
lawsProcessHistoryEOList.add(lawsProcessHistoryEO);
|
||||
}
|
||||
this.saveBatch(lawsProcessHistoryEOList);
|
||||
if(CollectionUtils.isNotEmpty(lawsProcessHistoryEOList)){
|
||||
List<String> createUserId = lawsProcessHistoryEOList.stream().map(LawsProcessHistoryEO::getCreateBy).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isNotEmpty(createUserId)){
|
||||
QueryWrapper<SysUser> queryUserWrapper = new QueryWrapper<>();
|
||||
queryUserWrapper.lambda().in(SysUser::getId,createUserId);
|
||||
List<SysUser> sysUserList = sysUserService.getBaseMapper().selectList(queryUserWrapper);
|
||||
|
||||
lawsProcessHistoryEOList.forEach(lawsProcessHistory -> {
|
||||
String createBy = sysUserList.stream().filter(e -> {
|
||||
boolean flag = false;
|
||||
if (StringUtils.equals(e.getId(), lawsProcessHistory.getCreateBy())) {
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).map(SysUser::getUsername).distinct().collect(Collectors.toList()).get(0);
|
||||
lawsProcessHistory.setCreateBy(createBy);
|
||||
});
|
||||
}
|
||||
|
||||
this.saveBatch(lawsProcessHistoryEOList);
|
||||
}
|
||||
}
|
||||
|
||||
return new Result<>().success("调用成功!");
|
||||
|
||||
Reference in New Issue
Block a user