diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysPropertynumController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysPropertynumController.java index b4db319..3b966f5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysPropertynumController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/SysPropertynumController.java @@ -9,6 +9,9 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.TdPropertyInfo; import com.ruoyi.system.domain.TdPropertyManager; +import com.ruoyi.system.domain.count.PropertyDesCountDTO; +import com.ruoyi.system.domain.count.PropertyStateCountDTO; +import com.ruoyi.system.domain.count.UserCountDTO; import com.ruoyi.system.domain.count.UserSmCountDTO; import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ITdPropertyInfoService; @@ -20,6 +23,7 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -101,4 +105,59 @@ public class SysPropertynumController extends BaseController { return AjaxResult.success(obj); } + private List bf = Arrays.asList("未报废", "已报废"); + + private List xh = Arrays.asList("未销毁", "已销毁"); + + /** + * + * 统计资产报废统计 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @PostMapping("/countBF") + @ResponseBody + public AjaxResult countbf() { + PropertyStateCountDTO propertyStateCountDTO = tdPropertyInfoService.selectCountBF(); + List datas = bf.stream() + .map(name -> { + AtomicReference value = new AtomicReference<>(0L); + if("未报废".equals(name)){ + value.set(propertyStateCountDTO.getWbf()); + }else{ + value.set(propertyStateCountDTO.getYbf()); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("value", value.get()); + jsonObject.put("name", name); + return jsonObject; + }) + .collect(Collectors.toList()); + return AjaxResult.success(datas); + } + /** + * + * 统计资产销毁统计 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @PostMapping("/countXH") + @ResponseBody + public AjaxResult countXH() { + PropertyDesCountDTO propertyDesCountDTO = tdPropertyInfoService.selectCountXH(); + List datas = xh.stream() + .map(name -> { + AtomicReference value = new AtomicReference<>(0L); + if("未销毁".equals(name)){ + value.set(propertyDesCountDTO.getWxh()); + }else{ + value.set(propertyDesCountDTO.getYxh()); + } + JSONObject jsonObject = new JSONObject(); + jsonObject.put("value", value.get()); + jsonObject.put("name", name); + return jsonObject; + }) + .collect(Collectors.toList()); + return AjaxResult.success(datas); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/property/TdPropertyManagerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/property/TdPropertyManagerController.java index 4af7e8d..72da46b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/property/TdPropertyManagerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/property/TdPropertyManagerController.java @@ -3,6 +3,7 @@ package com.ruoyi.web.controller.system.property; import java.util.Collections; import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.utils.uuid.Seq; import com.ruoyi.system.domain.TdPropertyInfo; import com.ruoyi.system.service.ITdPropertyInfoService; @@ -141,6 +142,9 @@ public class TdPropertyManagerController extends BaseController @ResponseBody public AjaxResult remove(String ids) { + QueryWrapper queryWrapper= new QueryWrapper(); + queryWrapper.in("use_id",ids.split(",")); + tdPropertyInfoService.remove(queryWrapper); return toAjax(tdPropertyManagerService.deleteTdPropertyManagerByUseIds(ids)); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/PropertyDesCountDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/PropertyDesCountDTO.java new file mode 100644 index 0000000..97b8a7a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/PropertyDesCountDTO.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.domain.count; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel(value="资产销毁统计", description="资产销毁统计") +public class PropertyDesCountDTO implements Serializable { + + @ApiModelProperty(value = "未销毁") + private Integer wxh; + + @ApiModelProperty(value = "已销毁") + private Integer yxh; +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/PropertyStateCountDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/PropertyStateCountDTO.java new file mode 100644 index 0000000..095a4fd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/count/PropertyStateCountDTO.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.domain.count; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel(value="资产报废统计", description="资产报废统计") +public class PropertyStateCountDTO implements Serializable { + + @ApiModelProperty(value = "未报废") + private Integer wbf; + + @ApiModelProperty(value = "已报废") + private Integer ybf; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdPropertyInfoMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdPropertyInfoMapper.java index 729c17c..d60c16a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdPropertyInfoMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TdPropertyInfoMapper.java @@ -4,6 +4,9 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.domain.TdPropertyInfo; +import com.ruoyi.system.domain.count.PropertyDesCountDTO; +import com.ruoyi.system.domain.count.PropertyStateCountDTO; +import com.ruoyi.system.domain.count.UserCountDTO; /** * 资产管理Mapper接口 @@ -62,4 +65,8 @@ public interface TdPropertyInfoMapper extends BaseMapper * @return 结果 */ public int deleteTdPropertyInfoByIds(String[] ids); + + public PropertyStateCountDTO selectCountBF(); + + public PropertyDesCountDTO selectCountXH(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdPropertyInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdPropertyInfoService.java index c0ca4ef..952d2ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdPropertyInfoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ITdPropertyInfoService.java @@ -4,6 +4,9 @@ import java.util.List; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.domain.TdPropertyInfo; +import com.ruoyi.system.domain.count.PropertyDesCountDTO; +import com.ruoyi.system.domain.count.PropertyStateCountDTO; +import com.ruoyi.system.domain.count.UserCountDTO; /** * 资产管理Service接口 @@ -62,4 +65,8 @@ public interface ITdPropertyInfoService extends IService * @return 结果 */ public int deleteTdPropertyInfoById(String id); + + public PropertyStateCountDTO selectCountBF(); + + public PropertyDesCountDTO selectCountXH(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdPropertyInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdPropertyInfoServiceImpl.java index a91401d..9d2d639 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdPropertyInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TdPropertyInfoServiceImpl.java @@ -3,6 +3,8 @@ package com.ruoyi.system.service.impl; import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.system.domain.count.PropertyDesCountDTO; +import com.ruoyi.system.domain.count.PropertyStateCountDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.TdPropertyInfoMapper; @@ -99,4 +101,14 @@ public class TdPropertyInfoServiceImpl extends ServiceImpl + + + \ No newline at end of file