11 changed files with 346 additions and 14 deletions
@ -0,0 +1,53 @@ |
|||
package com.ccsens.beneficiation.api; |
|||
|
|||
import com.ccsens.beneficiation.bean.dto.ParameterDto; |
|||
import com.ccsens.beneficiation.bean.dto.WeightDto; |
|||
import com.ccsens.beneficiation.bean.vo.ParameterVo; |
|||
import com.ccsens.beneficiation.bean.vo.WeightVo; |
|||
import com.ccsens.beneficiation.service.IParameterService; |
|||
import com.ccsens.cloudutil.annotation.MustLogin; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "皮带秤每天上传的重量统计相关" , description = "") |
|||
@RestController |
|||
@RequestMapping("/parameter") |
|||
public class ParameterController { |
|||
@Resource |
|||
private IParameterService parameterService; |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "查看各个设备的参数", notes = "") |
|||
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<ParameterVo.ParameterInfo> queryParameter(@ApiParam @Validated @RequestBody QueryDto params) { |
|||
log.info("查看各个设备的参数:{}",params); |
|||
ParameterVo.ParameterInfo parameterInfo = parameterService.queryParameter(params.getParam()); |
|||
log.info("各个设备的参数:{}",parameterInfo); |
|||
return JsonResponse.newInstance().ok(parameterInfo); |
|||
} |
|||
|
|||
@MustLogin |
|||
@ApiOperation(value = "修改设备的参数", notes = "") |
|||
@RequestMapping(value = "/update", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse updateParameter(@ApiParam @Validated @RequestBody QueryDto<ParameterDto.ParameterInfo> params) { |
|||
log.info("修改设备的参数:{}",params); |
|||
parameterService.updateParameter(params.getParam()); |
|||
log.info("修改设备的参数成功"); |
|||
return JsonResponse.newInstance().ok(); |
|||
} |
|||
} |
@ -0,0 +1,69 @@ |
|||
package com.ccsens.beneficiation.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class ParameterDto { |
|||
@Data |
|||
@ApiModel("修改仪器的参数") |
|||
public static class ParameterInfo{ |
|||
@ApiModelProperty("电耳1") |
|||
private ParameterThreshold electricEar1; |
|||
@ApiModelProperty("电耳2") |
|||
private ParameterThreshold electricEar2; |
|||
@ApiModelProperty("电磁阀1") |
|||
private Parameter solenoidValue1; |
|||
@ApiModelProperty("电磁阀2") |
|||
private Parameter solenoidValue2; |
|||
@ApiModelProperty("变频器1") |
|||
private Parameter transducer1; |
|||
@ApiModelProperty("变频器2") |
|||
private Parameter transducer2; |
|||
@ApiModelProperty("变频器3") |
|||
private Parameter transducer3; |
|||
@ApiModelProperty("变频器4") |
|||
private Parameter transducer4; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("单个仪器的参数") |
|||
public static class Parameter{ |
|||
@NotNull |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("设置值") |
|||
private BigDecimal settingValue; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("电耳的阀值") |
|||
public static class ParameterThreshold{ |
|||
@NotNull |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("阀值1") |
|||
private Threshold thresholdValue1; |
|||
@ApiModelProperty("阀值2") |
|||
private Threshold thresholdValue2; |
|||
@ApiModelProperty("阀值3") |
|||
private Threshold thresholdValue3; |
|||
|
|||
} |
|||
@Data |
|||
@ApiModel("阀值的最大最小值") |
|||
public static class Threshold{ |
|||
@ApiModelProperty("最小") |
|||
private BigDecimal minValue; |
|||
@ApiModelProperty("最打") |
|||
private BigDecimal maxValue; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,109 @@ |
|||
package com.ccsens.beneficiation.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class ParameterVo { |
|||
@Data |
|||
@ApiModel("查看每个仪器的参数") |
|||
public static class ParameterInfo{ |
|||
@ApiModelProperty("皮带秤") |
|||
private Parameter beltWeigher; |
|||
@ApiModelProperty("电耳1") |
|||
private ParameterThreshold electricEar1; |
|||
@ApiModelProperty("电耳2") |
|||
private ParameterThreshold electricEar2; |
|||
@ApiModelProperty("电磁阀1") |
|||
private Parameter solenoidValue1; |
|||
@ApiModelProperty("电磁阀2") |
|||
private Parameter solenoidValue2; |
|||
@ApiModelProperty("流量计1") |
|||
private Parameter flowmeter1; |
|||
@ApiModelProperty("流量计1") |
|||
private Parameter flowmeter2; |
|||
@ApiModelProperty("变频器1") |
|||
private Parameter transducer1; |
|||
@ApiModelProperty("变频器2") |
|||
private Parameter transducer2; |
|||
@ApiModelProperty("变频器3") |
|||
private Parameter transducer3; |
|||
@ApiModelProperty("变频器4") |
|||
private Parameter transducer4; |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("单个仪器的参数") |
|||
public static class Parameter{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("名字") |
|||
private String name; |
|||
@ApiModelProperty("实时值") |
|||
private BigDecimal currentTimeValue; |
|||
@ApiModelProperty("累计值") |
|||
private BigDecimal totalValue; |
|||
|
|||
public Parameter(Long id, String name, BigDecimal currentTimeValue, BigDecimal totalValue) { |
|||
this.id = id; |
|||
this.name = name; |
|||
this.currentTimeValue = currentTimeValue; |
|||
this.totalValue = totalValue; |
|||
} |
|||
|
|||
public Parameter() { |
|||
} |
|||
} |
|||
|
|||
@Data |
|||
@ApiModel("单个仪器的参数带阀值") |
|||
public static class ParameterThreshold{ |
|||
@ApiModelProperty("id") |
|||
private Long id; |
|||
@ApiModelProperty("名字") |
|||
private String name; |
|||
@ApiModelProperty("实时值") |
|||
private BigDecimal currentTimeValue; |
|||
@ApiModelProperty("阀值1") |
|||
private Threshold thresholdValue1; |
|||
@ApiModelProperty("阀值2") |
|||
private Threshold thresholdValue2; |
|||
@ApiModelProperty("阀值3") |
|||
private Threshold thresholdValue3; |
|||
|
|||
public ParameterThreshold(Long id, String name, BigDecimal currentTimeValue, Threshold thresholdValue1, Threshold thresholdValue2, Threshold thresholdValue3) { |
|||
this.id = id; |
|||
this.name = name; |
|||
this.currentTimeValue = currentTimeValue; |
|||
this.thresholdValue1 = thresholdValue1; |
|||
this.thresholdValue2 = thresholdValue2; |
|||
this.thresholdValue3 = thresholdValue3; |
|||
} |
|||
|
|||
public ParameterThreshold() { |
|||
} |
|||
} |
|||
@Data |
|||
@ApiModel("阀值") |
|||
public static class Threshold{ |
|||
@ApiModelProperty("最小") |
|||
private BigDecimal minValue; |
|||
@ApiModelProperty("最打") |
|||
private BigDecimal maxValue; |
|||
|
|||
public Threshold(BigDecimal minValue, BigDecimal maxValue) { |
|||
this.minValue = minValue; |
|||
this.maxValue = maxValue; |
|||
} |
|||
|
|||
public Threshold() { |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.ccsens.beneficiation.service; |
|||
|
|||
import com.ccsens.beneficiation.bean.dto.ParameterDto; |
|||
import com.ccsens.beneficiation.bean.vo.ParameterVo; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface IParameterService { |
|||
/** |
|||
* 查询每个设备的参数 |
|||
* @param param 没有参数 |
|||
* @return 返回每个设备的数据 |
|||
*/ |
|||
ParameterVo.ParameterInfo queryParameter(Object param); |
|||
|
|||
/** |
|||
* 修改一起的参数 |
|||
* @param param 参数 |
|||
*/ |
|||
void updateParameter(ParameterDto.ParameterInfo param); |
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.ccsens.beneficiation.service; |
|||
|
|||
import com.ccsens.beneficiation.bean.dto.ParameterDto; |
|||
import com.ccsens.beneficiation.bean.vo.ParameterVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class ParameterService implements IParameterService{ |
|||
|
|||
@Override |
|||
public ParameterVo.ParameterInfo queryParameter(Object param) { |
|||
ParameterVo.ParameterInfo parameterInfo = new ParameterVo.ParameterInfo(); |
|||
parameterInfo.setBeltWeigher(new ParameterVo.Parameter(1L,"皮带秤", BigDecimal.valueOf(12),BigDecimal.valueOf(1212))); |
|||
parameterInfo.setFlowmeter1(new ParameterVo.Parameter(2L,"流量计1", BigDecimal.valueOf(16),BigDecimal.valueOf(1524))); |
|||
parameterInfo.setFlowmeter2(new ParameterVo.Parameter(3L,"流量计2", BigDecimal.valueOf(5),BigDecimal.valueOf(232))); |
|||
parameterInfo.setSolenoidValue1(new ParameterVo.Parameter(4L,"电磁阀1", BigDecimal.valueOf(84),null)); |
|||
parameterInfo.setSolenoidValue2(new ParameterVo.Parameter(5L,"电磁阀2", BigDecimal.valueOf(95),null)); |
|||
parameterInfo.setTransducer1(new ParameterVo.Parameter(6L,"变频器1", BigDecimal.valueOf(45),null)); |
|||
parameterInfo.setTransducer2(new ParameterVo.Parameter(7L,"变频器2", BigDecimal.valueOf(8),null)); |
|||
parameterInfo.setTransducer3(new ParameterVo.Parameter(8L,"变频器3", BigDecimal.valueOf(67),null)); |
|||
parameterInfo.setTransducer4(new ParameterVo.Parameter(10L,"变频器4", BigDecimal.valueOf(75),null)); |
|||
|
|||
parameterInfo.setElectricEar1(new ParameterVo.ParameterThreshold(11L,"电耳1",BigDecimal.valueOf(60), |
|||
new ParameterVo.Threshold(BigDecimal.valueOf(20),BigDecimal.valueOf(60)), |
|||
new ParameterVo.Threshold(BigDecimal.valueOf(30),BigDecimal.valueOf(70)), |
|||
new ParameterVo.Threshold(BigDecimal.valueOf(40),BigDecimal.valueOf(80)))); |
|||
|
|||
parameterInfo.setElectricEar1(new ParameterVo.ParameterThreshold(12L,"电耳2",BigDecimal.valueOf(65), |
|||
new ParameterVo.Threshold(BigDecimal.valueOf(30),BigDecimal.valueOf(70)), |
|||
new ParameterVo.Threshold(BigDecimal.valueOf(40),BigDecimal.valueOf(80)), |
|||
new ParameterVo.Threshold(BigDecimal.valueOf(50),BigDecimal.valueOf(90)))); |
|||
|
|||
return parameterInfo; |
|||
} |
|||
|
|||
@Override |
|||
public void updateParameter(ParameterDto.ParameterInfo param) { |
|||
|
|||
} |
|||
} |
@ -1,6 +1,6 @@ |
|||
spring: |
|||
profiles: |
|||
active: prod |
|||
include: common, util-prod |
|||
active: test |
|||
include: common, util-test |
|||
|
|||
|
|||
|
@ -1,5 +1,5 @@ |
|||
spring: |
|||
profiles: |
|||
active: test |
|||
include: util-test,common |
|||
active: dev |
|||
include: util-dev,common |
|||
|
|||
|
@ -1,5 +1,5 @@ |
|||
spring: |
|||
profiles: |
|||
active: test |
|||
include: common, util-test |
|||
active: dev |
|||
include: common, util-dev |
|||
|
|||
|
Loading…
Reference in new issue