问题修复

This commit is contained in:
hayu 2024-04-02 13:57:31 +08:00
parent 6060f6f0fb
commit e1e8a47e06
8 changed files with 103 additions and 12 deletions

View File

@ -47,6 +47,12 @@ public class LargeScreenController extends BaseController {
return service.getTotalOwnership();
}
@Log(title = "各公司机具保有量",businessType = BusinessType.QUERY)
@PostMapping("getTotalOwnershipByCompany")
public AjaxResult getTotalOwnershipByCompany() {
return service.getTotalOwnershipByCompany();
}
@Log(title = "当月报废分析", businessType = BusinessType.QUERY)
@PostMapping("getScrapAnalysisByMonth")
public AjaxResult getScrapAnalysisByMonth(ParamsDto dto) {

View File

@ -21,4 +21,9 @@ public class ParamsDto {
/** 类型*/
private String type;
/**
* 公司id
*/
private String companyId;
}

View File

@ -27,4 +27,14 @@ public class TotalOwnershipVo {
/** 报废机具/工器具*/
private int scrapNum;
/**
* 公司名称
*/
private String companyName;
/**
* 公司id
*/
private String companyId;
}

View File

@ -101,4 +101,11 @@ public interface LargeScreenMapper {
* @date 2023/12/21 9:53
*/
List<MaintenanceWarningVo> getMaintenanceWarning(ParamsDto dto);
/**
* 获取公司
* @param
* @return List<TotalOwnershipVo>
*/
List<TotalOwnershipVo> getCompany();
}

View File

@ -96,4 +96,11 @@ public interface ILargeScreenService {
* @date 2023/12/21 9:42
*/
AjaxResult getMaintenanceWarning();
/**
* 各公司机具保有量
* @param
* @return AjaxResult
*/
AjaxResult getTotalOwnershipByCompany();
}

View File

@ -74,15 +74,33 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
return AjaxResult.success(list);
}
@Override
public AjaxResult getTotalOwnershipByCompany() {
List<TotalOwnershipVo> list = new ArrayList<>();
try {
//查询所有公司
list=mapper.getCompany();
if (list.size()>0){
for (TotalOwnershipVo vo:list){
TotalOwnershipVo vos= countNum(null,null,vo.getCompanyId(), "2");
vo.setTotalOwnershipNum(vos.getTotalOwnershipNum());
}
}
} catch (Exception e) {
log.error("各公司机具保有量", e);
}
return AjaxResult.success(list);
}
@Override
public AjaxResult getTotalOwnership() {
List<TotalOwnershipVo> list = new ArrayList<>();
ParamsDto dto = new ParamsDto();
try {
// 施工机具
TotalOwnershipVo vo = countNum("1", CommonConstants.JJ);
TotalOwnershipVo vo = countNum("1", CommonConstants.JJ,"","1");
// 安全工器具
TotalOwnershipVo vo2 = countNum("2", CommonConstants.TS);
TotalOwnershipVo vo2 = countNum("2", CommonConstants.TS,"","1");
list.add(vo);
list.add(vo2);
} catch (Exception e) {
@ -103,11 +121,16 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
* @author cwchen
* @date 2023/12/15 19:33
*/
public TotalOwnershipVo countNum(String maType, String maTypeName) {
public TotalOwnershipVo countNum(String maType, String maTypeName,String companyId,String type) {
TotalOwnershipVo vo = new TotalOwnershipVo();
ParamsDto dto = new ParamsDto();
dto.setMaType(maType);
dto.setMaTypeName(maTypeName);
if ("2".equals(type)){
dto.setCompanyId(companyId);
}else {
dto.setCompanyId("");
}
// 在库数量
dto.setType("1");
List<ScrapAnalysisVo> zkValueList = mapper.getTotalOwnership(dto);
@ -331,6 +354,7 @@ public class LargeScreenServiceImpl implements ILargeScreenService {
}
return AjaxResult.success(list);
}
}

View File

@ -169,6 +169,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</if>
/*待入库 新购/修试*/
<if test="type == 2">
@ -185,6 +188,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
UNION ALL
SELECT rid.repair_num AS num,
rid.input_num AS num2,
@ -199,6 +205,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</where>
</if>
/*在用*/
@ -216,6 +225,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</where>
UNION ALL
SELECT bad.audit_num AS num,
@ -231,6 +243,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</where>
</if>
/*在修*/
@ -249,22 +264,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</where>
</if>
/*报废*/
<if test="type == 5">
SELECT sad.scrap_num AS num,
mt.type_name AS typeName
mt.type_name AS typeName
FROM scrap_apply_details sad
LEFT JOIN ma_type mt ON sad.type_id = mt.type_id AND mt.`level` = '4'
LEFT JOIN sys_dept sd ON sd.dept_id = mt.company_id
WHERE sad.status = '1'
<if test="maType!=null and maType == 1">
AND sd.dept_name = #{maTypeName}
</if>
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="maType!=null and maType == 1">
AND sd.dept_name = #{maTypeName}
</if>
<if test="maType!=null and maType == 2">
AND sd.dept_name = #{maTypeName}
</if>
<if test="companyId!=null and companyId !=''">
AND sd.dept_id = #{companyId}
</if>
</if>
</select>
<!--检修预警-->
@ -282,4 +303,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)a ON mm.type_id = a.type_id
WHERE mm.next_check_time BETWEEN #{startDate} AND #{endDate}
</select>
<select id="getCompany" resultType="com.bonus.sgzb.largeScreen.domain.TotalOwnershipVo">
SELECT
sd2.dept_id as companyId,
sd2.dept_name as companyName
FROM
sys_dept sd
LEFT JOIN sys_dept sd2 on sd2.parent_id=sd.dept_id
WHERE
sd.del_flag='0'
and sd2.del_flag='0'
and sd.parent_id='0'
</select>
</mapper>

View File

@ -13,8 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(subquery2.repairNum, 0) as repairNum,
IFNULL(subquery3.repairInputNum, 0) as repairInputNum,
IFNULL(subquery4.inputNum, 0) as inputNum,
IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0) +
IFNULL(subquery4.inputNum, 0) as allNum,
IFNULL(mt.num, 0) + IFNULL(subquery1.usNum, 0) + IFNULL(subquery2.repairNum, 0) + IFNULL(subquery3.repairInputNum, 0) as allNum,
CASE mt.manage_type
WHEN 0 THEN
'否'