首页修改

This commit is contained in:
xbx 2023-11-26 16:36:31 +08:00
parent 365d2159ec
commit 8bfbb0f9b7
10 changed files with 148 additions and 29 deletions

View File

@ -18,29 +18,55 @@ public class RmsDepartController {
IRmsDepartService rmsDepartService;
@Resource
IRmsChartService rmsChartService;
//获取数量 单位map
@GetMapping("getPieChart")
public List<RmsPieChart> getPieChart(){
public List<RmsPieChart> getPieChart() {
return rmsDepartService.getPieChart();
}
@GetMapping("getLocationName")
public String[] getLocationName() {
return rmsChartService.getLocationName();
}
//获取各地址的资产总数
@GetMapping("getChart")
public List<Integer> getChart(){
System.out.println("locationCount"+rmsChartService.getLocationCount());
public List<Integer> getChart() {
return rmsChartService.getLocationCount();
}
//获取仪器总数
@GetMapping("getInstrumentCount")
public int getInstrumentCount(){
public int getInstrumentCount() {
return rmsChartService.getInstrumentCount();
}
//获取家具总数
@GetMapping("getFurnitureCount")
public int getFurnitureCount(){
public int getFurnitureCount() {
return rmsChartService.getFurnitureCount();
}
//获取无形资产总数
@GetMapping("getIntangibleCount")
public int getIntangibleCount(){
return rmsChartService.getIntangibleCount();
}
//获取仪器总价
@GetMapping("getInstrumentAmount")
public int getInstrumentAmount(){
public int getInstrumentAmount() {
return rmsChartService.getInstrumentAmount();
}
//获取家具总价
@GetMapping("getFurnitureAmount")
public int getFurnitureAmount(){
public int getFurnitureAmount() {
return rmsChartService.getFurnitureAmount();
}
//获取无形资产总价
@GetMapping("getIntangibleAmount")
public int getIntangibleAmount() {
return rmsChartService.getIntangibleAmount();
}
}

View File

@ -42,7 +42,7 @@ public class RmsIntangibleController extends JeecgController<RmsIntangible, IRms
/**
* 分页列表查询
*
* @param rmsIntangible
* @param rmsIntangibleModel
* @param pageNo
* @param pageSize
* @param req

View File

@ -7,14 +7,14 @@ import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode()
public class RmsPieChart {
private String value;
private int value;
private String name;
public String getValue() {
public int getValue() {
return value;
}
public void setValue(String value) {
public void setValue(int value) {
this.value = value;
}

View File

@ -3,9 +3,12 @@ package rms.mapper;
import java.util.List;
public interface RmsChartMapper {
String getInstrumentCount(String locationName);
String[] getLocationName();
int getInstrumentCount(String locationName);
String getFurnitureCount(String locationName);
String getIntangibleCount(String locationName);
int getInstrumentAmount();
int getFurnitureAmount();
int getIntangibleAmount();
}

View File

@ -6,5 +6,7 @@ import java.util.List;
public interface RmsDepartMapper {
List<String> getDepartName();
String getValue(String depart_name);
String getInstrumentValue(String depart_name);
String getFurnitureValue(String depart_name);
String getIntangibleValue(String depart_name);
}

View File

@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="rms.mapper.RmsChartMapper">
<select id="getInstrumentCount" resultType="java.lang.String">
<select id="getLocationName" resultType="java.lang.String">
SELECT location_name
FROM rms_location
WHERE parent_location_id IS NULL
</select>
<select id="getInstrumentCount" resultType="java.lang.Integer">
SELECT count(*)
FROM rms_instrument
JOIN rms_location ON rms_instrument.location_id = rms_location.id
@ -14,6 +18,12 @@
JOIN rms_location ON rms_furniture.location_id = rms_location.id
WHERE location_name LIKE CONCAT(#{depart_name}, '%')
</select>
<select id="getIntangibleCount" resultType="java.lang.String">
SELECT count(*)
FROM rms_intangible
JOIN rms_location ON rms_intangible.location_id = rms_location.id
WHERE location_name LIKE CONCAT(#{depart_name}, '%')
</select>
<select id="getInstrumentAmount" resultType="java.lang.Integer">
SELECT FLOOR(SUM(unit_price)) AS total_sum
FROM rms_instrument
@ -22,4 +32,8 @@
SELECT FLOOR(SUM(amount)) AS total_sum
FROM rms_furniture
</select>
<select id="getIntangibleAmount" resultType="java.lang.Integer">
SELECT FLOOR(SUM(unit_price)) AS total_sum
FROM rms_intangible
</select>
</mapper>

View File

@ -5,10 +5,22 @@
<select id="getDepartName" resultType="java.lang.String">
select depart_name from sys_depart
</select>
<select id="getValue" resultType="java.lang.String">
<select id="getInstrumentValue" resultType="java.lang.String">
SELECT count(*)
FROM rms_instrument
JOIN sys_depart ON rms_instrument.collecting_unit_number = sys_depart.id
WHERE depart_name = #{depart_name}
</select>
<select id="getFurnitureValue" resultType="java.lang.String">
SELECT FLOOR(SUM(number)) AS total_sum
FROM rms_furniture
JOIN sys_depart ON rms_furniture.collecting_unit_number = sys_depart.id
WHERE depart_name = #{depart_name}
</select>
<select id="getIntangibleValue" resultType="java.lang.String">
SELECT count(*)
FROM rms_intangible
JOIN sys_depart ON rms_intangible.collecting_unit_number = sys_depart.id
WHERE depart_name = #{depart_name}
</select>
</mapper>

View File

@ -3,9 +3,20 @@ package rms.service;
import java.util.List;
public interface IRmsChartService {
//获取一级地址集合
String[] getLocationName();
//获取各地址的资产总数
List<Integer> getLocationCount();
//获取仪器总数
int getInstrumentCount();
//获取家具总数
int getFurnitureCount();
//获取无形资产总数
int getIntangibleCount();
//获取仪器总价格
int getInstrumentAmount();
//获取家具总价
int getFurnitureAmount();
//获取无形资产总价
int getIntangibleAmount();
}

View File

@ -6,17 +6,36 @@ import rms.service.IRmsChartService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Service
public class RmsChartServiceImpl implements IRmsChartService {
@Resource
RmsChartMapper rmsChartMapper;
@Override
public String[] getLocationName() {
return rmsChartMapper.getLocationName();
}
@Override
public List<Integer> getLocationCount() {
String[] LocationNameList = {"理工一号楼","行知楼", "体育楼", "崇师楼","新实验楼","社科楼"};
String[] LocationNameList = getLocationName();
List<Integer> LocationCount = new ArrayList<>();
for(String locationName :LocationNameList){
LocationCount.add(Integer.parseInt(rmsChartMapper.getInstrumentCount(locationName)) + Integer.parseInt(rmsChartMapper.getFurnitureCount(locationName)));
double doubleFurnitureCount;
double doubleIntangibleCount;
for (String locationName : LocationNameList) {
doubleFurnitureCount = 0;
doubleIntangibleCount = 0;
if (rmsChartMapper.getFurnitureCount(locationName) != null) {
doubleFurnitureCount = Double.parseDouble(rmsChartMapper.getFurnitureCount(locationName));
}
if (rmsChartMapper.getIntangibleCount(locationName) != null) {
doubleIntangibleCount = Double.parseDouble(rmsChartMapper.getIntangibleCount(locationName));
}
LocationCount.add(rmsChartMapper.getInstrumentCount(locationName) + (int) doubleFurnitureCount +
(int) doubleIntangibleCount);
}
return LocationCount;
@ -24,21 +43,36 @@ public class RmsChartServiceImpl implements IRmsChartService {
@Override
public int getInstrumentCount() {
String[] LocationNameList = {"理工一号楼","行知楼", "体育楼", "崇师楼","新实验楼","社科楼"};
String[] LocationNameList = getLocationName();
int sum = 0;
for(String locationName :LocationNameList){
sum+= Integer.parseInt(rmsChartMapper.getInstrumentCount(locationName));
for (String locationName : LocationNameList) {
sum += rmsChartMapper.getInstrumentCount(locationName);
}
return sum;
}
@Override
public int getFurnitureCount() {
String[] LocationNameList = {"理工一号楼","行知楼"};
String[] LocationNameList = getLocationName();
int sum = 0;
for(String locationName :LocationNameList){
sum+= Integer.parseInt(rmsChartMapper.getFurnitureCount(locationName));
System.out.println(locationName+"地址的数量"+sum);
for (String locationName : LocationNameList) {
if (rmsChartMapper.getFurnitureCount(locationName) != null) {
double doubleValue = Double.parseDouble(rmsChartMapper.getFurnitureCount(locationName));
sum += (int) doubleValue;
}
}
return sum;
}
@Override
public int getIntangibleCount() {
String[] LocationNameList = getLocationName();
int sum = 0;
for (String locationName : LocationNameList) {
if (rmsChartMapper.getIntangibleCount(locationName) != null) {
double doubleValue = Double.parseDouble(rmsChartMapper.getIntangibleCount(locationName));
sum += (int) doubleValue;
}
}
return sum;
}
@ -53,4 +87,9 @@ public class RmsChartServiceImpl implements IRmsChartService {
return rmsChartMapper.getFurnitureAmount();
}
@Override
public int getIntangibleAmount() {
return rmsChartMapper.getIntangibleAmount();
}
}

View File

@ -20,9 +20,21 @@ public class RmsDepartServiceImpl implements IRmsDepartService {
public List<RmsPieChart> getPieChart() {
List<String> departNameList = rmsDepartMapper.getDepartName();
List<RmsPieChart> rmsPieChartList = new ArrayList<>();
for(String departName : departNameList){
double doubleFurnitureCount;
double doubleIntangibleCount;
for (String departName : departNameList) {
doubleFurnitureCount = 0;
doubleIntangibleCount = 0;
if (rmsDepartMapper.getFurnitureValue(departName) != null) {
doubleFurnitureCount = Double.parseDouble(rmsDepartMapper.getFurnitureValue(departName));
}
if (rmsDepartMapper.getIntangibleValue(departName) != null) {
doubleIntangibleCount = Double.parseDouble(rmsDepartMapper.getIntangibleValue(departName));
}
RmsPieChart rmsPieChart = new RmsPieChart();
rmsPieChart.setValue(rmsDepartMapper.getValue(departName));
rmsPieChart.setValue(Integer.parseInt(rmsDepartMapper.getInstrumentValue(departName)) +
(int) doubleFurnitureCount +
(int) doubleIntangibleCount);
rmsPieChart.setName(departName);
rmsPieChartList.add(rmsPieChart);
}