统计调试
This commit is contained in:
parent
1e1d700c87
commit
5998e88b4d
|
|
@ -1,9 +1,11 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.vo.ProStatisticsPo;
|
||||
import com.bonus.bmw.domain.vo.SalaryStatisticsVo;
|
||||
import com.bonus.bmw.service.SalaryStatisticsService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
|
|
@ -14,6 +16,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -47,4 +51,42 @@ public class SalaryStatisticsController extends BaseController {
|
|||
return AjaxResult.error("查询失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 工资统计-工程
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("salary:statistics:query"))
|
||||
@GetMapping("/getSalaryStatisticsProTable")
|
||||
@SysLog(title = "工资统计", businessType = OperaType.QUERY, logType = 0, module = "工资统计->工程", details = "工资统计->工程")
|
||||
public TableDataInfo getSalaryStatisticsProTable(ProStatisticsPo o) {
|
||||
try {
|
||||
startPage();
|
||||
List<SalaryStatisticsVo> list = service.getSalaryStatisticsProTable(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工资统计-分包
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("salary:statistics:query"))
|
||||
@GetMapping("/getSalaryStatisticsSubTable")
|
||||
@SysLog(title = "工资统计", businessType = OperaType.QUERY, logType = 0, module = "工资统计->分包", details = "工资统计->分包")
|
||||
public TableDataInfo getSalaryStatisticsSubTable(ProStatisticsPo o) {
|
||||
try {
|
||||
startPage();
|
||||
List<SalaryStatisticsVo> list = service.getSalaryStatisticsSubTable(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ public class ProStatisticsPo {
|
|||
|
||||
private String proId;
|
||||
private String proName;
|
||||
private String subName;
|
||||
private String subCompanyName;
|
||||
private String proType;
|
||||
private String volLevel;
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import java.util.List;
|
|||
public interface SalaryStatisticsMapper {
|
||||
|
||||
|
||||
List<SalaryStatisticsVo> getSalaryStatisticsTable(@Param("year") String year, @Param("list") List<String> list);
|
||||
List<SalaryStatisticsVo> getSalaryStatisticsTable(@Param("year") String year, @Param("list") List<String> list, @Param("proName") String proName);
|
||||
|
||||
List<SalaryStatisticsVo> getSalaryStatisticsSubComTable(@Param("year") String year, @Param("list") List<String> list);
|
||||
|
||||
List<SalaryStatisticsVo> getSalaryStatisticsComTable(@Param("year") String year, @Param("list") List<String> list);
|
||||
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubTable(@Param("year") String year, @Param("list") List<String> list);
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubTable(@Param("year") String year, @Param("list") List<String> list, @Param("subName") String subName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.vo.ProStatisticsPo;
|
||||
import com.bonus.bmw.domain.vo.SalaryStatisticsVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SalaryStatisticsService {
|
||||
|
|
@ -13,4 +15,9 @@ public interface SalaryStatisticsService {
|
|||
*/
|
||||
Map<String, Object> getSalaryStatisticsTable(ProStatisticsPo o);
|
||||
|
||||
List<SalaryStatisticsVo> getSalaryStatisticsProTable(ProStatisticsPo o);
|
||||
|
||||
List<SalaryStatisticsVo> getSalaryStatisticsSubTable(ProStatisticsPo o);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.bonus.bmw.domain.vo.ProStatisticsPo;
|
|||
import com.bonus.bmw.domain.vo.SalaryStatisticsVo;
|
||||
import com.bonus.bmw.mapper.SalaryStatisticsMapper;
|
||||
import com.bonus.bmw.service.SalaryStatisticsService;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -19,59 +20,12 @@ public class SalaryStatisticsServiceImpl implements SalaryStatisticsService {
|
|||
@Override
|
||||
public Map<String, Object> getSalaryStatisticsTable(ProStatisticsPo o) {
|
||||
List<String> listMonth = new ArrayList<>();
|
||||
if(o.getMonth() != null){
|
||||
if(StringUtils.isNotEmpty(o.getMonth())){
|
||||
String[] split = o.getMonth().split(",");
|
||||
listMonth.addAll(Arrays.asList(split));
|
||||
}
|
||||
List<SalaryStatisticsVo> salaryStatisticsTable = mapper.getSalaryStatisticsTable(o.getYear(),listMonth);
|
||||
List<SalaryStatisticsVo> salaryStatisticsTable2 = mapper.getSalaryStatisticsTable(null,null);
|
||||
// 创建以 proId 为键的映射表,用于快速查找
|
||||
Map<Integer, SalaryStatisticsVo> proTable2Map = new HashMap<>();
|
||||
if (salaryStatisticsTable2 != null) {
|
||||
for (SalaryStatisticsVo vo2 : salaryStatisticsTable2) {
|
||||
if (vo2.getProId() != null) {
|
||||
proTable2Map.put(vo2.getProId(), vo2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将 salaryStatisticsTable2 中的 netSalary 根据 proId 匹配存入 salaryStatisticsTable 的 allSalary
|
||||
if (salaryStatisticsTable != null && !proTable2Map.isEmpty()) {
|
||||
for (SalaryStatisticsVo vo1 : salaryStatisticsTable) {
|
||||
if (vo1.getProId() != null) {
|
||||
SalaryStatisticsVo matchedVo = proTable2Map.get(vo1.getProId());
|
||||
if (matchedVo != null && matchedVo.getNetSalary() != null) {
|
||||
vo1.setAllSalary(matchedVo.getNetSalary());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubComTable = mapper.getSalaryStatisticsSubComTable(o.getYear(),listMonth);
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubComTable2 = mapper.getSalaryStatisticsTable(null,null);
|
||||
// 创建以 proId 为键的映射表,用于快速查找
|
||||
Map<Integer, SalaryStatisticsVo> subComTable2Map = new HashMap<>();
|
||||
if (salaryStatisticsSubComTable2 != null) {
|
||||
for (SalaryStatisticsVo vo2 : salaryStatisticsSubComTable2) {
|
||||
if (vo2.getSubCompanyId() != null) {
|
||||
subComTable2Map.put(vo2.getSubCompanyId(), vo2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将 salaryStatisticsSubComTable2 中的 netSalary 根据 proId 匹配存入 salaryStatisticsTable 的 allSalary
|
||||
if (salaryStatisticsSubComTable != null && !subComTable2Map.isEmpty()) {
|
||||
for (SalaryStatisticsVo vo1 : salaryStatisticsSubComTable) {
|
||||
if (vo1.getSubCompanyId() != null) {
|
||||
SalaryStatisticsVo matchedVo = subComTable2Map.get(vo1.getSubCompanyId());
|
||||
if (matchedVo != null && matchedVo.getNetSalary() != null) {
|
||||
vo1.setAllSalary(matchedVo.getNetSalary());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<SalaryStatisticsVo> salaryStatisticsComTable = mapper.getSalaryStatisticsComTable(o.getYear(),listMonth);
|
||||
List<SalaryStatisticsVo> salaryStatisticsComTable2 = mapper.getSalaryStatisticsTable(null,null);
|
||||
|
||||
List<SalaryStatisticsVo> salaryStatisticsComTable2 = mapper.getSalaryStatisticsComTable(null,null);
|
||||
// 创建以 proId 为键的映射表,用于快速查找
|
||||
Map<Integer, SalaryStatisticsVo> comTable2Map = new HashMap<>();
|
||||
if (salaryStatisticsComTable2 != null) {
|
||||
|
|
@ -93,8 +47,75 @@ public class SalaryStatisticsServiceImpl implements SalaryStatisticsService {
|
|||
}
|
||||
}
|
||||
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubTable = mapper.salaryStatisticsSubTable(o.getYear(),listMonth);
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubTable2 = mapper.getSalaryStatisticsTable(null,null);
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubComTable = mapper.getSalaryStatisticsSubComTable(o.getYear(),listMonth);
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubComTable2 = mapper.getSalaryStatisticsSubComTable(null,null);
|
||||
// 创建以 proId 为键的映射表,用于快速查找
|
||||
Map<Integer, SalaryStatisticsVo> subComTable2Map = new HashMap<>();
|
||||
if (salaryStatisticsSubComTable2 != null) {
|
||||
for (SalaryStatisticsVo vo2 : salaryStatisticsSubComTable2) {
|
||||
if (vo2.getSubCompanyId() != null) {
|
||||
subComTable2Map.put(vo2.getSubCompanyId(), vo2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将 salaryStatisticsSubComTable2 中的 netSalary 根据 proId 匹配存入 salaryStatisticsTable 的 allSalary
|
||||
if (salaryStatisticsSubComTable != null && !subComTable2Map.isEmpty()) {
|
||||
for (SalaryStatisticsVo vo1 : salaryStatisticsSubComTable) {
|
||||
if (vo1.getSubCompanyId() != null) {
|
||||
SalaryStatisticsVo matchedVo = subComTable2Map.get(vo1.getSubCompanyId());
|
||||
if (matchedVo != null && matchedVo.getNetSalary() != null) {
|
||||
vo1.setAllSalary(matchedVo.getNetSalary());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("公司", salaryStatisticsComTable);
|
||||
map.put("分公司", salaryStatisticsSubComTable);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryStatisticsVo> getSalaryStatisticsProTable(ProStatisticsPo o) {
|
||||
List<String> listMonth = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(o.getMonth())){
|
||||
String[] split = o.getMonth().split(",");
|
||||
listMonth.addAll(Arrays.asList(split));
|
||||
}
|
||||
List<SalaryStatisticsVo> salaryStatisticsTable = mapper.getSalaryStatisticsTable(o.getYear(),listMonth,o.getProName());
|
||||
List<SalaryStatisticsVo> salaryStatisticsTable2 = mapper.getSalaryStatisticsTable(null,null,o.getProName());
|
||||
// 创建以 proId 为键的映射表,用于快速查找
|
||||
Map<Integer, SalaryStatisticsVo> proTable2Map = new HashMap<>();
|
||||
if (salaryStatisticsTable2 != null) {
|
||||
for (SalaryStatisticsVo vo2 : salaryStatisticsTable2) {
|
||||
if (vo2.getProId() != null) {
|
||||
proTable2Map.put(vo2.getProId(), vo2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将 salaryStatisticsTable2 中的 netSalary 根据 proId 匹配存入 salaryStatisticsTable 的 allSalary
|
||||
if (salaryStatisticsTable != null && !proTable2Map.isEmpty()) {
|
||||
for (SalaryStatisticsVo vo1 : salaryStatisticsTable) {
|
||||
if (vo1.getProId() != null) {
|
||||
SalaryStatisticsVo matchedVo = proTable2Map.get(vo1.getProId());
|
||||
if (matchedVo != null && matchedVo.getNetSalary() != null) {
|
||||
vo1.setAllSalary(matchedVo.getNetSalary());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return salaryStatisticsTable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SalaryStatisticsVo> getSalaryStatisticsSubTable(ProStatisticsPo o) {
|
||||
List<String> listMonth = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(o.getMonth())){
|
||||
String[] split = o.getMonth().split(",");
|
||||
listMonth.addAll(Arrays.asList(split));
|
||||
}
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubTable = mapper.salaryStatisticsSubTable(o.getYear(),listMonth,o.getSubName());
|
||||
List<SalaryStatisticsVo> salaryStatisticsSubTable2 = mapper.salaryStatisticsSubTable(null,null,o.getSubName());
|
||||
// 创建以 proId 为键的映射表,用于快速查找
|
||||
Map<Integer, SalaryStatisticsVo> subTable2Map = new HashMap<>();
|
||||
if (salaryStatisticsSubTable2 != null) {
|
||||
|
|
@ -115,13 +136,7 @@ public class SalaryStatisticsServiceImpl implements SalaryStatisticsService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("工程", salaryStatisticsTable);
|
||||
map.put("分公司", salaryStatisticsSubComTable);
|
||||
map.put("公司", salaryStatisticsComTable);
|
||||
map.put("分包", salaryStatisticsSubTable);
|
||||
return map;
|
||||
return salaryStatisticsSubTable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,15 +27,18 @@
|
|||
LEFT JOIN pm_company pc ON pc.id = psc.com_id
|
||||
WHERE
|
||||
`status` = 2
|
||||
<if test="year != null">
|
||||
AND locate(#{year},table_month)
|
||||
<if test="year != null and year != ''">
|
||||
AND locate(#{year},table_month) > 0
|
||||
</if>
|
||||
<if test="list != null">
|
||||
<if test="list != null and list.size() != 0">
|
||||
AND table_month in
|
||||
<foreach collection="list" item="it" separator="," open="(" close=")">
|
||||
#{it}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND locate( #{proName},pp.pro_name) > 0
|
||||
</if>
|
||||
group by tpmt.pro_id
|
||||
</select>
|
||||
|
||||
|
|
@ -55,10 +58,10 @@
|
|||
LEFT JOIN pm_company pc ON pc.id = psc.com_id
|
||||
WHERE
|
||||
`status` = 2
|
||||
<if test="year != null">
|
||||
<if test="year != null and year != ''">
|
||||
AND locate(#{year},table_month)
|
||||
</if>
|
||||
<if test="list != null">
|
||||
<if test="list != null and list.size() != 0">
|
||||
AND table_month in
|
||||
<foreach collection="list" item="it" separator="," open="(" close=")">
|
||||
#{it}
|
||||
|
|
@ -81,10 +84,10 @@
|
|||
LEFT JOIN pm_company pc ON pc.id = psc.com_id
|
||||
WHERE
|
||||
`status` = 2
|
||||
<if test="year != null">
|
||||
AND locate(#{year},table_month)
|
||||
<if test="year != null and year != ''">
|
||||
AND locate(#{year},table_month) > 0
|
||||
</if>
|
||||
<if test="list != null">
|
||||
<if test="list != null and list.size() != 0">
|
||||
AND table_month in
|
||||
<foreach collection="list" item="it" separator="," open="(" close=")">
|
||||
#{it}
|
||||
|
|
@ -104,15 +107,18 @@
|
|||
LEFT JOIN tb_pro_month_table tpmt ON tpmt.id = tpmtr.month_id
|
||||
WHERE
|
||||
tpmt.`status` = 2
|
||||
<if test="year != null">
|
||||
AND locate(#{year},tpmtr.month)
|
||||
<if test="year != null and year != ''">
|
||||
AND locate(#{year},tpmtr.month) > 0
|
||||
</if>
|
||||
<if test="list != null">
|
||||
<if test="list != null and list.size() != 0">
|
||||
AND tpmtr.month in
|
||||
<foreach collection="list" item="it" separator="," open="(" close=")">
|
||||
#{it}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="subName != null and subName != ''">
|
||||
AND locate( #{subName},tpmtr.sub_name) > 0
|
||||
</if>
|
||||
GROUP BY
|
||||
tpmtr.sub_id
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
<select id="getWorkerStatisticsTable" resultType="com.bonus.bmw.domain.vo.HomePageSubProVo">
|
||||
SELECT
|
||||
pw.id AS worker_id,
|
||||
pw.name AS worker_name,
|
||||
pw.id_number,
|
||||
pw.phone,
|
||||
bwem.post_name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue