首页修改

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; IRmsDepartService rmsDepartService;
@Resource @Resource
IRmsChartService rmsChartService; IRmsChartService rmsChartService;
//获取数量 单位map
@GetMapping("getPieChart") @GetMapping("getPieChart")
public List<RmsPieChart> getPieChart(){ public List<RmsPieChart> getPieChart() {
return rmsDepartService.getPieChart(); return rmsDepartService.getPieChart();
} }
@GetMapping("getLocationName")
public String[] getLocationName() {
return rmsChartService.getLocationName();
}
//获取各地址的资产总数
@GetMapping("getChart") @GetMapping("getChart")
public List<Integer> getChart(){ public List<Integer> getChart() {
System.out.println("locationCount"+rmsChartService.getLocationCount());
return rmsChartService.getLocationCount(); return rmsChartService.getLocationCount();
} }
//获取仪器总数
@GetMapping("getInstrumentCount") @GetMapping("getInstrumentCount")
public int getInstrumentCount(){ public int getInstrumentCount() {
return rmsChartService.getInstrumentCount(); return rmsChartService.getInstrumentCount();
} }
//获取家具总数
@GetMapping("getFurnitureCount") @GetMapping("getFurnitureCount")
public int getFurnitureCount(){ public int getFurnitureCount() {
return rmsChartService.getFurnitureCount(); return rmsChartService.getFurnitureCount();
} }
//获取无形资产总数
@GetMapping("getIntangibleCount")
public int getIntangibleCount(){
return rmsChartService.getIntangibleCount();
}
//获取仪器总价
@GetMapping("getInstrumentAmount") @GetMapping("getInstrumentAmount")
public int getInstrumentAmount(){ public int getInstrumentAmount() {
return rmsChartService.getInstrumentAmount(); return rmsChartService.getInstrumentAmount();
} }
//获取家具总价
@GetMapping("getFurnitureAmount") @GetMapping("getFurnitureAmount")
public int getFurnitureAmount(){ public int getFurnitureAmount() {
return rmsChartService.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 pageNo
* @param pageSize * @param pageSize
* @param req * @param req

View File

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

View File

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

View File

@ -6,5 +6,7 @@ import java.util.List;
public interface RmsDepartMapper { public interface RmsDepartMapper {
List<String> getDepartName(); 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"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="rms.mapper.RmsChartMapper"> <mapper namespace="rms.mapper.RmsChartMapper">
<select id="getLocationName" resultType="java.lang.String">
<select id="getInstrumentCount" 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(*) SELECT count(*)
FROM rms_instrument FROM rms_instrument
JOIN rms_location ON rms_instrument.location_id = rms_location.id 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 JOIN rms_location ON rms_furniture.location_id = rms_location.id
WHERE location_name LIKE CONCAT(#{depart_name}, '%') WHERE location_name LIKE CONCAT(#{depart_name}, '%')
</select> </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 id="getInstrumentAmount" resultType="java.lang.Integer">
SELECT FLOOR(SUM(unit_price)) AS total_sum SELECT FLOOR(SUM(unit_price)) AS total_sum
FROM rms_instrument FROM rms_instrument
@ -22,4 +32,8 @@
SELECT FLOOR(SUM(amount)) AS total_sum SELECT FLOOR(SUM(amount)) AS total_sum
FROM rms_furniture FROM rms_furniture
</select> </select>
<select id="getIntangibleAmount" resultType="java.lang.Integer">
SELECT FLOOR(SUM(unit_price)) AS total_sum
FROM rms_intangible
</select>
</mapper> </mapper>

View File

@ -5,10 +5,22 @@
<select id="getDepartName" resultType="java.lang.String"> <select id="getDepartName" resultType="java.lang.String">
select depart_name from sys_depart select depart_name from sys_depart
</select> </select>
<select id="getValue" resultType="java.lang.String"> <select id="getInstrumentValue" resultType="java.lang.String">
SELECT count(*) SELECT count(*)
FROM rms_instrument FROM rms_instrument
JOIN sys_depart ON rms_instrument.collecting_unit_number = sys_depart.id JOIN sys_depart ON rms_instrument.collecting_unit_number = sys_depart.id
WHERE depart_name = #{depart_name} WHERE depart_name = #{depart_name}
</select> </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> </mapper>

View File

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

View File

@ -6,17 +6,36 @@ import rms.service.IRmsChartService;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Service @Service
public class RmsChartServiceImpl implements IRmsChartService { public class RmsChartServiceImpl implements IRmsChartService {
@Resource @Resource
RmsChartMapper rmsChartMapper; RmsChartMapper rmsChartMapper;
@Override
public String[] getLocationName() {
return rmsChartMapper.getLocationName();
}
@Override @Override
public List<Integer> getLocationCount() { public List<Integer> getLocationCount() {
String[] LocationNameList = {"理工一号楼","行知楼", "体育楼", "崇师楼","新实验楼","社科楼"}; String[] LocationNameList = getLocationName();
List<Integer> LocationCount = new ArrayList<>(); List<Integer> LocationCount = new ArrayList<>();
for(String locationName :LocationNameList){ double doubleFurnitureCount;
LocationCount.add(Integer.parseInt(rmsChartMapper.getInstrumentCount(locationName)) + Integer.parseInt(rmsChartMapper.getFurnitureCount(locationName))); 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; return LocationCount;
@ -24,28 +43,43 @@ public class RmsChartServiceImpl implements IRmsChartService {
@Override @Override
public int getInstrumentCount() { public int getInstrumentCount() {
String[] LocationNameList = {"理工一号楼","行知楼", "体育楼", "崇师楼","新实验楼","社科楼"}; String[] LocationNameList = getLocationName();
int sum = 0; int sum = 0;
for(String locationName :LocationNameList){ for (String locationName : LocationNameList) {
sum+= Integer.parseInt(rmsChartMapper.getInstrumentCount(locationName)); sum += rmsChartMapper.getInstrumentCount(locationName);
} }
return sum; return sum;
} }
@Override @Override
public int getFurnitureCount() { public int getFurnitureCount() {
String[] LocationNameList = {"理工一号楼","行知楼"}; String[] LocationNameList = getLocationName();
int sum = 0; int sum = 0;
for(String locationName :LocationNameList){ for (String locationName : LocationNameList) {
sum+= Integer.parseInt(rmsChartMapper.getFurnitureCount(locationName)); if (rmsChartMapper.getFurnitureCount(locationName) != null) {
System.out.println(locationName+"地址的数量"+sum); 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; return sum;
} }
@Override @Override
public int getInstrumentAmount() { public int getInstrumentAmount() {
return rmsChartMapper.getInstrumentAmount(); return rmsChartMapper.getInstrumentAmount();
} }
@Override @Override
@ -53,4 +87,9 @@ public class RmsChartServiceImpl implements IRmsChartService {
return rmsChartMapper.getFurnitureAmount(); 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() { public List<RmsPieChart> getPieChart() {
List<String> departNameList = rmsDepartMapper.getDepartName(); List<String> departNameList = rmsDepartMapper.getDepartName();
List<RmsPieChart> rmsPieChartList = new ArrayList<>(); 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 rmsPieChart = new RmsPieChart();
rmsPieChart.setValue(rmsDepartMapper.getValue(departName)); rmsPieChart.setValue(Integer.parseInt(rmsDepartMapper.getInstrumentValue(departName)) +
(int) doubleFurnitureCount +
(int) doubleIntangibleCount);
rmsPieChart.setName(departName); rmsPieChart.setName(departName);
rmsPieChartList.add(rmsPieChart); rmsPieChartList.add(rmsPieChart);
} }