7 changed files with 317 additions and 2 deletions
-
4application/src/main/resources/application.yml
-
98modules/thing/src/main/java/com/thing/ratio/controller/IotPowerCoalRatioController.java
-
59modules/thing/src/main/java/com/thing/ratio/dto/IotPowerCoalRatioDTO.java
-
100modules/thing/src/main/java/com/thing/ratio/entity/IotPowerCoalRatioEntity.java
-
16modules/thing/src/main/java/com/thing/ratio/mapper/IotPowerCoalRatioMapper.java
-
14modules/thing/src/main/java/com/thing/ratio/service/IotPowerCoalRatioService.java
-
28modules/thing/src/main/java/com/thing/ratio/service/impl/IotPowerCoalRatioServiceImpl.java
@ -0,0 +1,98 @@ |
|||||
|
package com.thing.ratio.controller; |
||||
|
|
||||
|
import com.thing.common.core.annotation.LogOperation; |
||||
|
import com.thing.common.core.constants.Constant; |
||||
|
import com.thing.common.core.validator.AssertUtils; |
||||
|
import com.thing.common.core.validator.ValidatorUtils; |
||||
|
import com.thing.common.core.validator.group.AddGroup; |
||||
|
import com.thing.common.core.validator.group.DefaultGroup; |
||||
|
import com.thing.common.core.validator.group.UpdateGroup; |
||||
|
import com.thing.common.core.web.response.PageData; |
||||
|
import com.thing.common.core.web.response.Result; |
||||
|
|
||||
|
import com.thing.ratio.dto.IotPowerCoalRatioDTO; |
||||
|
import com.thing.ratio.service.IotPowerCoalRatioService; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||
|
import io.swagger.v3.oas.annotations.Parameters; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
* |
||||
|
* @author ls |
||||
|
* @since 3.0 2025-01-02 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("v2/power/ratio") |
||||
|
@Tag(name="折标煤系数") |
||||
|
@RequiredArgsConstructor |
||||
|
public class IotPowerCoalRatioController { |
||||
|
|
||||
|
private final IotPowerCoalRatioService iotPowerCoalRatioService; |
||||
|
|
||||
|
@GetMapping("page") |
||||
|
@Operation(summary="分页") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
||||
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
||||
|
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
||||
|
@Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") |
||||
|
}) |
||||
|
public Result<PageData<IotPowerCoalRatioDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){ |
||||
|
PageData<IotPowerCoalRatioDTO> page = iotPowerCoalRatioService.getPageData(params, IotPowerCoalRatioDTO.class); |
||||
|
return new Result<PageData<IotPowerCoalRatioDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
@Operation(summary="信息") |
||||
|
public Result<IotPowerCoalRatioDTO> get(@PathVariable("id") Long id){ |
||||
|
IotPowerCoalRatioDTO data = iotPowerCoalRatioService.getByIdAs(id, IotPowerCoalRatioDTO.class); |
||||
|
return new Result<IotPowerCoalRatioDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
@Operation(summary="保存") |
||||
|
@LogOperation("保存") |
||||
|
public Result<Void> save(@RequestBody IotPowerCoalRatioDTO dto){ |
||||
|
//效验数据 |
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
iotPowerCoalRatioService.saveDto(dto); |
||||
|
return new Result<>(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
@Operation(summary="修改") |
||||
|
@LogOperation("修改") |
||||
|
public Result<Void> update(@RequestBody IotPowerCoalRatioDTO dto){ |
||||
|
//效验数据 |
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
iotPowerCoalRatioService.updateDto(dto); |
||||
|
return new Result<>(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
@Operation(summary="删除") |
||||
|
@LogOperation("删除") |
||||
|
public Result<Void> delete(@RequestBody Long[] ids){ |
||||
|
//效验数据 |
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
iotPowerCoalRatioService.batchDelete(ids); |
||||
|
return new Result<>(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
*@GetMapping("export") |
||||
|
*@Operation(summary="导出") |
||||
|
*@LogOperation("导出") |
||||
|
*public void export(@Parameter(hidden = true) @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
* List<IotPowerCoalRatioDTO> list = iotPowerCoalRatioService.listAs(params, IotPowerCoalRatioDTO.class); |
||||
|
* //ExcelUtils.exportExcelToTarget(response, null, "折标煤系数", list, IotPowerCoalRatioExcel.class); |
||||
|
*} |
||||
|
*/ |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
package com.thing.ratio.dto; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
* |
||||
|
* @author ls |
||||
|
* @since 3.0 2025-01-02 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Schema(description = "折标煤系数") |
||||
|
public class IotPowerCoalRatioDTO implements Serializable { |
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@Schema(description = "折标煤系数设置id") |
||||
|
private Long id; |
||||
|
@Schema(description = "能源品种") |
||||
|
private String powerTypeCode; |
||||
|
@Schema(description = "单位") |
||||
|
private String unit; |
||||
|
@Schema(description = "当量/等量 calorific/equivalent(业务字典-sa)") |
||||
|
private String energyValue; |
||||
|
@Schema(description = "折标煤单位") |
||||
|
private String coalUnit; |
||||
|
@Schema(description = "折标煤系数") |
||||
|
private BigDecimal coalRatio; |
||||
|
@Schema(description = "企业id") |
||||
|
private Long deptId; |
||||
|
@Schema(description = "租户code") |
||||
|
private Long tenantCode; |
||||
|
@Schema(description = "创建者") |
||||
|
private Long creator; |
||||
|
@Schema(description = "创建时间") |
||||
|
private Date createDate; |
||||
|
@Schema(description = "修改者") |
||||
|
private Long updater; |
||||
|
@Schema(description = "修改时间") |
||||
|
private Date updateDate; |
||||
|
@Schema(description = "类型") |
||||
|
private String type; |
||||
|
@Schema(description = "系数") |
||||
|
private BigDecimal ratio; |
||||
|
@Schema(description = "折标煤类型") |
||||
|
private String coalType; |
||||
|
@Schema(description = "实际折标系数小数位") |
||||
|
private String coalRatioDecimal; |
||||
|
@Schema(description = "参考折标系数小数位") |
||||
|
private String ratioDecimal; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
package com.thing.ratio.entity; |
||||
|
|
||||
|
import com.mybatisflex.annotation.Id; |
||||
|
import com.mybatisflex.annotation.KeyType; |
||||
|
import com.mybatisflex.annotation.Table; |
||||
|
|
||||
|
import com.mybatisflex.core.keygen.KeyGenerators; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
* |
||||
|
* @author ls |
||||
|
* @since 3.0 2025-01-02 |
||||
|
*/ |
||||
|
@Data |
||||
|
@Accessors(chain = true) |
||||
|
@EqualsAndHashCode(callSuper=false) |
||||
|
@Table("iot_power_coal_ratio") |
||||
|
public class IotPowerCoalRatioEntity implements Serializable { |
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数设置id |
||||
|
*/ |
||||
|
@Id(keyType = KeyType.Generator,value = KeyGenerators.snowFlakeId) |
||||
|
private Long id; |
||||
|
/** |
||||
|
* 能源品种 |
||||
|
*/ |
||||
|
private String powerTypeCode; |
||||
|
/** |
||||
|
* 单位 |
||||
|
*/ |
||||
|
private String unit; |
||||
|
/** |
||||
|
* 当量/等量 calorific/equivalent(业务字典-sa) |
||||
|
*/ |
||||
|
private String energyValue; |
||||
|
/** |
||||
|
* 折标煤单位 |
||||
|
*/ |
||||
|
private String coalUnit; |
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
*/ |
||||
|
private BigDecimal coalRatio; |
||||
|
/** |
||||
|
* 企业id |
||||
|
*/ |
||||
|
private Long deptId; |
||||
|
/** |
||||
|
* 租户code |
||||
|
*/ |
||||
|
private Long tenantCode; |
||||
|
/** |
||||
|
* 创建者 |
||||
|
*/ |
||||
|
private Long creator; |
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createDate; |
||||
|
/** |
||||
|
* 修改者 |
||||
|
*/ |
||||
|
private Long updater; |
||||
|
/** |
||||
|
* 修改时间 |
||||
|
*/ |
||||
|
private Date updateDate; |
||||
|
/** |
||||
|
* 类型 |
||||
|
*/ |
||||
|
private String type; |
||||
|
/** |
||||
|
* 系数 |
||||
|
*/ |
||||
|
private BigDecimal ratio; |
||||
|
/** |
||||
|
* 折标煤类型 |
||||
|
*/ |
||||
|
private String coalType; |
||||
|
/** |
||||
|
* 实际折标系数小数位 |
||||
|
*/ |
||||
|
private String coalRatioDecimal; |
||||
|
/** |
||||
|
* 参考折标系数小数位 |
||||
|
*/ |
||||
|
private String ratioDecimal; |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
package com.thing.ratio.mapper; |
||||
|
|
||||
|
import com.thing.common.orm.mapper.PowerBaseMapper; |
||||
|
import com.thing.ratio.entity.IotPowerCoalRatioEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
* |
||||
|
* @author ls |
||||
|
* @since 3.0 2025-01-02 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IotPowerCoalRatioMapper extends PowerBaseMapper<IotPowerCoalRatioEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.thing.ratio.service; |
||||
|
|
||||
|
import com.thing.common.orm.service.IBaseService; |
||||
|
import com.thing.ratio.entity.IotPowerCoalRatioEntity; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
* |
||||
|
* @author ls |
||||
|
* @since 3.0 2025-01-02 |
||||
|
*/ |
||||
|
public interface IotPowerCoalRatioService extends IBaseService<IotPowerCoalRatioEntity> { |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.thing.ratio.service.impl; |
||||
|
|
||||
|
import com.mybatisflex.core.query.QueryWrapper; |
||||
|
import com.thing.common.orm.service.impl.BaseServiceImpl; |
||||
|
import com.thing.ratio.entity.IotPowerCoalRatioEntity; |
||||
|
import com.thing.ratio.mapper.IotPowerCoalRatioMapper; |
||||
|
import com.thing.ratio.service.IotPowerCoalRatioService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 折标煤系数 |
||||
|
* |
||||
|
* @author ls |
||||
|
* @since 3.0 2025-01-02 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class IotPowerCoalRatioServiceImpl extends BaseServiceImpl<IotPowerCoalRatioMapper, IotPowerCoalRatioEntity> implements IotPowerCoalRatioService { |
||||
|
|
||||
|
@Override |
||||
|
public QueryWrapper getWrapper(Map<String, Object> params){ |
||||
|
QueryWrapper wrapper = new QueryWrapper(); |
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue