diff --git a/aucma-base/src/main/java/com/aucma/base/controller/RecordDnbInstantController.java b/aucma-base/src/main/java/com/aucma/base/controller/RecordDnbInstantController.java new file mode 100644 index 0000000..31fc78d --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/controller/RecordDnbInstantController.java @@ -0,0 +1,103 @@ +package com.aucma.base.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.aucma.common.utils.DateUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.aucma.common.annotation.Log; +import com.aucma.common.core.controller.BaseController; +import com.aucma.common.core.domain.AjaxResult; +import com.aucma.common.enums.BusinessType; +import com.aucma.base.domain.RecordDnbInstant; +import com.aucma.base.service.IRecordDnbInstantService; +import com.aucma.common.utils.poi.ExcelUtil; +import com.aucma.common.core.page.TableDataInfo; + +/** + * 电实时数据Controller + * + * @author Yinq + * @date 2023-09-26 + */ +@RestController +@RequestMapping("/base/dnbInstant") +public class RecordDnbInstantController extends BaseController { + @Autowired + private IRecordDnbInstantService recordDnbInstantService; + + /** + * 查询电实时数据列表 + */ + @PreAuthorize("@ss.hasPermi('base:dnbInstant:list')") + @GetMapping("/list") + public TableDataInfo list(RecordDnbInstant recordDnbInstant) { + startPage(); + List list = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant); + return getDataTable(list); + } + + /** + * 导出电实时数据列表 + */ + @PreAuthorize("@ss.hasPermi('base:dnbInstant:export')") + @Log(title = "电实时数据", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, RecordDnbInstant recordDnbInstant) { + List list = recordDnbInstantService.selectRecordDnbInstantList(recordDnbInstant); + ExcelUtil util = new ExcelUtil(RecordDnbInstant.class); + util.exportExcel(response, list, "电实时数据数据"); + } + + /** + * 获取电实时数据详细信息 + */ + @PreAuthorize("@ss.hasPermi('base:dnbInstant:query')") + @GetMapping(value = "/{objId}") + public AjaxResult getInfo(@PathVariable("objId") Long objId) { + return success(recordDnbInstantService.selectRecordDnbInstantByObjId(objId)); + } + + /** + * 新增电实时数据 + */ + @PreAuthorize("@ss.hasPermi('base:dnbInstant:add')") + @Log(title = "电实时数据", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody RecordDnbInstant recordDnbInstant) { + recordDnbInstant.setCreatedBy(getUsername()); + recordDnbInstant.setCreatedTime(DateUtils.getNowDate()); + return toAjax(recordDnbInstantService.insertRecordDnbInstant(recordDnbInstant)); + } + + /** + * 修改电实时数据 + */ + @PreAuthorize("@ss.hasPermi('base:dnbInstant:edit')") + @Log(title = "电实时数据", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody RecordDnbInstant recordDnbInstant) { + recordDnbInstant.setUpdatedBy(getUsername()); + recordDnbInstant.setUpdatedTime(DateUtils.getNowDate()); + return toAjax(recordDnbInstantService.updateRecordDnbInstant(recordDnbInstant)); + } + + /** + * 删除电实时数据 + */ + @PreAuthorize("@ss.hasPermi('base:dnbInstant:remove')") + @Log(title = "电实时数据", businessType = BusinessType.DELETE) + @DeleteMapping("/{objIds}") + public AjaxResult remove(@PathVariable Long[] objIds) { + return toAjax(recordDnbInstantService.deleteRecordDnbInstantByObjIds(objIds)); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/domain/RecordDnbInstant.java b/aucma-base/src/main/java/com/aucma/base/domain/RecordDnbInstant.java new file mode 100644 index 0000000..d77e538 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/domain/RecordDnbInstant.java @@ -0,0 +1,359 @@ +package com.aucma.base.domain; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.aucma.common.annotation.Excel; +import com.aucma.common.core.domain.BaseEntity; + +/** + * 电实时数据对象 record_dnb_instant + * + * @author Yinq + * @date 2023-09-26 + */ +public class RecordDnbInstant extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + private Long objId; + + /** + * 计量设备编号 + */ + @Excel(name = "计量设备编号") + private String monitorId; + + /** + * 计量设备名称 + */ + @Excel(name = "计量设备名称") + private String monitorName; + + /** + * 采集时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "采集时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date collectTime; + + /** + * A项电压 + */ + @Excel(name = "A项电压") + private BigDecimal va; + + /** + * B项电压 + */ + @Excel(name = "B项电压") + private BigDecimal vb; + + /** + * C项电压 + */ + @Excel(name = "C项电压") + private BigDecimal vc; + + /** + * A项电流 + */ + @Excel(name = "A项电流") + private BigDecimal ia; + + /** + * B项电流 + */ + @Excel(name = "B项电流") + private BigDecimal ib; + + /** + * C项电流 + */ + @Excel(name = "C项电流") + private BigDecimal ic; + + /** + * 记录时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date recordTime; + + /** + * 功率因数 + */ + @Excel(name = "功率因数") + private BigDecimal glys; + + /** + * 正向有功 + */ + @Excel(name = "正向有功") + private BigDecimal zxyg; + + /** + * 有功功率 + */ + @Excel(name = "有功功率") + private BigDecimal activePower; + + /** + * 无功功率 + */ + @Excel(name = "无功功率") + private BigDecimal reactivePower; + + /** + * 采集方式(0-自动,1-手动) + */ + @Excel(name = "采集方式", readConverterExp = "0=-自动,1-手动") + private Long collectType; + + /** + * 启用标识 + */ + @Excel(name = "启用标识") + private Long isFlag; + + /** + * 创建人 + */ + @Excel(name = "创建人") + private String createdBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date createdTime; + + /** + * 修改人 + */ + @Excel(name = "修改人") + private String updatedBy; + + /** + * 修改时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date updatedTime; + + /** + * 工厂编号 + */ + @Excel(name = "工厂编号") + private String factoryCode; + + + public String getMonitorName() { + return monitorName; + } + + public void setMonitorName(String monitorName) { + this.monitorName = monitorName; + } + + public void setObjId(Long objId) { + this.objId = objId; + } + + public Long getObjId() { + return objId; + } + + public void setMonitorId(String monitorId) { + this.monitorId = monitorId; + } + + public String getMonitorId() { + return monitorId; + } + + public void setCollectTime(Date collectTime) { + this.collectTime = collectTime; + } + + public Date getCollectTime() { + return collectTime; + } + + public void setVa(BigDecimal va) { + this.va = va; + } + + public BigDecimal getVa() { + return va; + } + + public void setVb(BigDecimal vb) { + this.vb = vb; + } + + public BigDecimal getVb() { + return vb; + } + + public void setVc(BigDecimal vc) { + this.vc = vc; + } + + public BigDecimal getVc() { + return vc; + } + + public void setIa(BigDecimal ia) { + this.ia = ia; + } + + public BigDecimal getIa() { + return ia; + } + + public void setIb(BigDecimal ib) { + this.ib = ib; + } + + public BigDecimal getIb() { + return ib; + } + + public void setIc(BigDecimal ic) { + this.ic = ic; + } + + public BigDecimal getIc() { + return ic; + } + + public void setRecordTime(Date recordTime) { + this.recordTime = recordTime; + } + + public Date getRecordTime() { + return recordTime; + } + + public void setGlys(BigDecimal glys) { + this.glys = glys; + } + + public BigDecimal getGlys() { + return glys; + } + + public void setZxyg(BigDecimal zxyg) { + this.zxyg = zxyg; + } + + public BigDecimal getZxyg() { + return zxyg; + } + + public void setActivePower(BigDecimal activePower) { + this.activePower = activePower; + } + + public BigDecimal getActivePower() { + return activePower; + } + + public void setReactivePower(BigDecimal reactivePower) { + this.reactivePower = reactivePower; + } + + public BigDecimal getReactivePower() { + return reactivePower; + } + + public void setCollectType(Long collectType) { + this.collectType = collectType; + } + + public Long getCollectType() { + return collectType; + } + + public void setIsFlag(Long isFlag) { + this.isFlag = isFlag; + } + + public Long getIsFlag() { + return isFlag; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setUpdatedBy(String updatedBy) { + this.updatedBy = updatedBy; + } + + public String getUpdatedBy() { + return updatedBy; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setFactoryCode(String factoryCode) { + this.factoryCode = factoryCode; + } + + public String getFactoryCode() { + return factoryCode; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("objId", getObjId()) + .append("monitorId", getMonitorId()) + .append("collectTime", getCollectTime()) + .append("va", getVa()) + .append("vb", getVb()) + .append("vc", getVc()) + .append("ia", getIa()) + .append("ib", getIb()) + .append("ic", getIc()) + .append("recordTime", getRecordTime()) + .append("glys", getGlys()) + .append("zxyg", getZxyg()) + .append("activePower", getActivePower()) + .append("reactivePower", getReactivePower()) + .append("collectType", getCollectType()) + .append("isFlag", getIsFlag()) + .append("createdBy", getCreatedBy()) + .append("createdTime", getCreatedTime()) + .append("updatedBy", getUpdatedBy()) + .append("updatedTime", getUpdatedTime()) + .append("factoryCode", getFactoryCode()) + .toString(); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java new file mode 100644 index 0000000..efd7dfd --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/mapper/RecordDnbInstantMapper.java @@ -0,0 +1,61 @@ +package com.aucma.base.mapper; + +import java.util.List; +import com.aucma.base.domain.RecordDnbInstant; + +/** + * 电实时数据Mapper接口 + * + * @author Yinq + * @date 2023-09-26 + */ +public interface RecordDnbInstantMapper +{ + /** + * 查询电实时数据 + * + * @param objId 电实时数据主键 + * @return 电实时数据 + */ + public RecordDnbInstant selectRecordDnbInstantByObjId(Long objId); + + /** + * 查询电实时数据列表 + * + * @param recordDnbInstant 电实时数据 + * @return 电实时数据集合 + */ + public List selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant); + + /** + * 新增电实时数据 + * + * @param recordDnbInstant 电实时数据 + * @return 结果 + */ + public int insertRecordDnbInstant(RecordDnbInstant recordDnbInstant); + + /** + * 修改电实时数据 + * + * @param recordDnbInstant 电实时数据 + * @return 结果 + */ + public int updateRecordDnbInstant(RecordDnbInstant recordDnbInstant); + + /** + * 删除电实时数据 + * + * @param objId 电实时数据主键 + * @return 结果 + */ + public int deleteRecordDnbInstantByObjId(Long objId); + + /** + * 批量删除电实时数据 + * + * @param objIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteRecordDnbInstantByObjIds(Long[] objIds); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java b/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java new file mode 100644 index 0000000..2a1d204 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/IRecordDnbInstantService.java @@ -0,0 +1,61 @@ +package com.aucma.base.service; + +import java.util.List; +import com.aucma.base.domain.RecordDnbInstant; + +/** + * 电实时数据Service接口 + * + * @author Yinq + * @date 2023-09-26 + */ +public interface IRecordDnbInstantService +{ + /** + * 查询电实时数据 + * + * @param objId 电实时数据主键 + * @return 电实时数据 + */ + public RecordDnbInstant selectRecordDnbInstantByObjId(Long objId); + + /** + * 查询电实时数据列表 + * + * @param recordDnbInstant 电实时数据 + * @return 电实时数据集合 + */ + public List selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant); + + /** + * 新增电实时数据 + * + * @param recordDnbInstant 电实时数据 + * @return 结果 + */ + public int insertRecordDnbInstant(RecordDnbInstant recordDnbInstant); + + /** + * 修改电实时数据 + * + * @param recordDnbInstant 电实时数据 + * @return 结果 + */ + public int updateRecordDnbInstant(RecordDnbInstant recordDnbInstant); + + /** + * 批量删除电实时数据 + * + * @param objIds 需要删除的电实时数据主键集合 + * @return 结果 + */ + public int deleteRecordDnbInstantByObjIds(Long[] objIds); + + /** + * 删除电实时数据信息 + * + * @param objId 电实时数据主键 + * @return 结果 + */ + public int deleteRecordDnbInstantByObjId(Long objId); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java new file mode 100644 index 0000000..835ef9f --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/RecordDnbInstantServiceImpl.java @@ -0,0 +1,93 @@ +package com.aucma.base.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.aucma.base.mapper.RecordDnbInstantMapper; +import com.aucma.base.domain.RecordDnbInstant; +import com.aucma.base.service.IRecordDnbInstantService; + +/** + * 电实时数据Service业务层处理 + * + * @author Yinq + * @date 2023-09-26 + */ +@Service +public class RecordDnbInstantServiceImpl implements IRecordDnbInstantService +{ + @Autowired + private RecordDnbInstantMapper recordDnbInstantMapper; + + /** + * 查询电实时数据 + * + * @param objId 电实时数据主键 + * @return 电实时数据 + */ + @Override + public RecordDnbInstant selectRecordDnbInstantByObjId(Long objId) + { + return recordDnbInstantMapper.selectRecordDnbInstantByObjId(objId); + } + + /** + * 查询电实时数据列表 + * + * @param recordDnbInstant 电实时数据 + * @return 电实时数据 + */ + @Override + public List selectRecordDnbInstantList(RecordDnbInstant recordDnbInstant) + { + return recordDnbInstantMapper.selectRecordDnbInstantList(recordDnbInstant); + } + + /** + * 新增电实时数据 + * + * @param recordDnbInstant 电实时数据 + * @return 结果 + */ + @Override + public int insertRecordDnbInstant(RecordDnbInstant recordDnbInstant) + { + return recordDnbInstantMapper.insertRecordDnbInstant(recordDnbInstant); + } + + /** + * 修改电实时数据 + * + * @param recordDnbInstant 电实时数据 + * @return 结果 + */ + @Override + public int updateRecordDnbInstant(RecordDnbInstant recordDnbInstant) + { + return recordDnbInstantMapper.updateRecordDnbInstant(recordDnbInstant); + } + + /** + * 批量删除电实时数据 + * + * @param objIds 需要删除的电实时数据主键 + * @return 结果 + */ + @Override + public int deleteRecordDnbInstantByObjIds(Long[] objIds) + { + return recordDnbInstantMapper.deleteRecordDnbInstantByObjIds(objIds); + } + + /** + * 删除电实时数据信息 + * + * @param objId 电实时数据主键 + * @return 结果 + */ + @Override + public int deleteRecordDnbInstantByObjId(Long objId) + { + return recordDnbInstantMapper.deleteRecordDnbInstantByObjId(objId); + } +} diff --git a/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml b/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml new file mode 100644 index 0000000..ebf1256 --- /dev/null +++ b/aucma-base/src/main/resources/mapper/base/RecordDnbInstantMapper.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select rdi.obj_id, + rdi.monitor_id, + mr.MONITOR_NAME monitorName, + rdi.collect_time, + rdi.va, + rdi.vb, + rdi.vc, + rdi.ia, + rdi.ib, + rdi.ic, + rdi.record_time, + rdi.glys, + rdi.zxyg, + rdi.active_power, + rdi.reactive_power, + rdi.collect_type, + rdi.is_flag, + rdi.created_by, + rdi.created_time, + rdi.updated_by, + rdi.updated_time, + rdi.factory_code + from record_dnb_instant rdi + left join BASE_MONITORINFO mr on mr.MONITOR_CODE = rdi.monitor_id + + + + + + + + + SELECT seq_record_dnb_instant.NEXTVAL as objId FROM DUAL + + insert into record_dnb_instant + + obj_id, + monitor_id, + collect_time, + va, + vb, + vc, + ia, + ib, + ic, + record_time, + glys, + zxyg, + active_power, + reactive_power, + collect_type, + is_flag, + created_by, + created_time, + updated_by, + updated_time, + factory_code, + + + #{objId}, + #{monitorId}, + #{collectTime}, + #{va}, + #{vb}, + #{vc}, + #{ia}, + #{ib}, + #{ic}, + #{recordTime}, + #{glys}, + #{zxyg}, + #{activePower}, + #{reactivePower}, + #{collectType}, + #{isFlag}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + #{factoryCode}, + + + + + update record_dnb_instant + + monitor_id = #{monitorId}, + collect_time = #{collectTime}, + va = #{va}, + vb = #{vb}, + vc = #{vc}, + ia = #{ia}, + ib = #{ib}, + ic = #{ic}, + record_time = #{recordTime}, + glys = #{glys}, + zxyg = #{zxyg}, + active_power = #{activePower}, + reactive_power = #{reactivePower}, + collect_type = #{collectType}, + is_flag = #{isFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + factory_code = #{factoryCode}, + + where obj_id = #{objId} + + + + delete from record_dnb_instant where obj_id = #{objId} + + + + delete from record_dnb_instant where obj_id in + + #{objId} + + + \ No newline at end of file diff --git a/aucma-base/src/main/resources/mapper/base/RecordInStoreMapper.xml b/aucma-base/src/main/resources/mapper/base/RecordInStoreMapper.xml index 62f0d4c..47bfdfb 100644 --- a/aucma-base/src/main/resources/mapper/base/RecordInStoreMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/RecordInStoreMapper.xml @@ -37,7 +37,7 @@ and material_code = #{materialCode} and in_store_amount = #{inStoreAmount} - and in_store_time between #{params.beginInStoreTime} and #{params.endInStoreTime} + and in_store_time between to_date(#{params.beginInStoreTime}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{params.endInStoreTime}, 'yyyy-mm-dd hh24:mi:ss') and is_flag = #{isFlag} and created_by = #{createdBy} and created_time = #{createdTime} diff --git a/aucma-base/src/main/resources/mapper/base/RecordOutStoreMapper.xml b/aucma-base/src/main/resources/mapper/base/RecordOutStoreMapper.xml index c627be5..cc45b4d 100644 --- a/aucma-base/src/main/resources/mapper/base/RecordOutStoreMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/RecordOutStoreMapper.xml @@ -55,7 +55,7 @@ and out_store_amount = #{outStoreAmount} - and out_store_time between #{params.beginOutStoreTime} and #{params.endOutStoreTime} + and out_store_time between to_date(#{params.beginOutStoreTime}, 'yyyy-mm-dd hh24:mi:ss') and to_date(#{params.endOutStoreTime}, 'yyyy-mm-dd hh24:mi:ss') and is_flag = #{isFlag} and created_by = #{createdBy}