Commit a8d81784 authored by 刘凡's avatar 刘凡

修改:统计新增操作人界数据

parent 9611b135
...@@ -44,4 +44,6 @@ public interface CylinderAreaDataMapper extends BaseMapper<CylinderAreaData> { ...@@ -44,4 +44,6 @@ public interface CylinderAreaDataMapper extends BaseMapper<CylinderAreaData> {
List<CylinderInfoStatisticsDto> getCylinderStatisticsDataByCity(String orgCode); List<CylinderInfoStatisticsDto> getCylinderStatisticsDataByCity(String orgCode);
List<Map<String, Object>> getQiZhanStatisticsDataByCity(@Param(value = "orgCodes") List<String> orgCodes); List<Map<String, Object>> getQiZhanStatisticsDataByCity(@Param(value = "orgCodes") List<String> orgCodes);
Long getOpertorStatisticsDataByCity(@Param(value = "orgCodes") List<String> orgCodes);
} }
...@@ -141,4 +141,22 @@ ...@@ -141,4 +141,22 @@
a.orgCode a.orgCode
</select> </select>
<select id="getOpertorStatisticsDataByCity" resultType="Long">
SELECT
count(1)
FROM
tz_base_enterprise_info u
RIGHT JOIN tzs_user_info ui ON ui.unit_code = u.use_code
WHERE
u.data_sources = '陕西省内企业'
AND u.unit_type LIKE'%充装单位%'
AND ui.post like '%"6552"%'
<if test="orgCodes != null and orgCodes.size > 0">
AND
<foreach collection="orgCodes" open="(" item="orgCode" close=")" separator=" or ">
(u.org_code like concat(#{orgCode}, '%') )
</foreach>
</if>
</select>
</mapper> </mapper>
...@@ -1464,7 +1464,7 @@ public class CylinderInfoController extends BaseController { ...@@ -1464,7 +1464,7 @@ public class CylinderInfoController extends BaseController {
public ResponseModel<IPage<CylinderFillingMessageModel>> getUploadCylinderLogs(PageParam pageParam, String regionCode ) { public ResponseModel<IPage<CylinderFillingMessageModel>> getUploadCylinderLogs(PageParam pageParam, String regionCode ) {
IPage<CylinderFillingMessageModel> result = cylinderFillingMessageService.getUploadCylinderLogs(pageParam, regionCode); IPage<CylinderFillingMessageModel> result = cylinderFillingMessageService.getUploadCylinderLogs(pageParam, regionCode);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}; }
} }
...@@ -25,6 +25,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -25,6 +25,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import joptsimple.internal.Strings; import joptsimple.internal.Strings;
import org.apache.lucene.search.comparators.DoubleComparator;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
...@@ -599,7 +600,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -599,7 +600,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("cylindersCount", qiping); result.put("cylindersCount", qiping);
result.put("stationCount", unitNumber); result.put("stationCount", unitNumber);
result.put("operatorCount", 0); result.put("operatorCount", this.baseMapper.getOpertorStatisticsDataByCity(orgCodes));
return result; return result;
} }
...@@ -735,9 +736,12 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -735,9 +736,12 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
} }
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result.put("xdata", xdata); List<Map<String, String>> data = new ArrayList<>();
List<String> ydata = new ArrayList<>();
// List<String> ydata = new ArrayList<>();
for (int i = 0; i < xdata.size(); i++) { for (int i = 0; i < xdata.size(); i++) {
Map<String, String> item = new HashMap<>();
item.put("name", xdata.get(i));
// 计算xuke的加权值 // 计算xuke的加权值
double xukeWeighted = Double.parseDouble(xuke.get(i)) * 0.10; // 10% double xukeWeighted = Double.parseDouble(xuke.get(i)) * 0.10; // 10%
...@@ -753,10 +757,27 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -753,10 +757,27 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
// 计算总指数 // 计算总指数
double totalIndex = xukeWeighted + jianyanchaoqiWeighted + jianyanhegeWeighted + czjcWeighted + czjchegeWeighted; double totalIndex = xukeWeighted + jianyanchaoqiWeighted + jianyanhegeWeighted + czjcWeighted + czjchegeWeighted;
item.put("value",String.format("%.2f", totalIndex));
data.add(item);
// ydata.add(String.format("%.2f", totalIndex));
}
ydata.add(String.format("%.2f", totalIndex)); data = data.stream()
.filter(map -> map.containsKey("value")) // 确保每个Map都包含指定的键
.sorted(Comparator.comparingDouble(map -> {
// 检查并解析值,如果失败则返回Double.MIN_VALUE(或根据需要处理)
try {
return Double.parseDouble(map.get("value"));
} catch (NumberFormatException e) {
// 处理无法解析为double的情况,这里返回Double.MIN_VALUE表示最小
// 或者可以抛出自定义异常,记录日志等
return Double.MIN_VALUE;
} }
result.put("ydata", ydata); }))
.collect(Collectors.toList());
result.put("xdata", data.stream().map(map -> map.get("name")).collect(Collectors.toList()));
result.put("ydata", data.stream().map(map -> map.get("value")).collect(Collectors.toList()));
return result; return result;
} }
} }
\ No newline at end of file
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