Browse Source

opt:增加仓库搜索

master1
gongbaoxiong 6 months ago
parent
commit
43bbbfa227
  1. 6
      nlsso-server/src/main/java/org/nl/system/service/user/dao/mapper/SysUserMapper.java
  2. 21
      nlsso-server/src/main/java/org/nl/system/service/user/dao/mapper/SysUserMapper.xml
  3. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/AllocationBillMapper.java
  4. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/ReceiptBillMapper.java
  5. 13
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/AllocationBillMapper.xml
  6. 8
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/ReceiptBillMapper.xml
  7. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java
  8. 10
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java
  9. 62
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java
  10. 71
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java
  11. 4
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java
  12. 10
      nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

6
nlsso-server/src/main/java/org/nl/system/service/user/dao/mapper/SysUserMapper.java

@ -1,5 +1,6 @@
package org.nl.system.service.user.dao.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.common.domain.query.PageQuery;
@ -35,6 +36,9 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
List<String> getUserIdByDeptId(String deptId);
void insertBatch( List<SysUser> userList);
void insertBatch(@Param("entities") List<SysUser> entities);
@DS("oracle_eas")
List<SysUser> queryUserList() ;
}

21
nlsso-server/src/main/java/org/nl/system/service/user/dao/mapper/SysUserMapper.xml

@ -150,17 +150,24 @@
</if>
</where>
</select>
<insert id="insertBatch" keyProperty="userId" useGeneratedKeys="true">
insert into sys_user(username, person_name, gender, phone, email, avatar_name, avatar_path, password, is_admin,
<insert id="insertBatch" keyProperty="userId">
insert into sys_user(user_id,username, person_name, gender, phone, email, avatar_name, avatar_path, password, is_admin,
is_used, pwd_reset_user_id, pwd_reset_time, create_id, create_name, create_time, update_id, update_name,
update_time, extperson_id, extuser_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.username}, #{entity.personName}, #{entity.gender}, #{entity.phone}, #{entity.email},
#{entity.avatarName}, #{entity.avatarPath}, #{entity.password}, #{entity.isAdmin}, #{entity.isUsed},
#{entity.pwdResetUserId}, #{entity.pwdResetTime}, #{entity.createId}, #{entity.createName},
#{entity.createTime}, #{entity.updateId}, #{entity.updateName}, #{entity.updateTime}, #{entity.extpersonId},
#{entity.extuserId})
(#{entity.user_id},#{entity.username}, #{entity.person_name}, #{entity.gender}, #{entity.phone}, #{entity.email},
#{entity.avatar_name}, #{entity.avatar_path}, #{entity.password}, #{entity.is_admin}, #{entity.is_used},
#{entity.pwd_reset_user_id}, #{entity.pwd_reset_time}, #{entity.create_id}, #{entity.create_name},
#{entity.create_time}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time}, #{entity.extperson_id},
#{entity.extperson_id})
</foreach>
</insert>
<select id="queryUserList" resultType="org.nl.system.service.user.dao.SysUser">
SELECT
DISTINCT YHBM username,
YHMC person_name
FROM
EAS_NOBLE.V_UC_USERINFO
</select>
</mapper>

4
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/AllocationBillMapper.java

@ -20,10 +20,10 @@ public interface AllocationBillMapper extends BaseMapper<AllocationBill> {
@DS("oracle_eas")
Long getAllocationCount(@Param("fuzzy") String fuzzy);
Long getAllocationCount(@Param("fuzzy") String fuzzy,@Param("ckbm") String ckbm);
@DS("oracle_eas")
List<AllocationBillQuery> allocationPage(@Param("fuzzy") String fuzzy, @Param("page") Integer page, @Param("size") Integer size );
List<AllocationBillQuery> allocationPage(@Param("fuzzy") String fuzzy, @Param("ckbm") String ckbm,@Param("page") Integer page, @Param("size") Integer size );
@Select("SELECT COUNT(*) FROM EAS_NOBLE.V_UC_STOCKTRANSFERBILL WHERE DJID = #{djid}")

4
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/ReceiptBillMapper.java

@ -23,9 +23,7 @@ public interface ReceiptBillMapper extends BaseMapper<ReceiptBill> {
Long receiptCounts();
@DS("mysql_srm")
Page<AllocationBillQuery> receiptPage(Page<AllocationBillQuery> page, @Param("fuzzy") String fuzzy);
Page<AllocationBillQuery> receiptPage(Page<AllocationBillQuery> page, @Param("fuzzy") String fuzzy, @Param("ckbm") String ckbm);
@DS("mysql_srm")

13
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/AllocationBillMapper.xml

@ -8,8 +8,9 @@
COUNT( 1 )
FROM
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data
WHERE 1=1
<if test="fuzzy != null and fuzzy != ''">
WHERE (wlmc LIKE '%' || #{fuzzy} || '%'
AND (wlmc LIKE '%' || #{fuzzy} || '%'
OR djbh LIKE '%' || #{fuzzy} || '%'
OR wlbm LIKE '%' || #{fuzzy} || '%'
OR wlmc LIKE '%' || #{fuzzy} || '%'
@ -18,15 +19,18 @@
OR drkcmc LIKE '%' || #{fuzzy} || '%'
)
</if>
<if test="ckbm != null and ckbm != ''">
AND (drckbm = #{ckbm} OR dcckbm = #{ckbm})
</if>
ORDER BY CJSJ DESC ) temp )
</select>
<select id="allocationPage" resultType="org.nl.wms.database.eas.dto.AllocationBillQuery">
WITH ranked_data AS ( SELECT t.*, ROW_NUMBER ( ) OVER ( PARTITION BY djbh ORDER BY CJSJ DESC ) AS rn FROM
EAS_NOBLE.V_UC_STOCKTRANSFERBILL t ),
grouped_data AS ( SELECT * FROM ranked_data WHERE rn = 1 ) SELECT * FROM
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data
( SELECT temp.*, ROWNUM AS row_num FROM ( SELECT * FROM grouped_data WHERE 1=1
<if test="fuzzy != null and fuzzy != ''">
WHERE (wlmc LIKE '%' || #{fuzzy} || '%'
AND (wlmc LIKE '%' || #{fuzzy} || '%'
OR djbh LIKE '%' || #{fuzzy} || '%'
OR wlbm LIKE '%' || #{fuzzy} || '%'
OR wlmc LIKE '%' || #{fuzzy} || '%'
@ -35,6 +39,9 @@
OR drkcmc LIKE '%' || #{fuzzy} || '%'
)
</if>
<if test="ckbm != null and ckbm != ''">
AND (drckbm = #{ckbm} OR dcckbm = #{ckbm})
</if>
ORDER BY CJSJ DESC ) temp WHERE <![CDATA[ ROWNUM <= #{size} * #{page} ]]>) WHERE
<![CDATA[ row_num > #{size} * (#{page} - 1) ]]>
</select>

8
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/ReceiptBillMapper.xml

@ -4,8 +4,9 @@
<select id="receiptPage" resultType="org.nl.wms.database.eas.dto.ReceiptBillQuery">
SELECT *
FROM v_wms_recbill_third
WHERE 1=1
<if test="fuzzy != null and fuzzy != ''">
WHERE djbh LIKE CONCAT('%', #{fuzzy}, '%')
AND(djbh LIKE CONCAT('%', #{fuzzy}, '%')
OR wlmc LIKE CONCAT('%', #{fuzzy}, '%')
OR ggxh LIKE CONCAT('%', #{fuzzy}, '%')
OR djbh LIKE CONCAT('%', #{fuzzy}, '%')
@ -13,8 +14,11 @@
OR zzmc LIKE CONCAT('%', #{fuzzy}, '%')
OR ckmc LIKE CONCAT('%', #{fuzzy}, '%')
OR kwmc LIKE CONCAT('%', #{fuzzy}, '%')
OR gys LIKE CONCAT('%', #{fuzzy}, '%')
OR gys LIKE CONCAT('%', #{fuzzy}, '%'))
</if>
<if test="ckbm != null and ckbm != ''">
AND ckbm = #{ckbm}
</if>
GROUP BY
DJID
ORDER BY TJSJ DESC

4
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java

@ -49,6 +49,10 @@ public class AllocationBillQuery extends BaseQuery<AllocationBillQuery> {
*/
private String dckcmc;
/**
* 仓库编码
*/
private String ckbm;
/**
* 调入库存组织编码

10
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java

@ -53,6 +53,11 @@ public class ReceiptBillQuery extends BaseQuery<ReceiptBillQuery> {
*/
private String cggs;
/**
* 仓库编码
*/
private String ckbm;
/**
* 物料编码
@ -209,10 +214,7 @@ public class ReceiptBillQuery extends BaseQuery<ReceiptBillQuery> {
*/
private String ckmc;
/**
* 收货仓库编码
*/
private String ckbm;
/**
* 收货库位编码

62
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java

@ -4,7 +4,6 @@ import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
@ -12,10 +11,9 @@ import org.nl.wms.database.eas.dao.AllocationBill;
import org.nl.wms.database.eas.dto.*;
import org.nl.wms.database.eas.dao.mapper.AllocationBillMapper;
import org.nl.wms.database.eas.service.IallocationBillService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.ext.eas.WmsToEasService;
import org.nl.wms.ext.srm.WmsToSrmService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.BeanUtils;
@ -23,14 +21,14 @@ import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import org.nl.common.base.CommonPage;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
/**
@ -49,6 +47,9 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
@Resource
private WmsToEasService wmsToEasService;
@Resource
@Qualifier("threadPoolExecutor")
private ThreadPoolExecutor pool;
/**
* 查询调拨单据
@ -58,10 +59,37 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
@Override
@SaIgnore
public CommonPage<AllocationBillQuery> allocationPage(AllocationBillQuery params) {
// 查询总记录数
long totalCount = allocationBillMapper.getAllocationCount(params.getFuzzy());
List<AllocationBillQuery> allocationBills = allocationBillMapper.allocationPage(params.getFuzzy(), params.getPage(), params.getSize());
if (!allocationBills.isEmpty()) {
AtomicLong totalCount = new AtomicLong(0L);
CompletableFuture<Void> count = CompletableFuture.runAsync(() -> {
try {
totalCount.set(allocationBillMapper.getAllocationCount(params.getFuzzy(), params.getCkbm()));
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
CompletableFuture<List<AllocationBillQuery>> page = CompletableFuture.supplyAsync(() -> {
try {
return allocationBillMapper.allocationPage(params.getFuzzy(), params.getCkbm(), params.getPage(), params.getSize());
} catch (Exception e) {
log.error("异常信息:" + e);
return Collections.emptyList();
}
}, pool);
// 等待所有异步任务完成
CompletableFuture<Void> allOf = CompletableFuture.allOf(count, page);
try {
allOf.get();
} catch (InterruptedException | ExecutionException e) {
log.error("异步任务异常:" + e);
}
List<AllocationBillQuery> allocationBills = null;
try {
allocationBills = page.get();
} catch (InterruptedException | ExecutionException e) {
log.error("获取分页结果异常:" + e);
}
// 处理查询结果
if (allocationBills != null && !allocationBills.isEmpty()) {
allocationBills = allocationBills.stream()
.peek(r -> {
r.setJhdrrq(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
@ -69,10 +97,13 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
})
.collect(Collectors.toList());
}
return CommonPage.getPage(allocationBills, totalCount, params.getPage(), params.getSize());
return CommonPage.getPage(allocationBills, totalCount.get(), params.getPage(), params.getSize());
}
/**
* 分页查询
*
@ -86,14 +117,13 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
// 查询总记录数
long totalCount = allocationBillMapper.getTotalCount(params.getDjid());
List<AllocationBillQuery> allocationBillList = allocationBillMapper.allocationDetailPage(params.getPage(), params.getSize(), params.getDjid(), params.getFuzzy());
if (allocationBillList.isEmpty()) {
if (!allocationBillList.isEmpty()) {
allocationBillList = allocationBillList.stream().peek(r -> {
if (r.getJhdrrq().contains("/") || r.getJhdcrq().contains("/")) {
r.setJhdrrq(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
r.setJhdcrq(LocalDateTime.parse(r.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
}
}).collect(Collectors.toList());
} else {
// 获取更新列表
List<AllocationBill> updateList = allocationBillMapper.selectList(
new LambdaQueryWrapper<AllocationBill>().eq(AllocationBill::getDjid, allocationBillList.get(0).getDjid()));
@ -167,7 +197,7 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
allocationBillDto.setBillNo(params.get(0).getDjbh());
allocationBillDto.setBizDate(params.get(0).getYwrq());
allocationBillDto.setDescription(params.get(0).getBz());
allocationBillDto.setInWhUser("A110813006");
allocationBillDto.setInWhUser(SecurityUtils.getCurrentUsername());
List<AllocationBillDetailDto> entrys = new ArrayList<>();
params.forEach(r -> {
AllocationBillDetailDto dto = new AllocationBillDetailDto();

71
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

@ -3,7 +3,6 @@ package org.nl.wms.database.eas.service.impl;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
@ -29,7 +28,6 @@ import org.nl.wms.ext.eas.WmsToEasService;
import org.nl.wms.ext.srm.WmsToSrmService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@ -43,7 +41,9 @@ import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -84,42 +84,79 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
/**
* 首页显示出入库单据数量
*/
@Override
public List<HomeBillCounts> getBillsCount() {
Long receiptCount = 0L;
Long allocationCount = 0L;
List<HomeBillCounts> allCounts = easOutInBillMapper.getBillsCount();
AtomicReference<Long> receiptCount = new AtomicReference<>(0L);
AtomicReference<Long> allocationCount = new AtomicReference<>(0L);
AtomicReference<List<HomeBillCounts>> inOutBillList = new AtomicReference<>();
CompletableFuture<Void> receipt = CompletableFuture.runAsync(() -> {
try {
receiptCount.set(receiptBillMapper.receiptCounts());
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
CompletableFuture<Void> allocation = CompletableFuture.runAsync(() -> {
try {
allocationCount.set(allocationBillMapper.getAllocationCount("", ""));
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
CompletableFuture<Void> inOutBills = CompletableFuture.runAsync(() -> {
try {
inOutBillList.set(easOutInBillMapper.getBillsCount());
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
CompletableFuture<Void> allOf = CompletableFuture.allOf(receipt, allocation, inOutBills);
try {
allOf.get();
} catch (InterruptedException | ExecutionException e) {
log.error("异步任务异常:" + e);
}
List<HomeBillCounts> allCounts = inOutBillList.get();
HomeBillCounts allocations = new HomeBillCounts();
HomeBillCounts receipts = new HomeBillCounts();
receipts.setName(EasBillTypeEnum.SHDJ.getName());
receipts.setDjlx(EasBillTypeEnum.SHDJ.getCode());
receipts.setYwlx(EasBillTypeEnum.SH.getCode());
receipts.setCounts(receiptCount.toString());
allocations.setName(EasBillTypeEnum.DBQR.getName());
allocations.setDjlx(EasBillTypeEnum.DBQR.getCode());
allocations.setYwlx(EasBillTypeEnum.DB.getCode());
allocations.setCounts(allocationCount.toString());
receipts.setCounts(receiptCount.toString());
allocations.setCounts(allocationCount.toString());
try {
//receiptCount = receiptBillMapper.receiptCounts();
//allocationCount = allocationBillMapper.getAllocationCount("");
//receipts.setCounts(receiptCount.toString());
//allocations.setCounts(allocationCount.toString());
} catch (Exception e) {
allCounts.add(allocations);
allCounts.add(receipts);
return allCounts;
}
allCounts.add(allocations);
allCounts.add(receipts);
return allCounts;
}
/**
* 获取仓库信息
*/
@Override
public List<WarehouseInfo> getWarehouseInfo() {
return easOutInBillMapper.getWarehouseInfo();
List<WarehouseInfo> warehouseInfoList = easOutInBillMapper.getWarehouseInfo();
//三期的仓库放在前面
List<WarehouseInfo> second = warehouseInfoList.stream()
.filter(r -> r.getCkmc().contains("三期"))
.collect(Collectors.toList());
//三期原材料库放在最前面
Optional<WarehouseInfo> first = second.stream()
.filter(r -> r.getCkbm().equals("3.03.013"))
.findFirst();
List<WarehouseInfo> sortedList = new ArrayList<>();
first.ifPresent(sortedList::add);
second.stream()
.filter(r -> !r.equals(first.orElse(null)))
.forEach(sortedList::add);
warehouseInfoList.stream()
.filter(r -> !second.contains(r))
.forEach(sortedList::add);
return sortedList;
}

4
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java

@ -57,7 +57,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
@SaIgnore
public CommonPage<AllocationBillQuery> receiptPage(ReceiptBillQuery params) {
Page<AllocationBillQuery> pageObject = new Page<>(params.getPage(), params.getSize());
Page<AllocationBillQuery> receiptBills = receiptBillMapper.receiptPage(pageObject, params.getFuzzy());
Page<AllocationBillQuery> receiptBills = receiptBillMapper.receiptPage(pageObject, params.getFuzzy(),params.getCkbm());
return CommonPage.getPage(receiptBills);
}
@ -128,7 +128,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
receiptBillDto.setBillId(params.get(0).getDjid());
receiptBillDto.setBillNo(params.get(0).getDjbh());
receiptBillDto.setBillType("SHDJ");
receiptBillDto.setRecUser("A110813006");
receiptBillDto.setRecUser(SecurityUtils.getCurrentUsername());
receiptBillDto.setDescription(params.get(0).getBtbz());
List<ReceiptBillDetailDto> details = new ArrayList<>();
params.forEach(r -> {

10
nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.nl.common.websocket.SendHomeWebSocketServer;
import org.nl.config.IdUtil;
import org.nl.system.service.user.dao.SysUser;
import org.nl.system.service.user.dao.mapper.SysUserMapper;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
@ -45,7 +46,7 @@ public class EasBillSchedule {
* eas单据数据同步
*/
@Async("taskExecutor")
//@Scheduled(cron = "0/120 * * * * *")
@Scheduled(cron = "0/90 * * * * *")
public void getEasOutInBills() {
// 获取eas视图查询未提交的单据
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectPageWithInventory();
@ -64,13 +65,16 @@ public class EasBillSchedule {
@Async("taskExecutor")
//@Scheduled(cron = "0/120 * * * * *")
public void insertUsers(List<SysUser> existingUsers, List<SysUser> newUsers) {
@Scheduled(cron = "0/60 * * * * *")
public void insertUsers() {
List<SysUser> newUsers =sysUserMapper.queryUserList();
List<SysUser> existingUsers =sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>().eq(SysUser::getIs_used,"1"));
Set<String> ids = existingUsers.stream().map(SysUser::getUsername).collect(Collectors.toSet());
List<SysUser> insertUsers = newUsers.stream()
.filter(user -> !ids.contains(user.getUsername()))
.peek(user -> {
//默认启用
user.setUser_id(IdUtil.getStringId());
user.setIs_used(true);
user.setIs_admin(true);
user.setPwd_reset_user_id(0L);

Loading…
Cancel
Save