Commit bb4a0a6d authored by 韩桐桐's avatar 韩桐桐

fix(cyl):删除多余方法

parent f1d62639
......@@ -21,9 +21,12 @@ public class CylinderTagsDataUnitDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "气瓶标签比")
@ApiModelProperty(value = "气瓶标签比(气瓶数量/标签数量)")
private String tagPercent;
@ApiModelProperty(value = "标签气瓶比(标签数量/气瓶数量,当一个气瓶含有电子标签,二维码标签等多个标签时,标签/气瓶最大比为100%)")
private String cylinderPercent;
@ApiModelProperty(value = "气瓶数量")
private Long cylinderSum;
......
......@@ -23,12 +23,18 @@ public class CylinderTagsDataUnit extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 气瓶标签比
* 气瓶标签比(气瓶数量/标签数量)
*/
@TableField("tag_percent")
private String tagPercent;
/**
* 标签气瓶比(标签数量/气瓶数量,当一个气瓶含有电子标签,二维码标签等多个标签时,标签/气瓶最大比为100%)
*/
@TableField("cylinder_percent")
private String cylinderPercent;
/**
* 气瓶数量
*/
@TableField("cylinder_sum")
......
......@@ -112,9 +112,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
int countNumber(@Param("status") String status, @Param("companyId") String companyId, @Param("regionCode") String regionCode);
Map<String, Object> countFillingTimesAndQuantityByCompany(@Param("companyId") String companyId, @Param("startTime") String startTime, @Param("endTime") String endTime);
List<CylinderInfoDto> queryCylinderOfInspectionOverdue(@Param("questionType") String questionType);
List<CylinderInfoDto> queryCylinderOfUnqualifiedQuestion(@Param("questionType") String questionType);
......
......@@ -392,22 +392,6 @@
</where>
</select>
<select id="countFillingTimesAndQuantityByCompany" resultType="java.util.Map">
SELECT COUNT(1) AS fillingTimes, ifnull(SUM(filling_quantity),0) AS fillingQuantity
FROM tz_cylinder_filling_record AS tcfr
<where>
tcfr."filling_endtime" <![CDATA[>=]]> (CURRENT_DATE - INTERVAL '31 days')
<if test="companyId != null and companyId != ''">
AND tcfr."app_id" = #{companyId}
</if>
<if test="startTime != null">
AND DATE_FORMAT(tcfr."filling_starttime",'%Y-%m-%d') <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime != null">
AND DATE_FORMAT(tcfr."filling_endtime",'%Y-%m-%d') <![CDATA[<=]]> #{endTime}
</if>
</where>
</select>
<select id="countFillingTimesAndQuantityByCity" resultType="java.util.Map">
SELECT regionCode AS regionCode,
......
......@@ -1350,16 +1350,6 @@ public class CylinderInfoController extends BaseController {
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "某个企业充装次数及累计充装量统计")
@GetMapping(value = "/countFillingTimesAndQuantityByCompany")
public ResponseModel<JSONObject> countFillingTimesAndQuantityByCompany(@RequestParam(value = "companyId") String companyId,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
return ResponseHelper.buildResponse(cylinderInfoServiceImpl.countFillingTimesAndQuantityByCompany(companyId, startTime, endTime));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "市级为维度,各市的充装次数和累计充装量,当前日期向前推31天的数据总和")
@GetMapping(value = "/countFillingTimesAndQuantityByCity")
......
......@@ -603,19 +603,27 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId, cylinderUnit.getAppId()));
int tags = cylinderTagsServiceImpl
.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId, cylinderUnit.getAppId()));
String percent = "";
String tagPercent = "";
String cylinderPercent = "";
if (tags != 0) {
double zz = (double) cylinder / (double) tags;
double tagPercentDouble = (double) cylinder / (double) tags;
DecimalFormat df = new DecimalFormat("##.00%");
if (Math.abs(zz) < 0.0000000000001) {
percent = "0.00%";
if (Math.abs(tagPercentDouble) < 0.0000000000001) {
tagPercent = "0.00%";
} else {
percent = df.format(zz);
tagPercent = df.format(tagPercentDouble);
}
double cylinderPercentDouble = (double) tags / (double) cylinder;
if (Math.abs(cylinderPercentDouble) < 0.0000000000001) {
cylinderPercent = "0.00%";
} else {
cylinderPercent =Math.abs(cylinderPercentDouble) > 1 ? "100%" : df.format(cylinderPercentDouble);
}
}
temp.setCylinderSum((long) cylinder);
temp.setTagsSum((long) tags);
temp.setTagPercent(percent);
temp.setTagPercent(tagPercent);
temp.setCylinderPercent(cylinderPercent);
cylinderTagsDataUnitServiceImpl.createWithModel(temp);
});
}
......@@ -1283,35 +1291,6 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
return cylinderInfoMapper.cyinderOutInfoList(page, cylinderInfoDto, sort, appids);
}
public JSONObject countFillingTimesAndQuantityByCompany(String companyId, String startTime, String endTime) {
Map<String, Object> stringObjectMap = cylinderInfoMapper.countFillingTimesAndQuantityByCompany(companyId, startTime, endTime);
// 组装成柱状图能渲染的格式
//{
// "seriesData": [
// {
// "data": [
// 3
// ],
// "name": "充装次数(次)"
// },
// {
// "data": [
// 1
// ],
// "name": "累计充装量(kg)"
// }
// ],
// "axisData": [
// "总数"
// ]
// }
String template = "{\"seriesData\": [{\"data\": [%s],\"name\": \"充装次数(次)\"},{\"data\": [%s],\"name\": \"累计充装量(kg)\"}],\"axisData\": [\"总数\"]}";
String format = String.format(template,
ObjectUtils.isEmpty(stringObjectMap.get("fillingTimes")) ? 0 : stringObjectMap.get("fillingTimes"),
ObjectUtils.isEmpty(stringObjectMap.get(FILLING_QUANTITY)) ? 0 : stringObjectMap.get(FILLING_QUANTITY));
return JSON.parseObject(format);
}
public Map<String, Object> countFillingTimesAndQuantityByCity() {
// 查询所有的市级城市
List<RegionModel> regionModelList = Systemctl.regionClient.queryByLevel("2").getResult();
......
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