| | |
| | | package com.dy.pmsBase.user; |
| | | |
| | | import com.alibaba.excel.converters.Converter; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.aop.SsoPowerAop; |
| | | import com.dy.common.util.MD5; |
| | |
| | | import com.dy.pmsGlobal.pojoBa.BaRole; |
| | | import com.dy.pmsGlobal.pojoBa.BaUser; |
| | | import com.dy.pmsGlobal.util.Constant; |
| | | import com.dy.pmsGlobal.util.ExportExcelUtil; |
| | | import com.dy.pmsGlobal.util.QrCodeConstant; |
| | | import com.dy.pmsGlobal.util.QrCodeUtil; |
| | | import com.google.zxing.WriterException; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | @RequestMapping(path = "user") |
| | | @SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked") |
| | | public class UserCtrl { |
| | | |
| | | private static final String fileName = "信息" ; |
| | | private static final String sheetName = "用户信息" ; |
| | | |
| | | @Autowired |
| | | private UserSv sv; |
| | |
| | | po.supperAdmin = Constant.no.byteValue() ; |
| | | // po.disabled = false ;//默认不禁用 |
| | | po.deleted = false;//默认不删除 |
| | | po.supperAdmin = 0;//默认不是管理员 |
| | | if (!StringUtils.isNullOrEmpty(po.password)) { |
| | | /* |
| | | 如果前端进行了base64加密 |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping(path="export") |
| | | @SsoPowerAop(power = "10100001") |
| | | @Log("导出用户信息") |
| | | public void export(HttpServletResponse response) { |
| | | List<Converter> list = new ArrayList<>(); |
| | | List<BaUser> users = sv.selectAll(); |
| | | if (users != null) { |
| | | for (BaUser user : users) { |
| | | ExcelVo vo = new ExcelVo(); |
| | | vo.name = user.name; |
| | | try { |
| | | vo.qrCode = QrCodeUtil.genQrCode(QrCodeConstant.TypeWorker + user.id); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (WriterException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | list.add(vo); |
| | | } |
| | | } |
| | | ExportExcelUtil.downloadExcel(response, fileName, sheetName, list); |
| | | } |
| | | |
| | | } |