LIVE_YE 2 days ago
parent
commit
3321949426

+ 119 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/kaoqin/KaoQinController.java

@@ -7,9 +7,11 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.system.domain.KaoqinConfig;
-import com.ruoyi.system.domain.KaoqinRecord;
-import com.ruoyi.system.domain.PlatPunch;
+import com.ruoyi.system.domain.*;
+import com.ruoyi.system.mapper.BusinessTripMapper;
+import com.ruoyi.system.mapper.CardReplacementRecordMapper;
+import com.ruoyi.system.mapper.RecordLeaveMapper;
+import com.ruoyi.system.service.ICardReplacementRecordService;
 import com.ruoyi.system.service.IKaoqinConfigService;
 import com.ruoyi.system.service.IKaoqinRecordService;
 import com.ruoyi.system.service.ISysDictDataService;
@@ -43,6 +45,15 @@ public class KaoQinController extends BaseController {
     @Autowired
     private ISysDictDataService dictDataService;
 
+    @Autowired
+    private CardReplacementRecordMapper cardReplacementRecordMapper;
+
+    @Autowired
+    private RecordLeaveMapper recordLeaveMapper;
+
+    @Autowired
+    private BusinessTripMapper businessTripMapper;
+
     @Autowired
     private RedisCache redisCache;
 
@@ -148,10 +159,51 @@ public class KaoQinController extends BaseController {
     public AjaxResult calendar(KaoqinRecord kaoqinRecord) {
         //根据打卡人id和月份去找对应的打卡记录
         List<KaoqinRecord> kaoqinRecords = kaoqinRecordService.selectKaoqinRecordList(kaoqinRecord);
+        //查询传入月补卡信息
+        CardReplacementRecord cardReplacementRecord = new CardReplacementRecord();
+        cardReplacementRecord.setUserId(kaoqinRecord.getUserId());
+        String qDate = kaoqinRecord.getKaYear()+"-"+kaoqinRecord.getKaMonth()+"-01";
+        cardReplacementRecord.setApplicationDate(qDate);
+        List<CardReplacementRecord> cardReplacementRecordList = cardReplacementRecordMapper.selectCardReplacementRecordList(cardReplacementRecord);
+        Map<String, List<CardReplacementRecord>> cardReplacementCollect = cardReplacementRecordList.stream().collect(Collectors.groupingBy(CardReplacementRecord::getApplicationDate));
+        //查询传入月请假信息
+        RecordLeave recordLeave = new RecordLeave();
+        String month = kaoqinRecord.getKaYear()+"-"+kaoqinRecord.getKaMonth();
+        recordLeave.setStartTime(DateUtils.parseDate(month+"-"+"01 00:00:00"));
+        String fin = DateUtils.getLastDayOfMonth(Integer.parseInt(kaoqinRecord.getKaYear()), Integer.parseInt(kaoqinRecord.getKaMonth()));
+        recordLeave.setEndTime(DateUtils.parseDate(fin+" 23:59:59"));
+        recordLeave.setAbsenteeId(String.valueOf(kaoqinRecord.getUserId()));
+        List<RecordLeave> recordLeaves = recordLeaveMapper.selectRecordLeaveList(recordLeave);
+        //查询传入月出差信息
+        BusinessTrip businessTrip = new BusinessTrip();
+        businessTrip.setStartTime(DateUtils.parseDate(month+"-"+"01 00:00:00"));
+        businessTrip.setEndTime(DateUtils.parseDate(fin+" 23:59:59"));
+        businessTrip.setUserId(kaoqinRecord.getUserId());
+        List<BusinessTrip> businessTrips = businessTripMapper.selectBusinessTripListLb(businessTrip);
+
         List list = new ArrayList();
         if (kaoqinRecords != null && kaoqinRecords.size() > 0) {
             Map<String, List<KaoqinRecord>> collect = kaoqinRecords.stream().collect(Collectors.groupingBy(KaoqinRecord::getKaTime));
             for (String date : collect.keySet()) {
+
+                List<RecordLeave> recordList = new ArrayList<>();
+                List<BusinessTrip> businessList = new ArrayList<>();
+                //请假信息
+                for (RecordLeave recordLeaf : recordLeaves) {
+                    if(DateUtils.isDateBetween(DateUtils.parseDate(date), recordLeaf.getStartTime(), recordLeaf.getEndTime())) {
+                        recordList.add(recordLeaf);
+                    }
+
+                }
+                //出差信息
+                for (BusinessTrip trip : businessTrips) {
+                    if(DateUtils.isDateBetween(DateUtils.parseDate(date), trip.getStartTime(), trip.getEndTime())) {
+                        businessList.add(trip);
+                    }
+
+                }
+
+
                 Map<String, Object> map = new HashMap();
                 List<KaoqinRecord> kaoqinRecords1 = collect.get(date);
                 //定义标签显示状态
@@ -190,6 +242,12 @@ public class KaoQinController extends BaseController {
                 map.put("info", abnormal);
                 //打卡记录列表
                 map.put("list", kaoqinRecords1);
+                //补卡信息
+                map.put("bk", cardReplacementCollect.get(date));
+                //请假信息
+                map.put("qj", recordList);
+                //出差信息
+                map.put("cc", businessList);
                 list.add(map);
             }
         }
@@ -327,6 +385,64 @@ public class KaoQinController extends BaseController {
         return AjaxResult.success(map);
     }
 
+    /**
+     * 查询考勤异常数据信息
+     * 包括所有异常的数量
+     * 本月打卡统计
+     */
+    @PreAuthorize("@ss.hasPermi('kaoqin:statistics:monthCount')")
+    @GetMapping("/month/count")
+    public AjaxResult monthCount(KaoqinRecord kaoqinRecord) {
+        if(StringUtils.isEmpty(kaoqinRecord.getKaMonth())){
+            kaoqinRecord.setKaYear(DateUtils.getYear());
+            kaoqinRecord.setKaMonth(DateUtils.justMonth());
+        }
+        Map<String, Object> map = new HashMap();
+        //查询当天考勤数据
+        Map<String, Long> todayMap = day(kaoqinRecord);
+        //查询昨天考勤数据
+        //获取上个月
+        kaoqinRecord.setKaMonth(String.valueOf(Integer.parseInt(kaoqinRecord.getKaMonth())-1));
+        if("01".equals(kaoqinRecord.getKaMonth())){
+            kaoqinRecord.setKaYear(String.valueOf(Integer.parseInt(kaoqinRecord.getKaYear())-1));
+            kaoqinRecord.setKaMonth("12");
+        }
+        Map<String, Long> yesterdayMap = day(kaoqinRecord);
+        for (String s : todayMap.keySet()) {
+            Map<String, Object> mapZj = new HashMap();
+            String zz = "0%";
+            //1:正,2负 3:平
+            String zt = "3";
+            mapZj.put("num", todayMap.get(s));
+
+            BigDecimal todayBd = new BigDecimal(todayMap.get(s));
+            BigDecimal yesterdayBd = new BigDecimal(yesterdayMap.get(s));
+            BigDecimal fz = todayBd.subtract(yesterdayBd);
+            if (fz.compareTo(BigDecimal.ZERO) != 0) {
+                BigDecimal  percentage = BigDecimal.ZERO;
+                //昨天数据>0
+                if (yesterdayBd.compareTo(BigDecimal.ZERO)>0) {
+                    percentage = fz.multiply(new BigDecimal("100"))
+                            .divide(yesterdayBd, 3, RoundingMode.HALF_UP) // 先计算百分比并保留三位小数以处理可能的精度问题
+                            .setScale(1, RoundingMode.HALF_UP);     // 再设置为一位小数
+                }
+                zz = percentage + "%";
+                zt = "1";
+                if(percentage.compareTo(BigDecimal.ZERO) < 0){
+                    zt = "2";
+                    zz = (percentage.multiply(new BigDecimal("-1")))+ "%";;
+                }
+            }
+            mapZj.put("bfb", zz);
+            mapZj.put("zf",zt);
+            map.put(s,mapZj);
+        }
+
+
+        return AjaxResult.success(map);
+    }
+
+
     /**
      * 查询考勤异常数据信息
      * 包括所有异常的数量

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/sms/SendSmsController.java

@@ -138,15 +138,15 @@ public class SendSmsController extends BaseController
                     //手机号码
                     .setPhoneNumbers(phone)
                     //短信签名名称。潜山市数据资源局
-                    .setSignName("安徽博曼网络科技有限公司")
+                    .setSignName("安徽中新云计算")
                     //短信模板CODE
                     .setTemplateCode("SMS_232893584")
                     //短信模板变量对应的实际值{"name": code}
                     .setTemplateParam(smsCode);
             try {
-                sendSms.setContent("【安徽博曼网络科技有限公司】您的验证码"+smsCode+",该验证码10分钟内有效,请勿泄漏于他人!");
+                sendSms.setContent("【安徽中新云计算】您的验证码"+smsCode+",该验证码10分钟内有效,请勿泄漏于他人!");
                 // 复制代码运行请自行打印 API 的返回值
-                System.out.println("发送短信"+"【安徽博曼网络科技有限公司】您的验证码"+smsCode+",该验证码10分钟内有效,请勿泄漏于他人!");
+                System.out.println("发送短信"+"【安徽中新云计算】您的验证码"+smsCode+",该验证码10分钟内有效,请勿泄漏于他人!");
                 SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, new RuntimeOptions());
                 String code = sendSmsResponse.getBody().code;
                 System.out.println(code);

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -68,6 +68,16 @@ public class SysUserController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 获取用户列表(根据首字母排序)
+     */
+    @PreAuthorize("@ss.hasPermi('system:user:szmList')")
+    @GetMapping("/szmList")
+    public AjaxResult szmList(SysUser user)
+    {
+        return userService.szmList(user);
+    }
+
 
     /**
      * 获取用户列表(获取本部门及以下人员)

+ 7 - 0
ruoyi-common/pom.xml

@@ -144,6 +144,13 @@
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
 
+
+        <dependency>
+            <groupId>com.belerweb</groupId>
+            <artifactId>pinyin4j</artifactId>
+            <version>2.5.1</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 65 - 5
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -3,11 +3,7 @@ package com.ruoyi.common.utils;
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.util.Calendar;
 import java.util.Date;
@@ -59,6 +55,10 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return dateTimeNow(YYYY_MM_DD);
     }
 
+    public static String getYear() {
+        return dateTimeNow(YYYY);
+    }
+
     public static final String getTime() {
         return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
     }
@@ -237,4 +237,64 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         return dateMinusOneDayStr;
     }
 
+    /**
+     * 获取指定月份的最后一天日期(格式为yyyy-MM-dd)
+     *
+     * @param year 年份(如2023)
+     * @param month 月份(1-12)
+     * @return 最后一天日期字符串(如"2023-02-28")
+     * @throws IllegalArgumentException 如果月份不在1-12范围内
+     */
+    public static String getLastDayOfMonth(int year, int month) {
+        // 验证月份是否有效
+        if (month < 1 || month > 12) {
+            throw new IllegalArgumentException("月份必须在1-12之间");
+        }
+
+        // 使用YearMonth获取月份的最后一天并格式化为字符串
+        return YearMonth.of(year, month)
+                .atEndOfMonth()
+                .format(DateTimeFormatter.ISO_DATE);
+    }
+
+
+    /**
+     * 判断目标日期是否在[startDate, endDate]区间内(包含边界)
+     *
+     * @param target   目标日期 (Date类型)
+     * @param start    开始日期 (Date类型)
+     * @param end      结束日期 (Date类型)
+     * @return 若target在[start, end]区间内返回true,否则返回false
+     */
+    public static boolean isDateBetween(Date target, Date start, Date end) {
+        // 转换为LocalDate(忽略时间部分)
+        LocalDate targetDate = convertToLocalDate(target);
+        LocalDate startDate = convertToLocalDate(start);
+        LocalDate endDate = convertToLocalDate(end);
+
+        // 判断日期区间(包含边界)
+        return (targetDate.isEqual(startDate) || targetDate.isAfter(startDate))
+                && (targetDate.isEqual(endDate) || targetDate.isBefore(endDate));
+    }
+
+    /**
+     * 将Date转换为LocalDate(格式化为yyyy-MM-dd)
+     */
+    private static LocalDate convertToLocalDate(Date date) {
+        return date.toInstant()
+                .atZone(ZoneId.systemDefault())
+                .toLocalDate();
+    }
+
+    /**
+     *  获取当期月份,只要月份,不要年
+     */
+    public static String justMonth() {
+        // 获取当前月份数字
+        int monthNumber = LocalDate.now().getMonthValue();
+        // 获取带前导零的月份字符串
+        String monthPadded = String.format("%02d", monthNumber);
+        return monthPadded;
+    }
+
 }

+ 62 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/PinyUtils.java

@@ -0,0 +1,62 @@
+package com.ruoyi.common.utils;
+
+import net.sourceforge.pinyin4j.PinyinHelper;
+import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
+import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
+import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
+import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
+
+import java.util.*;
+
+public class PinyUtils {
+
+    // 获取姓名拼音的大写首字母
+    public static char getPinyinInitial(String name) {
+        if (name == null || name.trim().isEmpty()) {
+            return ' '; // 返回空格表示无效
+        }
+
+        String trimmedName = name.trim();
+        char firstChar = trimmedName.charAt(0);
+
+        // 如果是中文字符
+        if (isChineseCharacter(firstChar)) {
+            return getChinesePinyinInitial(firstChar);
+        }
+        // 非中文字符(英文、数字等)
+        return Character.toUpperCase(firstChar);
+    }
+
+    // 判断是否是中文字符
+    private static boolean isChineseCharacter(char c) {
+        Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
+        return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
+                || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
+                || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
+                || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
+                || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
+                || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
+                || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION;
+    }
+
+    // 获取中文字符的拼音首字母(大写)
+    private static char getChinesePinyinInitial(char c) {
+        HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
+        format.setCaseType(HanyuPinyinCaseType.UPPERCASE);
+        format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
+
+        try {
+            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
+            if (pinyinArray != null && pinyinArray.length > 0) {
+                // 取第一个拼音的首字母
+                return pinyinArray[0].charAt(0);
+            }
+        } catch (BadHanyuPinyinOutputFormatCombination e) {
+            e.printStackTrace();
+        }
+        // 转换失败时返回原字符的大写形式
+        return Character.toUpperCase(c);
+    }
+
+
+}

+ 24 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BusinessTrip.java

@@ -68,6 +68,14 @@ public class BusinessTrip extends BaseEntity
     @Excel(name = "部门名称")
     private String deptName;
 
+    /** 发起人id */
+    @Excel(name = "发起人id")
+    private Long initiatorId;
+
+    /** 发起人姓名 */
+    @Excel(name = "发起人姓名")
+    private String initiatorName;
+
     /** 同行人员 */
     @Excel(name = "同行人员")
     private String absenteeName;
@@ -283,6 +291,22 @@ public class BusinessTrip extends BaseEntity
         this.userId = userId;
     }
 
+    public Long getInitiatorId() {
+        return initiatorId;
+    }
+
+    public void setInitiatorId(Long initiatorId) {
+        this.initiatorId = initiatorId;
+    }
+
+    public String getInitiatorName() {
+        return initiatorName;
+    }
+
+    public void setInitiatorName(String initiatorName) {
+        this.initiatorName = initiatorName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/BusinessUser.java

@@ -40,6 +40,8 @@ public class BusinessUser extends BaseEntity
     @Excel(name = "出差人姓名")
     private String absenteeName;
 
+    private String type;
+
     /** 提交时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@@ -109,6 +111,14 @@ public class BusinessUser extends BaseEntity
         return submitTime;
     }
 
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 11 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/CardReplacementRecord.java

@@ -41,6 +41,9 @@ public class CardReplacementRecord extends BaseEntity
     @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date applicationTime;
 
+    /** 申请日期 */
+    private String applicationDate;
+
     /** 补卡理由 */
     @Excel(name = "补卡理由")
     private String reason;
@@ -157,6 +160,14 @@ public class CardReplacementRecord extends BaseEntity
         this.deptIds = deptIds;
     }
 
+    public String getApplicationDate() {
+        return applicationDate;
+    }
+
+    public void setApplicationDate(String applicationDate) {
+        this.applicationDate = applicationDate;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -255,4 +255,6 @@ public interface ISysUserService
     int reset(Long id);
 
     List<SysUser> selectUserListNoZj(SysUser user);
+
+    AjaxResult szmList(SysUser user);
 }

+ 29 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BusinessTripServiceImpl.java

@@ -77,8 +77,21 @@ public class BusinessTripServiceImpl implements IBusinessTripService
     @Override
     public int insertBusinessTrip(BusinessTrip businessTrip)
     {
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        businessTrip.setInitiatorId(user.getUserId());
+        businessTrip.setInitiatorName(user.getNickName());
         businessTrip.setSubmitTime(DateUtils.getNowDate());
         int index = businessTripMapper.insertBusinessTrip(businessTrip);
+
+        BusinessUser bu = new BusinessUser();
+        bu.setAbsenteeId(user.getUserId());
+        bu.setAbsenteeName(user.getNickName());
+        bu.setDeptId(user.getDeptId());
+        bu.setDeptName(user.getDept().getDeptName());
+        bu.setType("1");
+        bu.setSubmitTime(DateUtils.getNowDate());
+        businessUserMapper.insertBusinessUser(bu);
+
         if(businessTrip.getBusinessUserList()!=null && !businessTrip.getBusinessUserList().isEmpty()){
             //保存人员表
             StringBuilder sb = new StringBuilder();
@@ -96,6 +109,7 @@ public class BusinessTripServiceImpl implements IBusinessTripService
                 SysUser sysUser = userMapper.selectUserById(businessUser.getAbsenteeId());
                 businessUser.setDeptId(sysUser.getDeptId());
                 businessUser.setDeptName(sysUser.getDept().getDeptName());
+                businessUser.setType("2");
                 businessUser.setSubmitTime(DateUtils.getNowDate());
                 businessUserMapper.insertBusinessUser(businessUser);
             }
@@ -121,6 +135,17 @@ public class BusinessTripServiceImpl implements IBusinessTripService
         }
         //删除随行人员信息
         businessUserMapper.deleteBusinessUserByBusinessId(businessTrip.getId());
+
+        SysUser use = SecurityUtils.getLoginUser().getUser();
+        BusinessUser bUse = new BusinessUser();
+        bUse.setAbsenteeId(use.getUserId());
+        bUse.setAbsenteeName(use.getNickName());
+        bUse.setDeptId(use.getDeptId());
+        bUse.setDeptName(use.getDept().getDeptName());
+        bUse.setType("1");
+        bUse.setSubmitTime(DateUtils.getNowDate());
+        businessUserMapper.insertBusinessUser(bUse);
+
         if(businessTrip.getBusinessUserList()!=null && !businessTrip.getBusinessUserList().isEmpty()){
             //保存人员表
             StringBuilder sb = new StringBuilder();
@@ -135,12 +160,14 @@ public class BusinessTripServiceImpl implements IBusinessTripService
 
                 businessUser.setBusinessId(businessTrip.getId());
                 //查询人员部门信息
-                /*SysUser sysUser = userMapper.selectUserById(businessUser.getAbsenteeId());
+                SysUser sysUser = userMapper.selectUserById(businessUser.getAbsenteeId());
                 businessUser.setDeptId(sysUser.getDeptId());
-                businessUser.setDeptName(sysUser.getDept().getDeptName());*/
+                businessUser.setDeptName(sysUser.getDept().getDeptName());
                 businessUser.setSubmitTime(DateUtils.getNowDate());
                 businessUserMapper.insertBusinessUser(businessUser);
             }
+
+
             //将随行人员放入主表
             businessTrip.setAbsenteeName(sb.toString());
             businessTripMapper.updateBusinessTrip(businessTrip);

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CardReplacementRecordServiceImpl.java

@@ -74,6 +74,8 @@ public class CardReplacementRecordServiceImpl implements ICardReplacementRecordS
         cardReplacementRecord.setUserName(user.getNickName());
         cardReplacementRecord.setDeptId(user.getDeptId());
         cardReplacementRecord.setDeptName(user.getDept().getDeptName());
+        String date = DateUtils.dateTime(cardReplacementRecord.getApplicationTime());
+        cardReplacementRecord.setApplicationDate(date);
         cardReplacementRecord.setCreateTime(DateUtils.getNowDate());
         return cardReplacementRecordMapper.insertCardReplacementRecord(cardReplacementRecord);
     }

+ 34 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -7,6 +7,7 @@ import javax.validation.Validator;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.utils.PinyUtils;
 import com.ruoyi.system.domain.*;
 import com.ruoyi.system.mapper.*;
 import org.slf4j.Logger;
@@ -725,4 +726,37 @@ public class SysUserServiceImpl implements ISysUserService
     public List<SysUser> selectUserListNoZj(SysUser user) {
         return userMapper.selectUserListNoZj(user);
     }
+
+    @Override
+    public AjaxResult szmList(SysUser user) {
+        Map<String,Object> map = new HashMap<>();
+        List<SysUser> list = userMapper.selectUserList(user);
+        map.put("num",list.size());
+        List<Map<String,Object>> resultList = new ArrayList<>();
+
+        // 使用TreeMap自动按键排序(字母顺序)
+        Map<Character, List<SysUser>> classifiedMap = new TreeMap<>();
+        for (SysUser person : list) {
+            char initial = PinyUtils.getPinyinInitial(person.getNickName());
+
+            // 跳过无效姓名
+            if (initial == ' ') continue;
+
+            // 初始化或获取对应首字母的列表
+            List<SysUser> group = classifiedMap.computeIfAbsent(initial, k -> new ArrayList<>());
+            group.add(person);
+        }
+        for (Map.Entry<Character, List<SysUser>> entry : classifiedMap.entrySet()) {
+            Map<String, Object> groupMap = new LinkedHashMap<>();
+            groupMap.put("initial", String.valueOf(entry.getKey()));  // 首字母作为字符串
+            groupMap.put("list", entry.getValue());  // 人员列表
+
+            resultList.add(groupMap);
+        }
+        map.put("list",resultList);
+        return AjaxResult.success(map);
+    }
+
+
+
 }

+ 20 - 4
ruoyi-system/src/main/resources/mapper/system/BusinessTripMapper.xml

@@ -21,6 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="photo"    column="photo"    />
         <result property="deptId"    column="dept_id"    />
         <result property="deptName"    column="dept_name"    />
+        <result property="initiatorId"    column="initiator_id"    />
+        <result property="initiatorName"    column="initiator_name"    />
         <result property="absenteeName"    column="absentee_name"    />
         <result property="examinersId"    column="examiners_id"    />
         <result property="examinersName"    column="examiners_name"    />
@@ -30,12 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectBusinessTripVo">
-        select id, type,transportation,departure_place,destination, start_time, end_time,duration, reason, photo, dept_id, dept_name, absentee_name, examiners_id, examiners_name, is_pass, reject, submit_time from business_trip
+        select id, type,transportation,departure_place,destination, start_time, end_time,duration, reason, photo, dept_id, dept_name,initiator_id,initiator_name, absentee_name, examiners_id, examiners_name, is_pass, reject, submit_time from business_trip
     </sql>
 
     <sql id="selectBusinessTripLbVo">
         select t.id, t.type,t.transportation,t.departure_place,t.destination, t.start_time, t.end_time,t.duration, t.reason, t.photo, t.dept_id,
-               t.dept_name, t.absentee_name, t.examiners_id, t.examiners_name, t.is_pass, t.reject, t.submit_time from business_trip t
+               t.dept_name,t.initiator_id,t.initiator_name, t.absentee_name, t.examiners_id, t.examiners_name, t.is_pass, t.reject, t.submit_time from business_trip t
         left join business_user u on t.id = u.business_id
     </sql>
 
@@ -52,6 +54,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="photo != null  and photo != ''"> and photo = #{photo}</if>
             <if test="deptId != null "> and dept_id = #{deptId}</if>
             <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="initiatorId != null "> and initiator_id = #{initiatorId}</if>
+            <if test="initiatorName != null  and initiatorName != ''"> and initiator_name like concat('%', #{initiatorName}, '%')</if>
             <if test="absenteeName != null  and absenteeName != ''"> and absentee_name like concat('%', #{absenteeName}, '%')</if>
             <if test="examinersId != null "> and examiners_id = #{examinersId}</if>
             <if test="examinersName != null  and examinersName != ''"> and examiners_name like concat('%', #{examinersName}, '%')</if>
@@ -70,16 +74,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="transportation != null  and transportation != ''"> and t.transportation = #{transportation}</if>
             <if test="departurePlace != null  and departurePlace != ''"> and t.departure_place like concat('%', #{departurePlace}, '%')</if>
             <if test="destination != null  and destination != ''"> and t.destination like concat('%', #{destination}, '%')</if>
-            <if test="startTime != null "> and t.start_time = #{startTime}</if>
-            <if test="endTime != null "> and t.end_time = #{endTime}</if>
             <if test="reason != null  and reason != ''"> and t.reason = #{reason}</if>
             <if test="deptId != null "> and t.dept_id = #{deptId}</if>
             <if test="deptName != null  and deptName != ''"> and t.dept_name like concat('%', #{deptName}, '%')</if>
+            <if test="initiatorId != null "> and initiator_id = #{initiatorId}</if>
+            <if test="initiatorName != null  and initiatorName != ''"> and initiator_name like concat('%', #{initiatorName}, '%')</if>
             <if test="absenteeName != null  and absenteeName != ''"> and t.absentee_name like concat('%', #{absenteeName}, '%')</if>
             <if test="examinersId != null "> and t.examiners_id = #{examinersId}</if>
             <if test="examinersName != null  and examinersName != ''"> and t.examiners_name like concat('%', #{examinersName}, '%')</if>
             <if test="isPass != null  and isPass != ''"> and t.is_pass = #{isPass}</if>
             <if test="submitTime != null "> and t.submit_time = #{submitTime}</if>
+            <if test="startTime != null and startTime != ''">
+                AND start_time &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND end_time &lt;= #{endTime}
+            </if>
         </where>
         order by t.is_pass, t.submit_time desc
     </select>
@@ -103,6 +113,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="photo != null">photo,</if>
             <if test="deptId != null">dept_id,</if>
             <if test="deptName != null">dept_name,</if>
+            <if test="initiatorId != null ">  initiator_id ,</if>
+            <if test="initiatorName != null">  initiator_name ,</if>
             <if test="absenteeName != null">absentee_name,</if>
             <if test="examinersId != null">examiners_id,</if>
             <if test="examinersName != null">examiners_name,</if>
@@ -122,6 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="photo != null">#{photo},</if>
             <if test="deptId != null">#{deptId},</if>
             <if test="deptName != null">#{deptName},</if>
+            <if test="initiatorId != null ">  #{initiatorId},</if>
+            <if test="initiatorName != null  ">  #{initiatorName}, </if>
             <if test="absenteeName != null">#{absenteeName},</if>
             <if test="examinersId != null">#{examinersId},</if>
             <if test="examinersName != null">#{examinersName},</if>
@@ -145,6 +159,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="photo != null">photo = #{photo},</if>
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="initiatorId != null ">  initiator_id = #{initiatorId},</if>
+            <if test="initiatorName != null ">  initiator_name= #{initiatorName},</if>
             <if test="absenteeName != null">absentee_name = #{absenteeName},</if>
             <if test="examinersId != null">examiners_id = #{examinersId},</if>
             <if test="examinersName != null">examiners_name = #{examinersName},</if>

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/BusinessUserMapper.xml

@@ -11,11 +11,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptName"    column="dept_name"    />
         <result property="absenteeId"    column="absentee_id"    />
         <result property="absenteeName"    column="absentee_name"    />
+        <result property="type"    column="type"    />
         <result property="submitTime"    column="submit_time"    />
     </resultMap>
 
     <sql id="selectBusinessUserVo">
-        select id, business_id, dept_id, dept_name, absentee_id, absentee_name, submit_time from business_user
+        select id, business_id, dept_id, dept_name, absentee_id, absentee_name,type, submit_time from business_user
     </sql>
 
     <select id="selectBusinessUserList" parameterType="BusinessUser" resultMap="BusinessUserResult">
@@ -26,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
             <if test="absenteeId != null  and absenteeId != ''"> and absentee_id = #{absenteeId}</if>
             <if test="absenteeName != null  and absenteeName != ''"> and absentee_name like concat('%', #{absenteeName}, '%')</if>
+            <if test="type != null "> and type = #{type}</if>
             <if test="submitTime != null "> and submit_time = #{submitTime}</if>
         </where>
     </select>
@@ -43,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptName != null">dept_name,</if>
             <if test="absenteeId != null">absentee_id,</if>
             <if test="absenteeName != null">absentee_name,</if>
+            <if test="type != null ">  type ,</if>
             <if test="submitTime != null">submit_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -51,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptName != null">#{deptName},</if>
             <if test="absenteeId != null">#{absenteeId},</if>
             <if test="absenteeName != null">#{absenteeName},</if>
+            <if test="type != null "> #{type},</if>
             <if test="submitTime != null">#{submitTime},</if>
          </trim>
     </insert>
@@ -63,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptName != null">dept_name = #{deptName},</if>
             <if test="absenteeId != null">absentee_id = #{absenteeId},</if>
             <if test="absenteeName != null">absentee_name = #{absenteeName},</if>
+            <if test="type != null ">  type = #{type},</if>
             <if test="submitTime != null">submit_time = #{submitTime},</if>
         </trim>
         where id = #{id}

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/CardReplacementRecordMapper.xml

@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deptId"    column="dept_id"    />
         <result property="deptName"    column="dept_name"    />
         <result property="applicationTime"    column="application_time"    />
+        <result property="applicationDate"    column="application_date"    />
         <result property="reason"    column="reason"    />
         <result property="examinersId"    column="examiners_id"    />
         <result property="examinersName"    column="examiners_name"    />
@@ -19,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCardReplacementRecordVo">
-        select id, user_id, user_name, dept_id,dept_name, application_time, reason, examiners_id, examiners_name, is_pass,create_time from card_replacement_record
+        select id, user_id, user_name, dept_id,dept_name, application_time,application_date, reason, examiners_id, examiners_name, is_pass,create_time from card_replacement_record
     </sql>
 
     <select id="selectCardReplacementRecordList" parameterType="CardReplacementRecord" resultMap="CardReplacementRecordResult">
@@ -30,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null  and deptId != 0"> and dept_id = #{deptId}</if>
             <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
             <if test="applicationTime != null "> and date_format(application_time,'%y%m%d') = date_format(#{applicationTime},'%y%m%d') </if>
+            <if test="applicationDate != null "> and date_format(application_date,'%y%m') = date_format(#{applicationDate},'%y%m') </if>
             <if test="reason != null  and reason != ''"> and reason = #{reason}</if>
             <if test="examinersName != null  and examinersName != ''"> and examiners_name like concat('%', #{examinersName}, '%')</if>
             <if test="isPass != null  and isPass != ''"> and is_pass = #{isPass}</if>
@@ -56,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null">dept_id,</if>
             <if test="deptName != null">dept_name,</if>
             <if test="applicationTime != null">application_time,</if>
+            <if test="applicationDate != null">application_date,</if>
             <if test="reason != null">reason,</if>
             <if test="examinersId != null">examiners_id,</if>
             <if test="examinersName != null">examiners_name,</if>
@@ -68,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null">#{deptId},</if>
             <if test="deptName != null">#{deptName},</if>
             <if test="applicationTime != null">#{applicationTime},</if>
+            <if test="applicationDate != null">#{applicationDate},</if>
             <if test="reason != null">#{reason},</if>
             <if test="examinersId != null">#{examinersId},</if>
             <if test="examinersName != null">#{examinersName},</if>
@@ -84,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId != null">dept_id = #{deptId},</if>
             <if test="deptName != null">dept_name = #{deptName},</if>
             <if test="applicationTime != null">application_time = #{applicationTime},</if>
+            <if test="applicationDate != null">application_date = #{applicationDate},</if>
             <if test="reason != null">reason = #{reason},</if>
             <if test="examinersId != null">examiners_id = #{examinersId},</if>
             <if test="examinersName != null">examiners_name = #{examinersName},</if>

+ 6 - 0
ruoyi-system/src/main/resources/mapper/system/RecordLeaveMapper.xml

@@ -43,6 +43,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{deptId}
                 </foreach>
             </if>
+            <if test="startTime != null and startTime != ''">
+                AND start_time &gt;= #{startTime}
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND end_time &lt;= #{endTime}
+            </if>
         </where>
         order by is_pass,submit_time desc
     </select>