weicd
2023-12-20 4e7355035b4b43860f4a664db1b622affb1375a1
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/UserServiceImpl.java
@@ -49,7 +49,10 @@
import me.zhengjie.modules.treatment.rest.CmnInsuranceController;
import me.zhengjie.utils.*;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -119,6 +122,9 @@
    private final MongoTemplate mongoTemplate;
    private final UserLevelWageRepository userLevelWageRepository;
    private final UserInsuranceRepository userInsuranceRepository;
    @Autowired
    private CacheManager cacheManager;
    @Override
    public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
@@ -528,6 +534,7 @@
            throw new EntityExistException(User.class, "phone", resources.getPhone());
        }
        redisUtils.del(CacheKey.TOTAL_USER);
        redisUtils.del("user::AllUser");
        userRepository.save(resources);
        // 判断用户级别变更
        checkUserLevel(resources.getId(), null, resources.getLevelId());
@@ -586,6 +593,7 @@
        user.setLevelId(resources.getLevelId());
        // 临时新用户级别ID
        Long tempNewLevelId = user.getLevelId();
        redisUtils.del("user::AllUser");
        userRepository.save(user);
        // 判断用户级别变更
        checkUserLevel(user.getId(), tempOldLevelId, tempNewLevelId);
@@ -1298,6 +1306,33 @@
        // 获取当前年份
        int currentYear = Calendar.getInstance().get(Calendar.YEAR);
//        for (int i = 0; i < 2; i++) {
//            // 第一条记录
//            SysUserLevelOther sysUserLevelOther = new SysUserLevelOther();
//            sysUserLevelOther.setUserId(resources.getId());
//            sysUserLevelOther.setLevelId(cmnLevel.getId());
//            sysUserLevelOther.setPersonalPerformanceProportion(Double.valueOf(0));
//
//            if (i == 1) {
//                // 计算剩余年假
//                Double annualLeave = getAnnualLeave(calendar);
//                sysUserLevelOther.setAnnualLeaveDays(annualLeave);
//            } else {
//                calendar.add(Calendar.YEAR, 1);
//                // 设置月份为一月
//                calendar.set(Calendar.MONTH, Calendar.JANUARY);
//                // 设置月份为一日
//                calendar.set(Calendar.DAY_OF_MONTH, 1);
//
//                sysUserLevelOther.setAnnualLeaveDays(5.0);
//            }
//            // 年月
//            sysUserLevelOther.setYearMonth(sdf.format(calendar.getTime()));
//
//
//            sysUserLevelOtherRepository.save(sysUserLevelOther);
//        }
        // 添加两条数据
        for (int i = 0; i < 2; i++) {
            if (i == 0) {