Commit 91cdcdfd authored by kongfm's avatar kongfm

气瓶相关功能开发

parent c813673b
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 气瓶充装总量统计表-企业
*
* @author system_generator
* @date 2022-03-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="CylinderFillingDataUnitDto", description="气瓶充装总量统计表-企业")
public class CylinderFillingDataUnitDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "上月充装量")
private Double totalSum;
@ApiModelProperty(value = "充装量增减量")
private Double changeSum;
@ApiModelProperty(value = "增减环比")
private String changePercent;
@ApiModelProperty(value = "企业编码")
private String appId;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "充装年份")
private String fillingYear;
@ApiModelProperty(value = "充装月份")
private String fillingMonth;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 气瓶总量统计表-企业
*
* @author system_generator
* @date 2022-03-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="CylinderInfoDataUnitDto", description="气瓶总量统计表-企业")
public class CylinderInfoDataUnitDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "气瓶总量")
private Long totalSum;
@ApiModelProperty(value = "气瓶增减数量")
private Long changeSum;
@ApiModelProperty(value = "增减环比")
private String changePercent;
@ApiModelProperty(value = "企业编码")
private String appId;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
}
......@@ -22,7 +22,7 @@ public class CylinderTagsDataUnitDto extends BaseDto {
@ApiModelProperty(value = "气瓶标签比")
private Double percent;
private Double tagPercent;
@ApiModelProperty(value = "气瓶数量")
private Long cylinderSum;
......
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 气瓶充装总量统计表-企业
*
* @author system_generator
* @date 2022-03-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_cylinder_filling_data_unit")
public class CylinderFillingDataUnit extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 上月充装量
*/
@TableField("total_sum")
private Double totalSum;
/**
* 充装量增减量
*/
@TableField("change_sum")
private Double changeSum;
/**
* 增减环比
*/
@TableField("change_percent")
private String changePercent;
/**
* 企业编码
*/
@TableField("app_id")
private String appId;
/**
* 更新时间
*/
@TableField("update_time")
private Date updateTime;
/**
* 充装年份
*/
@TableField("filling_year")
private String fillingYear;
/**
* 充装月份
*/
@TableField("filling_month")
private String fillingMonth;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 气瓶总量统计表-企业
*
* @author system_generator
* @date 2022-03-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_cylinder_info_data_unit")
public class CylinderInfoDataUnit extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 气瓶总量
*/
@TableField("total_sum")
private Long totalSum;
/**
* 气瓶增减数量
*/
@TableField("change_sum")
private Long changeSum;
/**
* 增减环比
*/
@TableField("change_percent")
private String changePercent;
/**
* 企业编码
*/
@TableField("app_id")
private String appId;
/**
* 更新时间
*/
@TableField("update_time")
private Date updateTime;
}
......@@ -25,8 +25,8 @@ public class CylinderTagsDataUnit extends BaseEntity {
/**
* 气瓶标签比
*/
@TableField("percent")
private Double percent;
@TableField("tag_percent")
private Double tagPercent;
/**
* 气瓶数量
......
......@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingCheck;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* 液化气体气瓶充装信息-充装后复查 Mapper 接口
......@@ -12,4 +15,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface CylinderFillingCheckMapper extends BaseMapper<CylinderFillingCheck> {
Double queryIntegirtyByAppId(String appId);
Integer getFillingCountByMonth(@Param("appId") String appId, @Param("time") Date time);
Integer getFillingPassedCountByMonth(@Param("appId") String appId, @Param("time") Date time);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingDataUnit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 气瓶充装总量统计表-企业 Mapper 接口
*
* @author system_generator
* @date 2022-03-14
*/
public interface CylinderFillingDataUnitMapper extends BaseMapper<CylinderFillingDataUnit> {
}
......@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFilling;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
/**
* 气瓶充装信息--充装前检查 Mapper 接口
......@@ -12,4 +15,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface CylinderFillingMapper extends BaseMapper<CylinderFilling> {
Double queryIntegirtyByAppId(String appId);
Integer getFillingCountByMonth(@Param("appId") String appId, @Param("time") Date time);
Integer getFillingPassedCountByMonth(@Param("appId") String appId, @Param("time") Date time);
}
......@@ -45,4 +45,9 @@ public interface CylinderFillingRecordMapper extends BaseMapper<CylinderFillingR
@Param("appId") String appId
);
Double getFillingSumByMonth(@Param("appId") String appId,@Param("time") Date time);
Integer getFillingCountByMonth(@Param("appId") String appId,@Param("time") Date time);
Double getFillingSumByDate(@Param("appId") String appId,@Param("time") Date time);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfoDataUnit;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 气瓶总量统计表-企业 Mapper 接口
*
* @author system_generator
* @date 2022-03-14
*/
public interface CylinderInfoDataUnitMapper extends BaseMapper<CylinderInfoDataUnit> {
}
......@@ -44,4 +44,16 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
Double queryIntegirtyByAppId(@Param("appId") String appId);
Integer getWarnNum(String code);
/**
* 获取上个月气瓶总量-APPID
* @return
*/
Integer getLastMonthInfoTotalUnit(@Param("appId") String appId);
/**
* 获取上上个月气瓶总量-APPID
* @return
*/
Integer getMonthBeforeLastInfoTotalUnit(@Param("appId")String appId);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 气瓶充装总量统计表-企业接口类
*
* @author system_generator
* @date 2022-03-14
*/
public interface ICylinderFillingDataUnitService {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 气瓶总量统计表-企业接口类
*
* @author system_generator
* @date 2022-03-14
*/
public interface ICylinderInfoDataUnitService {
}
......@@ -6,4 +6,18 @@
SELECT AVG(integrity) AS score_avg FROM tz_cylinder_filling_check t where t.app_id = #{appId} AND
DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(t.sync_date);
</select>
<select id="getFillingCountByMonth" resultType="java.lang.Integer">
select count(1) from tz_cylinder_filling_check r where date_format(r.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
<select id="getFillingPassedCountByMonth" resultType="java.lang.Integer">
select
IFNULL(
sum(
case c.within_scope+c.sealed_state+c.defective+c.abnormal_temperature+c.warning_sign
when 5 then 1
else
0 end ), 0) from tz_cylinder_filling_check c where date_format(c.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
</mapper>
<?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="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderFillingDataUnitMapper">
</mapper>
......@@ -6,4 +6,17 @@
SELECT AVG(integrity) AS score_avg FROM tz_cylinder_filling t where t.app_id = #{appId} AND
DATE_SUB(CURDATE(), INTERVAL 30 DAY) <![CDATA[ <= ]]> date(t.sync_date);
</select>
<select id="getFillingCountByMonth" resultType="java.lang.Integer">
select count(1) from tz_cylinder_filling r where date_format(r.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
<select id="getFillingPassedCountByMonth" resultType="java.lang.Integer">
select
IFNULL(
sum(
case f.is_valid+f.same+f.is_regulations+f.is_complete+f.have_still_pressure+f.is_complete+f.have_security_documents
when 7 then 1
else
0 end ),0) from tz_cylinder_filling f where date_format(f.inspection_date,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
</mapper>
......@@ -119,4 +119,15 @@
</if>
</select>
<select id="getFillingSumByMonth" resultType="java.lang.Double">
select ifnull(sum(r.filling_quantity),0) from tz_cylinder_filling_record r where date_format(r.filling_endTime,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
<select id="getFillingSumByDate" resultType="java.lang.Double">
select ifnull(sum(r.filling_quantity),0) from tz_cylinder_filling_record r where date_format(r.filling_endTime,'%Y-%m-%d') = date_format(#{time},'%Y-%m-%d') and app_id = #{appId}
</select>
<select id="getFillingCountByMonth" resultType="java.lang.Integer">
select count(1) from tz_cylinder_filling_record r where date_format(r.filling_endTime,'%Y-%m') = date_format(#{time},'%Y-%m') and app_id = #{appId}
</select>
</mapper>
<?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="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoDataUnitMapper">
</mapper>
......@@ -49,4 +49,13 @@
)
</select>
<select id="getLastMonthInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =1 AND app_id = #{appId}
</select>
<select id="getMonthBeforeLastInfoTotalUnit" resultType="java.lang.Integer">
select IFNULL(count(sequence_nbr), 0) from tz_cylinder_info where PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( sync_date, '%Y%m' ) ) =2 AND app_id = #{appId}
</select>
</mapper>
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderFillingDataUnitServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingDataUnitDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 气瓶充装总量统计表-企业
*
* @author system_generator
* @date 2022-03-14
*/
@RestController
@Api(tags = "气瓶充装总量统计表-企业Api")
@RequestMapping(value = "/cylinder-filling-data-unit")
public class CylinderFillingDataUnitController extends BaseController {
@Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
/**
* 新增气瓶充装总量统计表-企业
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增气瓶充装总量统计表-企业", notes = "新增气瓶充装总量统计表-企业")
public ResponseModel<CylinderFillingDataUnitDto> save(@RequestBody CylinderFillingDataUnitDto model) {
model = cylinderFillingDataUnitServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶充装总量统计表-企业", notes = "根据sequenceNbr更新气瓶充装总量统计表-企业")
public ResponseModel<CylinderFillingDataUnitDto> updateBySequenceNbrCylinderFillingDataUnit(@RequestBody CylinderFillingDataUnitDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(cylinderFillingDataUnitServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除气瓶充装总量统计表-企业", notes = "根据sequenceNbr删除气瓶充装总量统计表-企业")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(cylinderFillingDataUnitServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个气瓶充装总量统计表-企业", notes = "根据sequenceNbr查询单个气瓶充装总量统计表-企业")
public ResponseModel<CylinderFillingDataUnitDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(cylinderFillingDataUnitServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "气瓶充装总量统计表-企业分页查询", notes = "气瓶充装总量统计表-企业分页查询")
public ResponseModel<Page<CylinderFillingDataUnitDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<CylinderFillingDataUnitDto> page = new Page<CylinderFillingDataUnitDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(cylinderFillingDataUnitServiceImpl.queryForCylinderFillingDataUnitPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "气瓶充装总量统计表-企业列表全部数据查询", notes = "气瓶充装总量统计表-企业列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<CylinderFillingDataUnitDto>> selectForList() {
return ResponseHelper.buildResponse(cylinderFillingDataUnitServiceImpl.queryForCylinderFillingDataUnitList());
}
}
......@@ -677,4 +677,87 @@ public class CylinderInfoController extends BaseController {
}
/**
* 企业气瓶总量数据同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitCylinderInfoData")
@ApiOperation(httpMethod = "GET", value = "企业气瓶总量数据同步", notes = "企业气瓶总量数据同步")
public ResponseModel<Boolean> synUnitCylinderInfoData() {
Boolean flag = cylinderInfoServiceImpl.synUnitCylinderInfoData();
return ResponseHelper.buildResponse(flag);
}
/**
* 企业气瓶充装数据同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitCylinderFillingData")
@ApiOperation(httpMethod = "GET", value = "企业气瓶充装数据同步", notes = "企业气瓶充装数据同步")
public ResponseModel<Boolean> synUnitCylinderFillingData() {
Boolean flag = cylinderInfoServiceImpl.synUnitCylinderFillingData();
return ResponseHelper.buildResponse(flag);
}
/**
* 企业气瓶标签数量比同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitCylinderTagsData")
@ApiOperation(httpMethod = "GET", value = "企业气瓶标签数量比同步", notes = "企业气瓶标签数量比同步")
public ResponseModel<Boolean> synUnitCylinderTagsData() {
Boolean flag = cylinderInfoServiceImpl.synUnitCylinderTagsData();
return ResponseHelper.buildResponse(flag);
}
/**
* 企业数据完整度同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitIntegrityData")
@ApiOperation(httpMethod = "GET", value = "企业数据完整度同步", notes = "企业数据完整度同步")
public ResponseModel<Boolean> synUnitIntegrityData() {
Boolean flag = cylinderInfoServiceImpl.synUnitIntegrityData();
return ResponseHelper.buildResponse(flag);
}
/**
* 气瓶充装检查情况同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synUnitFillingCheckData")
@ApiOperation(httpMethod = "GET", value = "气瓶充装检查情况同步", notes = "气瓶充装检查情况同步")
public ResponseModel<Boolean> synUnitFillingCheckData() {
Boolean flag = cylinderInfoServiceImpl.synUnitFillingCheckData();
return ResponseHelper.buildResponse(flag);
}
/**
* 装卸液体企业数据同步
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/synFillingUnloadUnitData")
@ApiOperation(httpMethod = "GET", value = "装卸液体企业数据同步", notes = "装卸液体企业数据同步")
public ResponseModel<Boolean> synFillingUnloadUnitData() {
Boolean flag = cylinderInfoServiceImpl.synFillingUnloadUnitData();
return ResponseHelper.buildResponse(flag);
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoDataUnitServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDataUnitDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 气瓶总量统计表-企业
*
* @author system_generator
* @date 2022-03-14
*/
@RestController
@Api(tags = "气瓶总量统计表-企业Api")
@RequestMapping(value = "/cylinder-info-data-unit")
public class CylinderInfoDataUnitController extends BaseController {
@Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
/**
* 新增气瓶总量统计表-企业
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增气瓶总量统计表-企业", notes = "新增气瓶总量统计表-企业")
public ResponseModel<CylinderInfoDataUnitDto> save(@RequestBody CylinderInfoDataUnitDto model) {
model = cylinderInfoDataUnitServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶总量统计表-企业", notes = "根据sequenceNbr更新气瓶总量统计表-企业")
public ResponseModel<CylinderInfoDataUnitDto> updateBySequenceNbrCylinderInfoDataUnit(@RequestBody CylinderInfoDataUnitDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(cylinderInfoDataUnitServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除气瓶总量统计表-企业", notes = "根据sequenceNbr删除气瓶总量统计表-企业")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(cylinderInfoDataUnitServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个气瓶总量统计表-企业", notes = "根据sequenceNbr查询单个气瓶总量统计表-企业")
public ResponseModel<CylinderInfoDataUnitDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(cylinderInfoDataUnitServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "气瓶总量统计表-企业分页查询", notes = "气瓶总量统计表-企业分页查询")
public ResponseModel<Page<CylinderInfoDataUnitDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<CylinderInfoDataUnitDto> page = new Page<CylinderInfoDataUnitDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(cylinderInfoDataUnitServiceImpl.queryForCylinderInfoDataUnitPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "气瓶总量统计表-企业列表全部数据查询", notes = "气瓶总量统计表-企业列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<CylinderInfoDataUnitDto>> selectForList() {
return ResponseHelper.buildResponse(cylinderInfoDataUnitServiceImpl.queryForCylinderInfoDataUnitList());
}
}
......@@ -7,6 +7,8 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingCheckDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Date;
import java.util.List;
/**
......@@ -34,4 +36,12 @@ public class CylinderFillingCheckServiceImpl extends BaseService<CylinderFilling
public Double queryIntegirtyByAppId(String appId) {
return this.baseMapper.queryIntegirtyByAppId(appId);
}
public Integer getFillingCountByMonth(String appId, Date time) {
return this.baseMapper.getFillingCountByMonth(appId,time);
}
public Integer getFillingPassedCountByMonth(String appId, Date time) {
return this.baseMapper.getFillingPassedCountByMonth(appId,time);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderFillingDataUnitMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderFillingDataUnitService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingDataUnitDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 气瓶充装总量统计表-企业服务实现类
*
* @author system_generator
* @date 2022-03-14
*/
@Service
public class CylinderFillingDataUnitServiceImpl extends BaseService<CylinderFillingDataUnitDto,CylinderFillingDataUnit,CylinderFillingDataUnitMapper> implements ICylinderFillingDataUnitService {
/**
* 分页查询
*/
public Page<CylinderFillingDataUnitDto> queryForCylinderFillingDataUnitPage(Page<CylinderFillingDataUnitDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<CylinderFillingDataUnitDto> queryForCylinderFillingDataUnitList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
......@@ -55,4 +55,16 @@ public class CylinderFillingRecordServiceImpl extends BaseService<CylinderFillin
page1.setRecords(resultDtoList);
return page1;
}
public Double getFillingSumByMonth(String appId, Date time) {
return baseMapper.getFillingSumByMonth(appId,time);
}
public Integer getFillingCountByMonth(String appId, Date time) {
return baseMapper.getFillingCountByMonth(appId,time);
}
public Double getFillingSumByDate(String appId, Date time) {
return baseMapper.getFillingSumByDate(appId,time);
}
}
\ No newline at end of file
......@@ -7,6 +7,8 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.Date;
import java.util.List;
/**
......@@ -34,4 +36,12 @@ public class CylinderFillingServiceImpl extends BaseService<CylinderFillingDto,C
public Double queryIntegirtyByAppId(String appId) {
return this.baseMapper.queryIntegirtyByAppId(appId);
}
public Integer getFillingCountByMonth(String appId, Date time) {
return this.baseMapper.getFillingCountByMonth(appId,time);
}
public Integer getFillingPassedCountByMonth(String appId, Date time) {
return this.baseMapper.getFillingPassedCountByMonth(appId,time);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfoDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoDataUnitMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.ICylinderInfoDataUnitService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDataUnitDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 气瓶总量统计表-企业服务实现类
*
* @author system_generator
* @date 2022-03-14
*/
@Service
public class CylinderInfoDataUnitServiceImpl extends BaseService<CylinderInfoDataUnitDto,CylinderInfoDataUnit,CylinderInfoDataUnitMapper> implements ICylinderInfoDataUnitService {
/**
* 分页查询
*/
public Page<CylinderInfoDataUnitDto> queryForCylinderInfoDataUnitPage(Page<CylinderInfoDataUnitDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<CylinderInfoDataUnitDto> queryForCylinderInfoDataUnitList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
......@@ -2,15 +2,28 @@ package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderAreaDataDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingCheckDataUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingDataUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingUnloadDataDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderFillingUnloadDataUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDataDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDataUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderIntegrityDataDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderIntegrityDataUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderTagsDataUnitDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderUnitDataDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderAreaData;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingCheckDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingUnloadData;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderFillingUnloadDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfoData;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfoDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderIntegrityData;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderIntegrityDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderTags;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderTagsDataUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnit;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderUnitData;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper;
......@@ -20,6 +33,7 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -75,6 +89,24 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto,Cylinde
@Autowired
CylinderFillingUnloadDataServiceImpl cylinderFillingUnloadDataServiceImpl;
@Autowired
CylinderInfoDataUnitServiceImpl cylinderInfoDataUnitServiceImpl;
@Autowired
CylinderFillingDataUnitServiceImpl cylinderFillingDataUnitServiceImpl;
@Autowired
CylinderTagsDataUnitServiceImpl cylinderTagsDataUnitServiceImpl;
@Autowired
CylinderIntegrityDataUnitServiceImpl cylinderIntegrityDataUnitServiceImpl;
@Autowired
CylinderFillingCheckDataUnitServiceImpl cylinderFillingCheckDataUnitServiceImpl;
@Autowired
CylinderFillingUnloadDataUnitServiceImpl cylinderFillingUnloadDataUnitServiceImpl;
/**
* 分页查询
......@@ -336,4 +368,250 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto,Cylinde
});
return true;
}
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public Boolean synUnitCylinderInfoData() {
// 每日清空再重新获取数据
cylinderInfoDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderInfoDataUnit>());
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.stream().forEach(u -> {
CylinderInfoDataUnitDto temp = new CylinderInfoDataUnitDto();
temp.setAppId(u.getAppId());
Integer count = this.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,u.getAppId()));
temp.setTotalSum((long) count);
Double thismonth = Double.valueOf(baseMapper.getLastMonthInfoTotalUnit(u.getAppId()));
Double lastmonth = Double.valueOf(baseMapper.getMonthBeforeLastInfoTotalUnit(u.getAppId()));
Double percent = 0d;
if(lastmonth != 0) {
percent = (thismonth - lastmonth) / lastmonth;
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
temp.setChangeSum((long) (thismonth - lastmonth));
temp.setChangePercent((int )(percent*100)+"");
cylinderInfoDataUnitServiceImpl.createWithModel(temp);
});
return true;
}
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public Boolean synUnitCylinderFillingData() {
// 每日清空再重新获取数据
cylinderFillingDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingDataUnit>());
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.stream().forEach(u -> {
// 按照月份 获取数据 取一年数据
Calendar c = Calendar.getInstance();
// 按月份获取充装量
// 当月与上月 对比获取数据
for(int i = 0 ; i < 12 ; i++) {
// 获取当月数据
CylinderFillingDataUnitDto temp = new CylinderFillingDataUnitDto();
String year = c.get(Calendar.YEAR)+"";
int month = c.get(Calendar.MONTH)+1 ;
String monthStr = month < 10 ? "0"+month : month +"";
temp.setFillingMonth(monthStr);
temp.setFillingYear(year);
Double thisMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(u.getAppId(),c.getTime());
temp.setTotalSum(thisMonth);
// 获取上月数据
c.add(Calendar.MONTH, -1);
Double lastMonth = cylinderFillingRecordServiceImpl.getFillingSumByMonth(u.getAppId(),c.getTime());
Double percent = 0d;
if(lastMonth != 0) {
percent = (thisMonth - lastMonth) / lastMonth;
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
temp.setChangePercent((int )(percent*100)+"");
temp.setAppId(u.getAppId());
temp.setChangeSum(thisMonth-lastMonth);
cylinderFillingDataUnitServiceImpl.createWithModel(temp);
}
});
return true;
}
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public Boolean synUnitCylinderTagsData() {
// 每日清空再重新获取数据
cylinderTagsDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderTagsDataUnit>());
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.stream().forEach(u -> {
CylinderTagsDataUnitDto temp = new CylinderTagsDataUnitDto();
temp.setAppId(u.getAppId());
int cylinder = this.count(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getAppId,u.getAppId()));
int tags = cylinderTagsServiceImpl.count(new LambdaQueryWrapper<CylinderTags>().eq(CylinderTags::getAppId,u.getAppId()));
Double percent = 0d;
if(tags != 0) {
percent = (double) cylinder / (double) tags;
BigDecimal bg = new BigDecimal(percent);
percent = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
temp.setCylinderSum((long) cylinder);
temp.setTagsSum((long) tags);
temp.setTagPercent(percent*100);
cylinderTagsDataUnitServiceImpl.createWithModel(temp);
});
return true;
}
@Transactional
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public Boolean synUnitIntegrityData() {
cylinderIntegrityDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderIntegrityDataUnit>());
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.stream().forEach(u -> {
// 企业信息
CylinderIntegrityDataUnitDto uninInfo = new CylinderIntegrityDataUnitDto();
uninInfo.setAppId(u.getAppId());
uninInfo.setDataType("企业信息");
Double unitIntegirty = u.getIntegrity();
uninInfo.setIntegrity(unitIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(uninInfo);
// 气瓶基本信息
CylinderIntegrityDataUnitDto cylinderInfo = new CylinderIntegrityDataUnitDto();
cylinderInfo.setAppId(u.getAppId());
cylinderInfo.setDataType("气瓶基本信息");
Double cylinderIntegirty = this.queryIntegirtyByAppId(u.getAppId());
cylinderInfo.setIntegrity(cylinderIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInfo);
// 气瓶标签信息
CylinderIntegrityDataUnitDto cylinderTag = new CylinderIntegrityDataUnitDto();
cylinderTag.setAppId(u.getAppId());
cylinderTag.setDataType("气瓶标签信息");
Double tagIntegirty = cylinderTagsServiceImpl.queryIntegirtyByAppId(u.getAppId());
cylinderTag.setIntegrity(tagIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderTag);
// 气瓶检验信息
CylinderIntegrityDataUnitDto cylinderInspection = new CylinderIntegrityDataUnitDto();
cylinderInspection.setAppId(u.getAppId());
cylinderInspection.setDataType("气瓶检验信息");
cylinderInspection.setIntegrity(0d);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderInspection);
// 充装前检查
CylinderIntegrityDataUnitDto cylinderFilling = new CylinderIntegrityDataUnitDto();
cylinderFilling.setAppId(u.getAppId());
cylinderFilling.setDataType("充装前检查");
Double fillingIntegirty = cylinderFillingServiceImpl.queryIntegirtyByAppId(u.getAppId());
cylinderFilling.setIntegrity(fillingIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderFilling);
// 充装信息
CylinderIntegrityDataUnitDto cylinderRecord = new CylinderIntegrityDataUnitDto();
cylinderRecord.setAppId(u.getAppId());
cylinderRecord.setDataType("充装信息");
Double recordIntegirty = cylinderFillingRecordServiceImpl.queryIntegirtyByAppId(u.getAppId());
cylinderRecord.setIntegrity(recordIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderRecord);
// 充装后复查
CylinderIntegrityDataUnitDto cylinderCheck = new CylinderIntegrityDataUnitDto();
cylinderCheck.setAppId(u.getAppId());
cylinderCheck.setDataType("充装后复查");
Double checkIntegirty = cylinderFillingCheckServiceImpl.queryIntegirtyByAppId(u.getAppId());
cylinderCheck.setIntegrity(checkIntegirty);
cylinderIntegrityDataUnitServiceImpl.createWithModel(cylinderCheck);
});
return true;
}
@Transactional
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public Boolean synUnitFillingCheckData() {
cylinderFillingCheckDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingCheckDataUnit>());
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.stream().forEach(u -> {
// 按照月份 获取数据 取一年数据
Calendar c = Calendar.getInstance();
// 按月份获取充装量
// 当月与上月 对比获取数据
for(int i = 0 ; i < 12 ; i++) {
// 获取当月数据
CylinderFillingCheckDataUnitDto temp = new CylinderFillingCheckDataUnitDto();
String year = c.get(Calendar.YEAR)+"";
int month = c.get(Calendar.MONTH)+1 ;
String monthStr = month < 10 ? "0"+month : month +"";
temp.setFillingMonth(monthStr);
temp.setFillingYear(year);
Integer thisMonth = cylinderFillingRecordServiceImpl.getFillingCountByMonth(u.getAppId(),c.getTime());
temp.setTotalSum((long) thisMonth);
// 获取本月数据
Integer fillingCount = cylinderFillingServiceImpl.getFillingCountByMonth(u.getAppId(),c.getTime());
Integer fillingCheckCount = cylinderFillingCheckServiceImpl.getFillingCountByMonth(u.getAppId(),c.getTime());
// 充装前检查率:充装前检查次数/充装次数
Double before = 0d;
if(thisMonth != 0) {
before = (double)(fillingCount) / (double) thisMonth;
}
temp.setFillingPercent(before * 100);
// 充装后检查率:充装后检查次数/充装次数
Double after = 0d;
if(thisMonth != 0) {
after = (double)(fillingCheckCount) / (double) thisMonth;
}
temp.setFillingCheckPercent(after * 100);
// 充装合格率:充装前检查合格次数+充装后检查合格次数/2*充装次数
Double passed = 0d;
// 充装前检查合格次数
Integer fillingPassedCount = cylinderFillingServiceImpl.getFillingPassedCountByMonth(u.getAppId(),c.getTime());
// 充装后检查合格次数
Integer fillingCheckPassedCount = cylinderFillingCheckServiceImpl.getFillingPassedCountByMonth(u.getAppId(),c.getTime());
if(thisMonth != 0) {
passed = ( (double) (fillingPassedCount) + (double) fillingCheckPassedCount ) / (double) (2 * thisMonth);
}
temp.setFillingPassedPercent(passed * 100);
temp.setAppId(u.getAppId());
c.add(Calendar.MONTH, -1);
cylinderFillingCheckDataUnitServiceImpl.createWithModel(temp);
}
});
return true;
}
@Transactional
@Scheduled(cron = "0 0 2 * * ?") //每天凌晨两点执行
public Boolean synFillingUnloadUnitData() {
cylinderFillingUnloadDataUnitServiceImpl.remove(new LambdaQueryWrapper<CylinderFillingUnloadDataUnit>());
List<CylinderUnit> units = cylinderUnitServiceImpl.list();
units.stream().forEach(u -> {
Calendar now = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(int i = 0 ; i < 30 ; i ++) {
now.add(Calendar.DATE,-1);
CylinderFillingUnloadDataUnitDto temp = new CylinderFillingUnloadDataUnitDto();
Double fillingSum = cylinderFillingRecordServiceImpl.getFillingSumByDate(u.getAppId(),now.getTime());
Double unloadSum = 0d;
temp.setFillingSum(fillingSum);
temp.setAppId(u.getAppId());
temp.setStatisDate(now.getTime());
temp.setStatisDateStr(sdf.format(now.getTime()));
temp.setUnloadSum(unloadSum);
cylinderFillingUnloadDataUnitServiceImpl.createWithModel(temp);
}
});
return true;
}
}
\ No newline at end of file
......@@ -865,6 +865,598 @@
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_area_data"/>
</not>
</preConditions>
<comment>add table tz_cylinder_area_data</comment>
<sql>
CREATE TABLE `tz_cylinder_area_data` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`area_name` varchar(30) DEFAULT NULL COMMENT '区域名称',
`unit_num` bigint(19) DEFAULT NULL COMMENT '企业数量',
`region_code` varchar(20) DEFAULT NULL COMMENT '区域编码',
`parent_region_code` varchar(20) DEFAULT NULL COMMENT '父节点区域编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
`cylinder_num` bigint(19) DEFAULT NULL COMMENT '气瓶数量',
`warn_num` bigint(19) DEFAULT NULL COMMENT '预警数量',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶区域统计表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-02">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_check"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_check</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_check` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`filling_check_id` varchar(255) DEFAULT NULL COMMENT '充装后复查ID',
`filling_unit_name` varchar(255) DEFAULT NULL COMMENT '充装企业名称',
`factory_num` varchar(255) DEFAULT NULL COMMENT '出厂编号',
`sequence_code` varchar(255) DEFAULT NULL COMMENT '气瓶唯一标识码',
`within_scope` int(11) DEFAULT NULL COMMENT '充装量在规定范围内',
`sealed_state` int(11) DEFAULT NULL COMMENT '瓶阀及其与瓶口连接的密封良好',
`defective` int(11) DEFAULT NULL COMMENT '瓶体未出现鼓包变形或泄露等严重缺陷',
`abnormal_temperature` int(11) DEFAULT NULL COMMENT '瓶体温度没有异常升高的迹象',
`warning_sign` int(11) DEFAULT NULL COMMENT '气瓶粘贴警示标签和充装标签',
`compliance` varchar(255) DEFAULT NULL COMMENT '液化气瓶充装量符合有关规定,充装后逐瓶称重',
`inspector` varchar(255) DEFAULT NULL COMMENT '检查人员姓名',
`inspection_date` varchar(50) DEFAULT NULL COMMENT '检查时间',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT '0' COMMENT '0-新增 1-更新 2-删除',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE,
KEY `index_app_id` (`app_id`) USING BTREE,
KEY `index_code` (`sequence_code`) USING BTREE,
KEY `index_time` (`inspection_date`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='液化气体气瓶充装信息-充装后复查';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-03">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_check_data_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_check_data_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_check_data_unit` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`total_sum` bigint(19) DEFAULT NULL COMMENT '充装次数',
`filling_percent` double(10,2) DEFAULT NULL COMMENT '充装前检查率',
`filling_check_percent` double(10,2) DEFAULT NULL COMMENT '充装后检查率',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
`filling_year` varchar(20) DEFAULT NULL COMMENT '充装年份',
`filling_month` varchar(20) DEFAULT NULL COMMENT '充装月份',
`filling_passed_percent` double(10,2) DEFAULT NULL COMMENT '充装检查合格率',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶充装检查情况统计表-企业';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-04">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_data_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_data_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_data_unit` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`total_sum` double(10,2) DEFAULT NULL COMMENT '上月充装量',
`change_sum` double(10,2) DEFAULT NULL COMMENT '充装量增减量',
`change_percent` varchar(20) DEFAULT NULL COMMENT '增减环比',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
`filling_year` varchar(20) DEFAULT NULL COMMENT '充装年份',
`filling_month` varchar(20) DEFAULT NULL COMMENT '充装月份',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶充装总量统计表-企业';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-05">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_examine"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_examine</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_examine` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`filling_examine_id` varchar(255) DEFAULT NULL COMMENT '充装信息审核ID',
`filling_unit_name` varchar(255) DEFAULT NULL COMMENT '充装企业名称',
`filling_audit_date` varchar(50) DEFAULT NULL COMMENT '报表生成时间',
`filling_audit_url` varchar(255) DEFAULT NULL COMMENT '充装审核报表附件地址',
`filling_audit_name` varchar(255) DEFAULT NULL COMMENT '充装审核报表附件名称',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT '0' COMMENT '0-新增 1-更新 2-删除',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE,
KEY `index_app_id` (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='液化气体气瓶充装信息审核';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-06">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_record"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_record</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_record` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`filling_record_id` varchar(255) DEFAULT NULL COMMENT '充装记录Id',
`filling_unit_name` varchar(255) DEFAULT NULL COMMENT '充装企业名称',
`factory_num` varchar(255) DEFAULT NULL COMMENT '出厂编号',
`sequence_code` varchar(255) DEFAULT NULL COMMENT '气瓶唯一标识码',
`filling_startTime` varchar(50) DEFAULT NULL COMMENT '充装开始时间',
`filling_endTime` varchar(50) DEFAULT NULL COMMENT '充装结束时间',
`filling_user` varchar(255) DEFAULT NULL COMMENT '充装人员姓名',
`filling_quantity` double DEFAULT NULL COMMENT '充装量(Kg)',
`temperature` double DEFAULT NULL COMMENT '室温',
`abnormal` int(11) DEFAULT NULL COMMENT '异常情况',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT '0' COMMENT '1初次同步数据 2上层系统已同步数据 0已删除数据',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE,
KEY `index_app_id` (`app_id`) USING BTREE,
KEY `index_sync_date` (`sync_date`) USING BTREE,
KEY `index_start_time` (`filling_startTime`) USING BTREE,
KEY `index_code` (`sequence_code`) USING BTREE,
KEY `index_end_time` (`filling_endTime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='液化气体气瓶充装信息-充装记录';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-07">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_unload_data"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_unload_data</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_unload_data` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`filling_sum` double(10,2) DEFAULT NULL COMMENT '充装总量',
`unload_sum` double(10,2) DEFAULT NULL COMMENT '卸液总量',
`statis_date` date DEFAULT NULL COMMENT '充卸日期',
`region_code` varchar(20) DEFAULT NULL COMMENT '区域编码',
`statis_year` varchar(20) DEFAULT NULL COMMENT '充卸年份',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
`statis_month` varchar(20) DEFAULT NULL COMMENT '充卸月份',
`statis_date_str` varchar(20) DEFAULT NULL COMMENT '充卸日期字符串',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶充卸统计表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-08">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_filling_unload_data_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_filling_unload_data_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_filling_unload_data_unit` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`filling_sum` double(10,2) DEFAULT NULL COMMENT '充装总量',
`unload_sum` double(10,2) DEFAULT NULL COMMENT '卸液总量',
`statis_date` date DEFAULT NULL COMMENT '充卸日期',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`statis_year` varchar(20) DEFAULT NULL COMMENT '充卸年份',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
`statis_month` varchar(20) DEFAULT NULL COMMENT '充卸月份',
`statis_date_str` varchar(20) DEFAULT NULL COMMENT '充卸日期字符串',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶充卸统计表-企业';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-09">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_info"/>
</not>
</preConditions>
<comment>add table tz_cylinder_info</comment>
<sql>
CREATE TABLE `tz_cylinder_info` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`cylinder_id` varchar(255) DEFAULT NULL COMMENT '气瓶基本信息ID',
`unit_name` varchar(255) DEFAULT NULL COMMENT '产权单位名称',
`factory_num` varchar(255) DEFAULT NULL COMMENT '出厂编号',
`cylinder_status` int(11) DEFAULT NULL COMMENT '气瓶状态',
`cylinder_variety` int(11) DEFAULT NULL COMMENT '气瓶品种',
`qrCode` varchar(255) DEFAULT NULL COMMENT '二维码编号',
`electronic_label_code` varchar(255) DEFAULT NULL COMMENT '电子标签编号',
`filling_medium` varchar(255) DEFAULT NULL COMMENT '充装介质',
`pressure` double DEFAULT NULL COMMENT '公称压力(MPa)',
`volume` double DEFAULT NULL COMMENT '容积(L)',
`manufacturing_date` varchar(50) DEFAULT NULL COMMENT '制造日期',
`manufacturing_unit` varchar(255) DEFAULT NULL COMMENT '制造单位',
`license` varchar(255) DEFAULT NULL COMMENT '气瓶制造许可证',
`cylinder_weight` double DEFAULT NULL COMMENT '气瓶重量(kg)',
`unit_inner_code` varchar(255) DEFAULT NULL COMMENT '单位内部编号',
`inspection_date` varchar(50) DEFAULT NULL COMMENT '最近一次检验日期',
`next_inspection_date` varchar(50) DEFAULT NULL COMMENT '下次检验日期',
`sequence_code` varchar(255) DEFAULT NULL COMMENT '气瓶唯一标识码',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT '0' COMMENT '0-新增 1-更新 2-删除',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE,
KEY `index_app_id` (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='气瓶基本信息';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-10">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_info_data"/>
</not>
</preConditions>
<comment>add table tz_cylinder_info_data</comment>
<sql>
CREATE TABLE `tz_cylinder_info_data` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`total_sum` bigint(19) DEFAULT NULL COMMENT '气瓶总量',
`change_sum` bigint(19) DEFAULT NULL COMMENT '气瓶增减数量',
`change_percent` varchar(20) DEFAULT NULL COMMENT '增减环比',
`region_code` varchar(20) DEFAULT NULL COMMENT '区域编码',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶总量统计表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-11">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_info_data_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_info_data_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_info_data_unit` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`total_sum` bigint(19) DEFAULT NULL COMMENT '气瓶总量',
`change_sum` bigint(19) DEFAULT NULL COMMENT '气瓶增减数量',
`change_percent` varchar(20) DEFAULT NULL COMMENT '增减环比',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶总量统计表-企业';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-12">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_inspection"/>
</not>
</preConditions>
<comment>add table tz_cylinder_inspection</comment>
<sql>
CREATE TABLE `tz_cylinder_inspection` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`inspection_id` varchar(255) DEFAULT NULL COMMENT '检验信息ID',
`inspection_unit` varchar(255) DEFAULT NULL COMMENT '检验单位',
`property_unit_name` varchar(255) DEFAULT NULL COMMENT '产权单位名称',
`factory_num` varchar(255) DEFAULT NULL COMMENT '出厂编号',
`sequence_code` varchar(255) DEFAULT NULL COMMENT '气瓶唯一标识码',
`inspection_date` varchar(50) DEFAULT NULL COMMENT '检验日期',
`next_inspection_date` varchar(50) DEFAULT NULL COMMENT '下次检验日期',
`inspection_result` varchar(255) DEFAULT NULL COMMENT '检验结果',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT '0' COMMENT '0-新增 1-更新 2-删除',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE,
KEY `index_app_id` (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='气瓶检验信息';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-13">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_integrity_data"/>
</not>
</preConditions>
<comment>add table tz_cylinder_integrity_data</comment>
<sql>
CREATE TABLE `tz_cylinder_integrity_data` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`unit_name` varchar(30) DEFAULT NULL COMMENT '企业名称',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
`region_code` varchar(20) DEFAULT NULL COMMENT '区域编码',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶数据完整度表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-14">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_integrity_data_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_integrity_data_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_integrity_data_unit` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`data_type` varchar(30) DEFAULT NULL COMMENT '数据类型',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶数据完整度表-企业';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-15">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_tags"/>
</not>
</preConditions>
<comment>add table tz_cylinder_tags</comment>
<sql>
CREATE TABLE `tz_cylinder_tags` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`tag_id` varchar(255) DEFAULT NULL COMMENT '标签ID',
`unit_name` varchar(255) DEFAULT NULL COMMENT '产权单位名称',
`factory_num` varchar(255) DEFAULT NULL COMMENT '出厂编号',
`sequence_code` varchar(255) DEFAULT NULL COMMENT '气瓶唯一标识码',
`qrCode` varchar(255) DEFAULT NULL COMMENT '二维码编号',
`electronic_label_code` varchar(255) DEFAULT NULL COMMENT '电子标签编号',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT '0' COMMENT '0-新增 1-更新 2-删除',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='气瓶标签信息';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-16">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_tags_data_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_tags_data_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_tags_data_unit` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`tag_percent` double(10,2) DEFAULT NULL COMMENT '气瓶标签比',
`cylinder_sum` bigint(19) DEFAULT NULL COMMENT '气瓶数量',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
`tags_sum` bigint(19) DEFAULT NULL COMMENT '标签数量',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='气瓶及标签数量比表-企业';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-17">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_unit"/>
</not>
</preConditions>
<comment>add table tz_cylinder_unit</comment>
<sql>
CREATE TABLE `tz_cylinder_unit` (
`sequence_nbr` bigint(20) NOT NULL COMMENT 'id',
`unit_id` varchar(255) DEFAULT NULL COMMENT '单位ID',
`region_code` varchar(255) DEFAULT NULL COMMENT '所属区域',
`unit_name` varchar(255) DEFAULT NULL COMMENT '单位名称',
`unit_type` int(11) DEFAULT NULL COMMENT '企业类型',
`credit_code` varchar(255) DEFAULT NULL COMMENT '统一社会信用代码',
`address` varchar(255) DEFAULT NULL COMMENT '详细地址',
`unit_person` varchar(255) DEFAULT NULL COMMENT '企业负责人',
`person_mobile_phone` varchar(255) DEFAULT NULL COMMENT '企业负责人手机',
`person_telephone` varchar(255) DEFAULT NULL COMMENT '企业负责人固定电话',
`postal_code` varchar(255) DEFAULT NULL COMMENT '企业邮编',
`unit_abbreviation` varchar(255) DEFAULT NULL COMMENT '企业简称',
`filling_license` varchar(255) DEFAULT NULL COMMENT '充装许可证号',
`filling_permit_date` varchar(50) DEFAULT NULL COMMENT '充装许可证有效期',
`filling_perm_scope` varchar(255) DEFAULT NULL COMMENT '充装许可范围',
`inspection_license` varchar(255) DEFAULT NULL COMMENT '检验许可证号',
`inspection_scope` varchar(255) DEFAULT NULL COMMENT '检验范围',
`effective_date` varchar(50) DEFAULT NULL COMMENT '检验许可证有效期',
`manufacturing_license` varchar(255) DEFAULT NULL COMMENT '制造许可证号',
`manufacturing_date` varchar(50) DEFAULT NULL COMMENT '制造许可证有效期',
`manufacturing_scope` varchar(255) DEFAULT NULL COMMENT '制造许可范围',
`manufacturing_unit_code` varchar(255) DEFAULT NULL COMMENT '制造单位代码',
`rec_date` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`sync_date` datetime DEFAULT NULL COMMENT '同步时间 yyyy-MM-dd HH24:mi:ss',
`sync_state` int(1) DEFAULT NULL COMMENT '0-新增 1-更新 2-删除',
`app_id` varchar(255) DEFAULT NULL COMMENT '对接公司编码',
`longitude` varchar(30) DEFAULT NULL COMMENT '经度',
`latitude` varchar(30) DEFAULT NULL COMMENT '纬度',
`integrity` double(10,2) DEFAULT NULL COMMENT '数据完整度',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='气瓶企业信息';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-18">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_unit_data"/>
</not>
</preConditions>
<comment>add table tz_cylinder_unit_data</comment>
<sql>
CREATE TABLE `tz_cylinder_unit_data` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`total_sum` bigint(19) DEFAULT NULL COMMENT '企业总量',
`change_sum` bigint(19) DEFAULT NULL COMMENT '企业增减数量',
`change_percent` varchar(20) DEFAULT NULL COMMENT '增减环比',
`region_code` varchar(20) DEFAULT NULL COMMENT '区域编码',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='企业总量统计表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-19">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tz_cylinder_unload_fake"/>
</not>
</preConditions>
<comment>add table tz_cylinder_unload_fake</comment>
<sql>
CREATE TABLE `tz_cylinder_unload_fake` (
`sequence_nbr` bigint(19) NOT NULL COMMENT 'id',
`unload_num` double(10,2) DEFAULT NULL COMMENT '卸液量',
`unload_time` datetime DEFAULT NULL COMMENT '卸液日期',
`app_id` varchar(255) DEFAULT NULL COMMENT '企业编码',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`rec_user_name` varchar(20) DEFAULT NULL COMMENT '操作人名称',
`rec_user_id` varchar(19) DEFAULT NULL COMMENT '操作人员',
`rec_date` datetime DEFAULT NULL COMMENT '创建时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`sequence_nbr`) USING BTREE,
KEY `index_unload_date` (`unload_time`) USING BTREE,
KEY `index_app_id` (`app_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='卸液数据表-假数据';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-20">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT count(1) FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'view_cylider_outofdate'</sqlCheck>
</preConditions>
<comment>add view view_cylider_outofdate</comment>
<sql>
create view view_cylider_outofdate as select `u`.`sequence_nbr` AS `sequence_nbr`,`u`.`cylinder_id` AS `cylinder_id`,`u`.`unit_name` AS `unit_name`,`u`.`factory_num` AS `factory_num`,`u`.`cylinder_status` AS `cylinder_status`,`u`.`cylinder_variety` AS `cylinder_variety`,`u`.`qrCode` AS `qrCode`,`u`.`electronic_label_code` AS `electronic_label_code`,`u`.`filling_medium` AS `filling_medium`,`u`.`pressure` AS `pressure`,`u`.`volume` AS `volume`,`u`.`manufacturing_date` AS `manufacturing_date`,`u`.`manufacturing_unit` AS `manufacturing_unit`,`u`.`license` AS `license`,`u`.`cylinder_weight` AS `cylinder_weight`,`u`.`unit_inner_code` AS `unit_inner_code`,`u`.`inspection_date` AS `inspection_date`,`u`.`next_inspection_date` AS `next_inspection_date`,`u`.`sequence_code` AS `sequence_code`,`u`.`rec_date` AS `rec_date`,`u`.`rec_user_id` AS `rec_user_id`,`u`.`sync_date` AS `sync_date`,`u`.`sync_state` AS `sync_state`,`u`.`app_id` AS `app_id`,`u`.`integrity` AS `integrity`,`t`.`region_code` AS `region_code` from (`tz_cylinder_info` `u` left join `tz_cylinder_unit` `t` on((`t`.`app_id` = `u`.`app_id`))) where ((cast(`u`.`next_inspection_date` as date) - interval 30 day) <![CDATA[ <= ]]> curdate())
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-21">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT count(1) FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'view_unit_outofdate'</sqlCheck>
</preConditions>
<comment>add view view_unit_outofdate</comment>
<sql>
create view view_unit_outofdate as select `u`.`sequence_nbr` AS `sequence_nbr`,`u`.`unit_id` AS `unit_id`,`u`.`region_code` AS `region_code`,`u`.`unit_name` AS `unit_name`,`u`.`unit_type` AS `unit_type`,`u`.`credit_code` AS `credit_code`,`u`.`address` AS `address`,`u`.`unit_person` AS `unit_person`,`u`.`person_mobile_phone` AS `person_mobile_phone`,`u`.`person_telephone` AS `person_telephone`,`u`.`postal_code` AS `postal_code`,`u`.`unit_abbreviation` AS `unit_abbreviation`,`u`.`filling_license` AS `filling_license`,`u`.`filling_permit_date` AS `filling_permit_date`,`u`.`filling_perm_scope` AS `filling_perm_scope`,`u`.`inspection_license` AS `inspection_license`,`u`.`inspection_scope` AS `inspection_scope`,`u`.`effective_date` AS `effective_date`,`u`.`manufacturing_license` AS `manufacturing_license`,`u`.`manufacturing_date` AS `manufacturing_date`,`u`.`manufacturing_scope` AS `manufacturing_scope`,`u`.`manufacturing_unit_code` AS `manufacturing_unit_code`,`u`.`rec_date` AS `rec_date`,`u`.`rec_user_id` AS `rec_user_id`,`u`.`sync_date` AS `sync_date`,`u`.`sync_state` AS `sync_state`,`u`.`app_id` AS `app_id`,`u`.`longitude` AS `longitude`,`u`.`latitude` AS `latitude`,`u`.`integrity` AS `integrity` from `tz_cylinder_unit` `u` where ((cast(`u`.`filling_permit_date` as date) - interval 200 day) <![CDATA[ <= ]]> curdate())
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-22">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT count(1) FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'view_checkout_boil_table'</sqlCheck>
</preConditions>
<comment>add view view_checkout_boil_table</comment>
<sql>
create view view_checkout_boil_table as select `a`.`sequence_nbr` AS `sequence_nbr`,`a`.`cylinder_id` AS `cylinder_id`,`a`.`unit_name` AS `unit_name`,`a`.`factory_num` AS `factory_num`,`a`.`cylinder_status` AS `cylinder_status`,`a`.`cylinder_variety` AS `cylinder_variety`,`a`.`qrCode` AS `qrCode`,`a`.`electronic_label_code` AS `electronic_label_code`,`a`.`filling_medium` AS `filling_medium`,`a`.`pressure` AS `pressure`,`a`.`volume` AS `volume`,`a`.`manufacturing_date` AS `manufacturing_date`,`a`.`manufacturing_unit` AS `manufacturing_unit`,`a`.`license` AS `license`,`a`.`cylinder_weight` AS `cylinder_weight`,`a`.`unit_inner_code` AS `unit_inner_code`,`a`.`inspection_date` AS `inspection_date`,`a`.`next_inspection_date` AS `next_inspection_date`,`a`.`sequence_code` AS `sequence_code`,`a`.`rec_date` AS `rec_date`,`a`.`rec_user_id` AS `rec_user_id`,`a`.`sync_date` AS `sync_date`,`a`.`sync_state` AS `sync_state`,`a`.`app_id` AS `app_id`,`u`.`region_code` AS `region_code`,(case when (now() > `a`.`next_inspection_date`) then '已超期' when ((to_days(`a`.`next_inspection_date`) - to_days(now())) &lt;= 30) then '即将超期' end) AS `status` from (((select `t`.`sequence_nbr` AS `sequence_nbr`,`t`.`cylinder_id` AS `cylinder_id`,`t`.`unit_name` AS `unit_name`,`t`.`factory_num` AS `factory_num`,`t`.`cylinder_status` AS `cylinder_status`,`t`.`cylinder_variety` AS `cylinder_variety`,`t`.`qrCode` AS `qrCode`,`t`.`electronic_label_code` AS `electronic_label_code`,`t`.`filling_medium` AS `filling_medium`,`t`.`pressure` AS `pressure`,`t`.`volume` AS `volume`,`t`.`manufacturing_date` AS `manufacturing_date`,`t`.`manufacturing_unit` AS `manufacturing_unit`,`t`.`license` AS `license`,`t`.`cylinder_weight` AS `cylinder_weight`,`t`.`unit_inner_code` AS `unit_inner_code`,`t`.`inspection_date` AS `inspection_date`,`t`.`next_inspection_date` AS `next_inspection_date`,`t`.`sequence_code` AS `sequence_code`,`t`.`rec_date` AS `rec_date`,`t`.`rec_user_id` AS `rec_user_id`,`t`.`sync_date` AS `sync_date`,`t`.`sync_state` AS `sync_state`,`t`.`app_id` AS `app_id` from `xiy_amos_tzs_biz`.`tz_cylinder_info` `t` where (`t`.`sequence_nbr` in (select max(`tt`.`sequence_nbr`) AS `sequence_nbr` from `xiy_amos_tzs_biz`.`tz_cylinder_info` `tt` group by `tt`.`sequence_code`) and ((`t`.`next_inspection_date` &lt; now()) or ((to_days(`t`.`next_inspection_date`) - to_days(now())) &lt;= 30))))) `a` left join `xiy_amos_tzs_biz`.`tz_cylinder_unit` `u` on((`u`.`app_id` = `a`.`app_id`)))
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-23">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT count(1) FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'view_checkout_boil_table'</sqlCheck>
</preConditions>
<comment>add view view_licence_unit_table</comment>
<sql>
create view view_licence_unit_table as select `u`.`sequence_nbr` AS `sequence_nbr`,`u`.`unit_id` AS `unit_id`,`u`.`region_code` AS `region_code`,`u`.`unit_name` AS `unit_name`,`u`.`unit_type` AS `unit_type`,`u`.`credit_code` AS `credit_code`,`u`.`address` AS `address`,`u`.`unit_person` AS `unit_person`,`u`.`person_mobile_phone` AS `person_mobile_phone`,`u`.`person_telephone` AS `person_telephone`,`u`.`postal_code` AS `postal_code`,`u`.`unit_abbreviation` AS `unit_abbreviation`,`u`.`filling_license` AS `filling_license`,`u`.`filling_permit_date` AS `filling_permit_date`,`u`.`filling_perm_scope` AS `filling_perm_scope`,`u`.`inspection_license` AS `inspection_license`,`u`.`inspection_scope` AS `inspection_scope`,`u`.`effective_date` AS `effective_date`,`u`.`manufacturing_license` AS `manufacturing_license`,`u`.`manufacturing_date` AS `manufacturing_date`,`u`.`manufacturing_scope` AS `manufacturing_scope`,`u`.`manufacturing_unit_code` AS `manufacturing_unit_code`,`u`.`rec_date` AS `rec_date`,`u`.`rec_user_id` AS `rec_user_id`,`u`.`sync_date` AS `sync_date`,`u`.`sync_state` AS `sync_state`,`u`.`app_id` AS `app_id`,(case when (now() > `u`.`filling_permit_date`) then '已超期' when ((to_days(`u`.`filling_permit_date`) - to_days(now())) &lt;= 200) then '即将超期' end) AS `status` from `tz_cylinder_unit` `u` where ((`u`.`filling_permit_date` &lt; now()) or ((to_days(`u`.`filling_permit_date`) - to_days(now())) &lt;= 30))
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-03-16-24">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT count(1) FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'view_unit_filling_percent'</sqlCheck>
</preConditions>
<comment>add view view_unit_filling_percent</comment>
<sql>
select `i`.`app_id` AS `app_id`,sum((case when (cast(`i`.`next_inspection_date` as date) <![CDATA[ <= ]]> now()) then 1 else 0 end)) AS `out_sum`,sum((case when (cast(`i`.`next_inspection_date` as date) <![CDATA[ > ]]> now()) then 1 else 0 end)) AS `normal_sum` from `tz_cylinder_info` `i` group by `i`.`app_id`
</sql>
</changeSet>
</databaseChangeLog>
......
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