智慧保安后台管理-外网项目备份
guoshilong
2024-01-11 f5eb81d50b6def3ceeb10c5ded0de9661d456c69
制证时间导出、小程序用户导出
8 files modified
1 files added
135 ■■■■■ changed files
src/main/java/org/springblade/modules/accreditation/excel/ExportSecurityBookPaperExcel.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/DeptController.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserWxController.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/excel/UserWxExcel.java 58 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserWxMapper.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserWxMapper.xml 25 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/IUserWxService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserWxServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/excel/ExportSecurityBookPaperExcel.java
@@ -107,5 +107,12 @@
    @ExcelProperty("是否制证")
    private String userType;
    /**
     * 制证时间
     */
    @ColumnWidth(10)
    @ExcelProperty("制证时间")
    private String userPaperTime;
}
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
@@ -230,7 +230,8 @@
        ELT(sar.audit_status,"待审核","审核通过","审核不通过") auditStatus,
        sar.audit_time auditTime,
        sar.audit_detail auditDetail,
        if(bu.user_type=6,"是","否") userType
        if(bu.user_type=6,"是","否") userType,
        DATE_FORMAT(bu.paper_time,'%Y-%m-%d') as userPaperTime
        FROM
        sys_accreditation_records sar
        left join
@@ -261,6 +262,9 @@
        1=1
        and bu.status = 1
        and bu.is_deleted = 0
        <if test="accreditationRecords.userPaperTime != null and accreditationRecords.userPaperTime !=''">
            AND DATE_FORMAT(bu.paper_time,'%Y-%m-%d')  = #{accreditationRecords.userPaperTime}
        </if>
        <if test="accreditationRecords.deptName!=null and  accreditationRecords.deptName!=''">
            and bt.dept_name like concat('%', #{accreditationRecords.deptName},'%')
        </if>
src/main/java/org/springblade/modules/system/controller/DeptController.java
@@ -257,13 +257,6 @@
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        CacheUtil.clear(SYS_CACHE);
        List<String> list = Arrays.asList(ids.split(","));
        list.forEach(id -> {
            //内网同步
            String s1 = "update blade_dept set is_deleted = 1 where id = " + "'" + id + "'";
            //FtpUtil.sqlFileUpload(s1);
            myAsyncService.dataSync(s1);
        });
        return R.status(deptService.removeDept(ids));
    }
src/main/java/org/springblade/modules/system/controller/UserWxController.java
@@ -167,4 +167,15 @@
        return R.status(userWxService.removeUser(ids));
    }
    /**
     * 导出用户
     */
    @GetMapping("export-user")
    @ApiOperationSupport(order = 13)
    @ApiOperation(value = "导出用户", notes = "传入user")
    public void exportUser(@ApiIgnore @RequestParam Map<String, Object> user, BladeUser bladeUser, HttpServletResponse response) {
        List<UserWxExcel> list = userWxService.exportUser(user);
        ExcelUtil.export(response, "小程序用户数据" + DateUtil.time(), "用户数据表", list, UserWxExcel.class);
    }
}
src/main/java/org/springblade/modules/system/excel/UserWxExcel.java
New file
@@ -0,0 +1,58 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
 * UserExcel
 *
 * @author Chill
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class UserWxExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    @ExcelProperty("企业名称*")
    private String deptId;
//    @ColumnWidth(15)
//    @ExcelProperty("警号*")
//    private String code;
    @ColumnWidth(10)
    @ExcelProperty("姓名*")
    private String realName;
    @ColumnWidth(15)
    @ExcelProperty("联系电话")
    private String phone;
    @ExcelProperty("身份证号*")
    private String cardid;
}
src/main/java/org/springblade/modules/system/mapper/UserWxMapper.java
@@ -6,9 +6,12 @@
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserWx;
import org.springblade.modules.system.excel.UserExcel;
import org.springblade.modules.system.excel.UserWxExcel;
import org.springblade.modules.system.vo.UserVO;
import java.util.List;
import java.util.Map;
public interface UserWxMapper extends BaseMapper<UserWx> {
    UserWx getUserWx(String tenantId, String account, String password);
@@ -24,4 +27,6 @@
    List<String> getDeptName(@Param("deptId") String deptId);
    UserVO getUserDetailById(Long id);
    List<UserWxExcel> exportUser(@Param("obj") Map<String, Object> param);
}
src/main/java/org/springblade/modules/system/mapper/UserWxMapper.xml
@@ -145,6 +145,31 @@
        where bu.is_deleted = 0
          and bu.id = #{id}
    </select>
    <select id="exportUser" resultType="org.springblade.modules.system.excel.UserWxExcel">
        SELECT
        bu.id,
        bd.dept_name AS deptId,
        bu.real_name,
        bu.phone,
        bu.cardid
        FROM
        blade_user_wx bu
        LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
        where bu.is_deleted = 0
        <if test="obj.account != null and obj.account != ''">
            AND bu.account LIKE CONCAT('%',#{obj.account},'%')
        </if>
        <if test="obj.realName != null and obj.realName != ''">
            AND bu.real_name LIKE CONCAT('%',#{obj.realName},'%')
        </if>
        <if test="obj.deptId != null and obj.deptId != ''">
            AND bu.dept_id = #{obj.deptId}
        </if>
        <if test="obj.cardid != null and obj.cardid != ''">
            and bu.cardid like concat('%', #{obj.cardid},'%')
        </if>
        ORDER BY bu.id desc
    </select>
</mapper>
src/main/java/org/springblade/modules/system/service/IUserWxService.java
@@ -4,7 +4,12 @@
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserWx;
import org.springblade.modules.system.excel.UserExcel;
import org.springblade.modules.system.excel.UserWxExcel;
import org.springblade.modules.system.vo.UserVO;
import java.util.List;
import java.util.Map;
public interface IUserWxService extends BaseService<UserWx> {
    /**
@@ -43,4 +48,6 @@
     * @return
     */
    boolean removeUser(String userIds);
    List<UserWxExcel> exportUser(Map<String, Object> user);
}
src/main/java/org/springblade/modules/system/service/impl/UserWxServiceImpl.java
@@ -16,6 +16,8 @@
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserWx;
import org.springblade.modules.system.excel.UserExcel;
import org.springblade.modules.system.excel.UserWxExcel;
import org.springblade.modules.system.mapper.UserWxMapper;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.service.IUserWxService;
@@ -25,6 +27,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Service
@AllArgsConstructor
@@ -131,4 +134,10 @@
        }
        return deleteLogic(Func.toLongList(userIds));
    }
    @Override
    public List<UserWxExcel> exportUser(Map<String, Object> param) {
        List<UserWxExcel> userList = baseMapper.exportUser(param);
        return userList;
    }
}