Commit 47379ad3 authored by helinlin's avatar helinlin

修改气瓶系统bug

parent a44c3537
package com.yeejoin.amos.boot.module.tzs.config;
import org.springframework.context.annotation.Configuration;
/**
* @description:
* @author: tw
* @createDate: 2022/3/31
*/
@Configuration
public class MybatisPlusConfiguration {
/**
* plus分页插件支持
*/
/*@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return mybatisPlusInterceptor;
}*/
}
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
/** /**
...@@ -15,21 +16,32 @@ import java.util.Date; ...@@ -15,21 +16,32 @@ import java.util.Date;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="CylinderFillingCheckDataUnitDto", description="气瓶充装检查情况统计表-企业") @ApiModel(value = "CylinderFillingCheckDataUnitDto", description = "气瓶充装检查情况统计表-企业")
public class CylinderFillingCheckDataUnitDto extends BaseDto { public class CylinderFillingCheckDataUnitDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "充装次数") @ApiModelProperty(value = "充装次数")
private Long totalSum; private Long totalSum;
@ApiModelProperty(value = "充装次数*2(充装检查合格率组态配置temp字段)")
private Long totalSumDouble;
@ApiModelProperty(value = "充装前检查数")
private Long fillingCount;
@ApiModelProperty(value = "充装前检查率") @ApiModelProperty(value = "充装前检查率")
private Double fillingPercent; private Double fillingPercent;
@ApiModelProperty(value = "充装后检查数")
private Long fillingCheckCount;
@ApiModelProperty(value = "充装后检查率") @ApiModelProperty(value = "充装后检查率")
private Double fillingCheckPercent; private Double fillingCheckPercent;
@ApiModelProperty(value = "充装检查合格数")
private Long fillingPassedCount;
@ApiModelProperty(value = "充装检查合格率")
private Double fillingPassedPercent;
@ApiModelProperty(value = "企业编码") @ApiModelProperty(value = "企业编码")
private String appId; private String appId;
...@@ -41,8 +53,4 @@ public class CylinderFillingCheckDataUnitDto extends BaseDto { ...@@ -41,8 +53,4 @@ public class CylinderFillingCheckDataUnitDto extends BaseDto {
@ApiModelProperty(value = "充装月份") @ApiModelProperty(value = "充装月份")
private String fillingMonth; private String fillingMonth;
@ApiModelProperty(value = "充装检查合格率")
private Double fillingPassedPercent;
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date; import java.util.Date;
/** /**
...@@ -25,49 +26,71 @@ public class CylinderFillingCheckDataUnit extends BaseEntity { ...@@ -25,49 +26,71 @@ public class CylinderFillingCheckDataUnit extends BaseEntity {
/** /**
* 充装次数 * 充装次数
*/ */
@TableField("total_sum") @TableField("total_sum")
private Long totalSum; private Long totalSum;
/** /**
* 充装次数*2(充装检查合格率组态配置temp字段)
*/
@TableField("total_sum_double")
private Long totalSumDouble;
/**
* 充装前检查数
*/
@TableField("filling_count")
private Long fillingCount;
/**
* 充装前检查率 * 充装前检查率
*/ */
@TableField("filling_percent") @TableField("filling_percent")
private Double fillingPercent; private Double fillingPercent;
/** /**
* 充装后检查数
*/
@TableField("filling_check_count")
private Long fillingCheckCount;
/**
* 充装后检查率 * 充装后检查率
*/ */
@TableField("filling_check_percent") @TableField("filling_check_percent")
private Double fillingCheckPercent; private Double fillingCheckPercent;
/** /**
* 充装检查合格数
*/
@TableField("filling_passed_count")
private Long fillingPassedCount;
/**
* 充装检查合格率
*/
@TableField("filling_passed_percent")
private Double fillingPassedPercent;
/**
* 企业编码 * 企业编码
*/ */
@TableField("app_id") @TableField("app_id")
private String appId; private String appId;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField("update_time") @TableField("update_time")
private Date updateTime; private Date updateTime;
/** /**
* 充装年份 * 充装年份
*/ */
@TableField("filling_year") @TableField("filling_year")
private String fillingYear; private String fillingYear;
/** /**
* 充装月份 * 充装月份
*/ */
@TableField("filling_month") @TableField("filling_month")
private String fillingMonth; private String fillingMonth;
/**
* 充装检查合格率
*/
@TableField("filling_passed_percent")
private Double fillingPassedPercent;
} }
...@@ -437,7 +437,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -437,7 +437,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
} }
/** /**
* 装详情按单位统计 * 装详情按单位统计
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Scheduled(cron = "0 0 2 * * ?") @Scheduled(cron = "0 0 2 * * ?")
...@@ -456,22 +456,24 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -456,22 +456,24 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
String monthStr = month < 10 ? "0" + month : month + ""; String monthStr = month < 10 ? "0" + month : month + "";
temp.setFillingMonth(monthStr); temp.setFillingMonth(monthStr);
temp.setFillingYear(year); temp.setFillingYear(year);
Integer thisMonth = cylinderFillingRecordServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer countThisMonth = cylinderFillingRecordServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
temp.setTotalSum((long) thisMonth); temp.setTotalSum((long) countThisMonth);
// 获取本月数据 // 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingCheckCount = cylinderFillingCheckServiceImpl.getFillingCountByMonth(cylinderUnit.getAppId(), c.getTime());
// 充装前检查率:充装前检查次数/充装次数 // 充装前检查率:充装前检查次数/充装次数
double before = 0d; double before = 0d;
if (thisMonth != 0) { if (countThisMonth != 0) {
before = (double) (fillingCount) / (double) thisMonth; before = (double) (fillingCount) / (double) countThisMonth;
} }
temp.setFillingCount((long) fillingCount);
temp.setFillingPercent(before * 100); temp.setFillingPercent(before * 100);
// 充装后检查率:充装后检查次数/充装次数 // 充装后检查率:充装后检查次数/充装次数
double after = 0d; double after = 0d;
if (thisMonth != 0) { if (countThisMonth != 0) {
after = (double) (fillingCheckCount) / (double) thisMonth; after = (double) (fillingCheckCount) / (double) countThisMonth;
} }
temp.setFillingCheckCount((long) fillingCheckCount);
temp.setFillingCheckPercent(after * 100); temp.setFillingCheckPercent(after * 100);
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数 // 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
double passed = 0d; double passed = 0d;
...@@ -479,9 +481,11 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -479,9 +481,11 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
Integer fillingPassedCount = cylinderFillingServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingPassedCount = cylinderFillingServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime());
// 充装后检查合格次数 // 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime()); Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl.getFillingPassedCountByMonth(cylinderUnit.getAppId(), c.getTime());
if (thisMonth != 0) { if (countThisMonth != 0) {
passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) / (double) (2 * thisMonth); passed = ((double) (fillingPassedCount) + (double) fillingCheckPassedCount) / (double) (2 * countThisMonth);
} }
temp.setFillingPassedCount((long) (fillingPassedCount + fillingCheckPassedCount));
temp.setTotalSumDouble((long) 2 * countThisMonth);
temp.setFillingPassedPercent(passed * 100); temp.setFillingPassedPercent(passed * 100);
temp.setAppId(cylinderUnit.getAppId()); temp.setAppId(cylinderUnit.getAppId());
c.add(Calendar.MONTH, -1); c.add(Calendar.MONTH, -1);
......
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