|
@@ -8764,7 +8764,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
public HttpRespMsg exportCustomerTotalCount(String startDate, String endDate, String userId, Integer departmentId, Integer exportType, HttpServletRequest request) throws Exception {
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, user.getCompanyId()));
|
|
|
-
|
|
|
+ List<Department> deptName = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
|
|
|
List<List<String>> dataList = new ArrayList<>();
|
|
|
List<String> titleList = new ArrayList<>();
|
|
@@ -8780,7 +8780,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<UserVO> userVOList = (List<UserVO>) respMsg.getData();
|
|
|
for (UserVO userVO : userVOList) {
|
|
|
List<String> item = new ArrayList<>();
|
|
|
- item.add(userVO.getName());
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ item.add("$userName="+userVO.getName()+"$");
|
|
|
+ }else{
|
|
|
+ item.add(userVO.getName());
|
|
|
+ }
|
|
|
item.add((userVO.getCustomertotal() == null ? 0 : userVO.getCustomertotal()) + "");
|
|
|
item.add((userVO.getCustomerDeal() == null ? 0 : userVO.getCustomerDeal()) + "");
|
|
|
item.add((userVO.getDealRate() == null ? 0 : userVO.getDealRate()) + "");
|
|
@@ -8793,7 +8797,22 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<DepartmentVO> departmentVOList = (List<DepartmentVO>) respMsg.getData();
|
|
|
for (DepartmentVO departmentVO : departmentVOList) {
|
|
|
List<String> item = new ArrayList<>();
|
|
|
- item.add(departmentVO.getDepartmentName());
|
|
|
+ //取部门名
|
|
|
+ for (Department department : deptName) {
|
|
|
+ if (departmentVO.getId().toString().equals(department.getDepartmentId().toString())){
|
|
|
+ if (wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ item.add(exportWxDepartment(department));
|
|
|
+ }else {
|
|
|
+ item.add(getSupDepartment(department));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ item.add("$departmentName="+departmentVO.getDepartmentName()+"$");
|
|
|
+ }else{
|
|
|
+ item.add(departmentVO.getDepartmentName());
|
|
|
+ }*/
|
|
|
item.add((departmentVO.getCustomertotal() == null ? 0 : departmentVO.getCustomertotal()) + "");
|
|
|
item.add((departmentVO.getCustomerDeal() == null ? 0 : departmentVO.getCustomerDeal()) + "");
|
|
|
item.add((departmentVO.getDealRate() == null ? 0 : departmentVO.getDealRate()) + "");
|
|
@@ -8805,12 +8824,40 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo, fileName, dataList, path);
|
|
|
}
|
|
|
+ private String exportWxDepartment(Department department) {
|
|
|
+ if(department == null || department.getCorpwxDeptid() == null){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ String depHierarchy = "$departmentName="+department.getCorpwxDeptid()+"$";
|
|
|
+ //搜到父部门进行添加
|
|
|
+ if (department.getCorpwxDeptpid()==null || department.getCorpwxDeptpid()==1) {
|
|
|
+ return depHierarchy;
|
|
|
+ }else{
|
|
|
+ Department supDep = departmentMapper.selectOne(new QueryWrapper<Department>().eq("corpwx_deptid", department.getCorpwxDeptpid()).eq("company_id", department.getCompanyId()));
|
|
|
+ return exportWxDepartment(supDep) + "/" + depHierarchy;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //递归获取所有上级部门字符串,格式:"上级部门/上级部门/部门"
|
|
|
+ private String getSupDepartment(Department department) {
|
|
|
+ if (department == null){
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ String depHierarchy = department.getDepartmentName();
|
|
|
+ //搜到父部门进行添加
|
|
|
+ if (department.getSuperiorId()==null) {
|
|
|
+ return depHierarchy;
|
|
|
+ } else {
|
|
|
+ Department supDep = departmentMapper.selectById(department.getSuperiorId());
|
|
|
+ return getSupDepartment(supDep) + "/" + depHierarchy;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg exportCustomerTransferRate(String startDate, String endDate, String userId, Integer departmentId, Integer exportType, HttpServletRequest request) throws Exception {
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoService.getOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, user.getCompanyId()));
|
|
|
-
|
|
|
+ List<Department> deptName = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
|
|
|
List<List<String>> dataList = new ArrayList<>();
|
|
|
List<String> titleList = new ArrayList<>();
|
|
@@ -8836,7 +8883,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<DepartmentVO> departmentVOList = (List<DepartmentVO>) respMsg.getData();
|
|
|
for (DepartmentVO departmentVO : departmentVOList) {
|
|
|
List<String> item = new ArrayList<>();
|
|
|
- item.add(departmentVO.getDepartmentName());
|
|
|
+ //取部门名
|
|
|
+ for (Department department : deptName) {
|
|
|
+ if (departmentVO.getId().toString().equals(department.getDepartmentId().toString())){
|
|
|
+ if (wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ item.add(exportWxDepartment(department));
|
|
|
+ }else {
|
|
|
+ item.add(getSupDepartment(department));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
item.add(departmentVO.getDealRate() + "");
|
|
|
dataList.add(item);
|
|
|
}
|