Commit 0de2e153 by huluobin

update

parent 4fad407c
...@@ -3,8 +3,6 @@ package com.blt.other.common.util; ...@@ -3,8 +3,6 @@ package com.blt.other.common.util;
import com.blt.other.common.base.SysUser; import com.blt.other.common.base.SysUser;
import java.util.Optional;
/** /**
* 应用会话管理工具类 * 应用会话管理工具类
*/ */
...@@ -20,7 +18,14 @@ public class SessionUtils { ...@@ -20,7 +18,14 @@ public class SessionUtils {
} }
public static SysUser getSysUser() { public static SysUser getSysUser() {
return sysUserThreadLocal.get(); SysUser sysUser = sysUserThreadLocal.get();
if (sysUser == null) {
SysUser defaultSysUser = new SysUser();
defaultSysUser.setOaUserId(0);
defaultSysUser.setUserName("sys");
return defaultSysUser;
}
return sysUser;
} }
public static void removeSysUser() { public static void removeSysUser() {
...@@ -30,7 +35,7 @@ public class SessionUtils { ...@@ -30,7 +35,7 @@ public class SessionUtils {
public static Integer getCurrentUserId() { public static Integer getCurrentUserId() {
return Optional.ofNullable(sysUserThreadLocal.get()).map(SysUser::getOaUserId).orElse(null); return getSysUser().getOaUserId();
} }
} }
package com.blt.other.module.sys.dto.response; package com.blt.other.module.sys.dto.response;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
...@@ -24,42 +26,58 @@ import java.util.List; ...@@ -24,42 +26,58 @@ import java.util.List;
public class DepartmentReviewerListItem { public class DepartmentReviewerListItem {
@ExcelIgnore
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Integer id;
@ExcelIgnore
@ApiModelProperty(value = "一级部门id") @ApiModelProperty(value = "一级部门id")
private Integer primaryDepartmentId; private Integer primaryDepartmentId;
@ApiModelProperty(value = "一级部门") @ApiModelProperty(value = "一级部门")
@ExcelProperty(value = "一级部门")
private String primaryDepartmentName; private String primaryDepartmentName;
@ApiModelProperty(value = "二级部门id") @ExcelIgnore
@ExcelProperty(value = "二级部门id")
private Integer secondDepartmentId; private Integer secondDepartmentId;
@ApiModelProperty(value = "二级部门") @ApiModelProperty(value = "二级部门")
@ExcelProperty(value = "二级部门")
private String secondDepartmentName; private String secondDepartmentName;
@ApiModelProperty(value = "自动审核金额") @ApiModelProperty(value = "自动审核金额")
@ExcelProperty(value = "自动审核金额")
private BigDecimal autoReviewAmount; private BigDecimal autoReviewAmount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ExcelIgnore
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ExcelIgnore
@ApiModelProperty(value = "最近一次更新时间") @ApiModelProperty(value = "最近一次更新时间")
private LocalDateTime lastUpdateTime; private LocalDateTime lastUpdateTime;
@ExcelIgnore
@ApiModelProperty(value = "更新人id") @ApiModelProperty(value = "更新人id")
private Integer updateUserId; private Integer updateUserId;
@ExcelIgnore
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "更新人")
private String updateUserName; private String updateUserName;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "公司") @ApiModelProperty(value = "公司")
@ExcelProperty(value = "公司")
private String companyName; private String companyName;
@TableField(exist = false)
@ExcelIgnore
private List<CostReviewer> costReviewerList; private List<CostReviewer> costReviewerList;
@TableField(exist = false)
@ExcelProperty(value = "审核人")
private String costReviewerNames;
} }
...@@ -110,6 +110,7 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe ...@@ -110,6 +110,7 @@ public class DepartmentReviewerServiceImpl extends ServiceImpl<DepartmentReviewe
departmentReviewer.setSecondDepartmentName(secondDepartment.getName()); departmentReviewer.setSecondDepartmentName(secondDepartment.getName());
departmentReviewer.setUpdateUserId(SessionUtils.getCurrentUserId()); departmentReviewer.setUpdateUserId(SessionUtils.getCurrentUserId());
departmentReviewer.setUpdateUserName(SessionUtils.getSysUser().getUserName()); departmentReviewer.setUpdateUserName(SessionUtils.getSysUser().getUserName());
......
...@@ -2,12 +2,12 @@ spring: ...@@ -2,12 +2,12 @@ spring:
# 数据源配置 # 数据源配置
datasource: datasource:
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
# url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true url: jdbc:mysql://cdb-aanqm573.gz.tencentcdb.com:10120/bailun_other?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
# username: root
# password: 'Aarob2020#'
url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
username: root username: root
password: "#7kfnymAM$Y9-Ntf" password: 'Aarob2020#'
# url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true
# username: root
# password: "#7kfnymAM$Y9-Ntf"
hikari: hikari:
maximum-pool-size: 200 maximum-pool-size: 200
minimum-idle: 10 minimum-idle: 10
......
...@@ -26,6 +26,8 @@ import com.blt.other.module.cost.model.CostCurrentReviewer; ...@@ -26,6 +26,8 @@ import com.blt.other.module.cost.model.CostCurrentReviewer;
import com.blt.other.module.cost.model.CostDomain; import com.blt.other.module.cost.model.CostDomain;
import com.blt.other.module.sys.dao.CostReviewerMapper; import com.blt.other.module.sys.dao.CostReviewerMapper;
import com.blt.other.module.sys.dao.DepartmentReviewerMapper; import com.blt.other.module.sys.dao.DepartmentReviewerMapper;
import com.blt.other.module.sys.dto.request.DepartmentReviewerListReq;
import com.blt.other.module.sys.dto.response.DepartmentReviewerListItem;
import com.blt.other.module.sys.model.CostReviewer; import com.blt.other.module.sys.model.CostReviewer;
import com.blt.other.module.sys.model.DepartmentReviewer; import com.blt.other.module.sys.model.DepartmentReviewer;
import com.blt.other.module.sys.service.IDepartmentReviewerService; import com.blt.other.module.sys.service.IDepartmentReviewerService;
...@@ -52,7 +54,7 @@ import java.util.stream.Collectors; ...@@ -52,7 +54,7 @@ import java.util.stream.Collectors;
@Transactional @Transactional
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = OtherApplication.class) @SpringBootTest(classes = OtherApplication.class)
@ActiveProfiles("prod") @ActiveProfiles("test")
public class OtherApplicationTests { public class OtherApplicationTests {
@Autowired @Autowired
...@@ -408,5 +410,18 @@ public class OtherApplicationTests { ...@@ -408,5 +410,18 @@ public class OtherApplicationTests {
} }
@Test
public void exportDepartmentReviewer() {
DepartmentReviewerListReq req = new DepartmentReviewerListReq();
req.setPageNum(1);
req.setPageSize(100);
List<DepartmentReviewerListItem> list = departmentReviewerService.departmentReviewerList(req).getRecords();
list.forEach(item->item.setCostReviewerNames(item.getCostReviewerList().stream().map(CostReviewer::getReviewerUserName).collect(Collectors.joining(","))));
EasyExcel.write("/Users/huluobin/exportDepartmentReviewer.xlsx", DepartmentReviewerListItem.class).sheet("sheet").doWrite(list);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment