Commit 67b7e471 authored by zhangsen's avatar zhangsen

装备报废 4 xiao xuqiu

parent c8ab169a
...@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService; ...@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService; import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -718,4 +719,70 @@ public class ConfigureController extends AbstractBaseController { ...@@ -718,4 +719,70 @@ public class ConfigureController extends AbstractBaseController {
} }
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquipExpiryStatistics")
@ApiOperation(httpMethod = "GET", value = "4小概览-韶山-临期设备统计", notes = "4小概览-韶山-临期设备统计")
public ResponseModel getEquipExpiryStatistics(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@ApiParam("临期天数-近多少天") @RequestParam(value = "expiryDayNum", required = false) Integer expiryDayNum) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
if (ObjectUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
expiryDayNum = Objects.isNull(expiryDayNum) ? 60 : expiryDayNum;
return CommonResponseUtil.success(iFireFightingSystemService.getEquipExpiryStatistics(bizOrgCode, expiryDayNum));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getEquipExpiryListByPage")
@ApiOperation(httpMethod = "GET", value = "4小概览-韶山-临期设备列表", notes = "4小概览-韶山-临期设备列表")
public ResponseModel getEquipExpiryListByPage(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@ApiParam("临期天数-近多少天") @RequestParam(value = "expiryDayNum", required = false) Integer expiryDayNum,
@RequestParam(value = "pageSize") Integer pageSize,
@RequestParam(value = "pageNum") Integer pageNum) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
if (ObjectUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
expiryDayNum = Objects.isNull(expiryDayNum) ? 60 : expiryDayNum;
Page page = new Page(pageNum, pageSize);
return CommonResponseUtil.success(iFireFightingSystemService.getEquipExpiryListByPage(bizOrgCode, expiryDayNum, page));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getStockEquipStatistics")
@ApiOperation(httpMethod = "GET", value = "4小概览-韶山-报废设备统计", notes = "4小概览-韶山-报废设备统计")
public ResponseModel getStockEquipStatistics(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
if (ObjectUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null);
}
// 重复列表组件只支持分页,所以组装数据
Page page = new Page(1, 4);
page.setTotal(4);
page.setRecords(iFireFightingSystemService.getStockEquipStatistics(bizOrgCode));
return CommonResponseUtil.success(page);
}
} }
...@@ -608,4 +608,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -608,4 +608,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
BigDecimal getWaterPoolLevelByEquipSpeId(@Param("equipSpeId") String equipSpeId); BigDecimal getWaterPoolLevelByEquipSpeId(@Param("equipSpeId") String equipSpeId);
List<Map<String, String>> getEquipExpiryStatistics(@Param("bizOrgCode") String bizOrgCode, @Param("expiryDayNum") Integer expiryDayNum);
Page<Map<String, String>> getEquipExpiryListByPage(@Param("page") Page page, @Param("bizOrgCode") String bizOrgCode, @Param("expiryDayNum") Integer expiryDayNum);
List<Map<String, Integer>> getStockEquipStatistics(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -288,4 +288,9 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -288,4 +288,9 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, Object>> getSystemInfo(Page page, String companyCode, String systemCode); Page<Map<String, Object>> getSystemInfo(Page page, String companyCode, String systemCode);
List<Map<String, String>> getEquipExpiryStatistics(String bizOrgCode, Integer expiryDayNum);
Page<Map<String, String>> getEquipExpiryListByPage(String bizOrgCode, Integer expiryDayNum, Page page);
List<Map<String, Integer>> getStockEquipStatistics(String bizOrgCode);
} }
...@@ -1999,4 +1999,19 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1999,4 +1999,19 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
return fireFightingSystemMapper.getSystemInfo(page, bizOrgCode, null); return fireFightingSystemMapper.getSystemInfo(page, bizOrgCode, null);
} }
@Override
public List<Map<String, String>> getEquipExpiryStatistics(String bizOrgCode, Integer expiryDayNum) {
return fireFightingSystemMapper.getEquipExpiryStatistics(bizOrgCode, expiryDayNum);
}
@Override
public Page<Map<String, String>> getEquipExpiryListByPage(String bizOrgCode, Integer expiryDayNum, Page page) {
return fireFightingSystemMapper.getEquipExpiryListByPage(page, bizOrgCode, expiryDayNum);
}
@Override
public List<Map<String, Integer>> getStockEquipStatistics(String bizOrgCode) {
return fireFightingSystemMapper.getStockEquipStatistics(bizOrgCode);
}
} }
...@@ -22,10 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -22,10 +22,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -128,6 +125,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements ...@@ -128,6 +125,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
StockDetail stockDetail = new StockDetail(); StockDetail stockDetail = new StockDetail();
stockDetail.setId(x.getStockDetailId()); stockDetail.setId(x.getStockDetailId());
stockDetail.setStatus("7"); stockDetail.setStatus("7");
stockDetail.setUpdateDate(new Date());
stockDetailIds.add(stockDetail); stockDetailIds.add(stockDetail);
}); });
//修改库存状态 //修改库存状态
......
...@@ -5042,4 +5042,126 @@ ...@@ -5042,4 +5042,126 @@
WHERE WHERE
equipment_specific_id = #{equipSpeId} equipment_specific_id = #{equipSpeId}
</select> </select>
<select id="getEquipExpiryStatistics" resultType="java.util.Map">
SELECT
a.equipSortName AS `name`,
count( 1 ) AS `value`
FROM
(
SELECT
es.id,
ed.`name`,
ed.standard,
DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ) AS passDate,
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) AS dayNum,
DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ) AS productDate,
e.`name` AS equipSortName,
e.id AS equipSortId
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.delivery_date IS NOT NULL
AND sd.`status` != 7
AND e.expiry_date IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) a
GROUP BY
a.equipSortId
</select>
<select id="getEquipExpiryListByPage" resultType="java.util.Map">
SELECT
es.id AS specificId,
ed.`name` AS specificName,
IFNULL( ed.standard, '' ) AS modelNumber,
DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ) AS passDate,
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) AS dayNum,
DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ) AS productDate,
e.`name` AS equipSortName,
e.id AS equipSortId,
IFNULL( ws.full_name, '' ) AS equipAddress
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.delivery_date IS NOT NULL
AND sd.`status` != 7
AND e.expiry_date IS NOT NULL
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0
AND #{expiryDayNum} >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
ORDER BY DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) ASC
</select>
<select id="getStockEquipStatistics" resultType="java.util.Map">
SELECT
'本月已报废' AS `content`,
(
SELECT
count( 1 )
FROM
wl_stock_detail sd
LEFT JOIN wl_equipment_specific es ON es.id = sd.equipment_specific_id
WHERE
sd.`status` = 7
AND update_date LIKE CONCAT( DATE_FORMAT( CURRENT_DATE, '%Y-%m' ), '%' )
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
) AS countNum UNION ALL
SELECT
'累计报废装备' AS `content`,
(
SELECT
count( 1 )
FROM
wl_stock_detail sd
LEFT JOIN wl_equipment_specific es ON es.id = sd.equipment_specific_id
WHERE
sd.`status` = 7
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
) AS countNum UNION ALL
SELECT
'超期未报废' AS `content`,
(
SELECT
count( es.id )
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.delivery_date IS NOT NULL
AND sd.`status` != 7
AND e.expiry_date IS NOT NULL
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND 0 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) AS countNum UNION ALL
SELECT
'近2月临期设备' AS `content`,
(
SELECT
count( es.id )
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.delivery_date IS NOT NULL
AND sd.`status` != 7
AND e.expiry_date IS NOT NULL
AND es.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) > 0
AND 60 >= DATEDIFF( DATE_ADD( DATE_FORMAT( ed.delivery_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE )
) AS countNum
</select>
</mapper> </mapper>
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