diff --git a/lzbi-framework/src/main/java/com/lzbi/framework/config/SecurityConfig.java b/lzbi-framework/src/main/java/com/lzbi/framework/config/SecurityConfig.java index 8085e97..e1e8e57 100644 --- a/lzbi-framework/src/main/java/com/lzbi/framework/config/SecurityConfig.java +++ b/lzbi-framework/src/main/java/com/lzbi/framework/config/SecurityConfig.java @@ -116,6 +116,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers( "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/wechat/biz/login/**").permitAll() + .antMatchers("/external/**").permitAll() // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated() .and() diff --git a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java index 1bc3aa8..6692f15 100644 --- a/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/draft/mapper/DcBusiParamDraftDayMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.lzbi.draft.domain.DcBusiParamDraftDay; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.lzbi.draft.domain.ParamDraftQueryVo; +import org.apache.ibatis.annotations.Param; /** * 参数数据底稿(日)Mapper接口 @@ -23,6 +24,23 @@ public interface DcBusiParamDraftDayMapper extends BaseMapper selectLastDataByAssetCodeListAndParamsModelCode(@Param("assetCodeList") List assetCodeList, + @Param("paramsModelCode") String paramsModelCode); /** * 查询参数数据底稿(日)列表 * diff --git a/lzbi-module/src/main/java/com/lzbi/external/controller/ParamsController.java b/lzbi-module/src/main/java/com/lzbi/external/controller/ParamsController.java new file mode 100644 index 0000000..869114d --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/external/controller/ParamsController.java @@ -0,0 +1,34 @@ +package com.lzbi.external.controller; + +import com.lzbi.common.core.domain.AjaxResult; +import com.lzbi.external.service.ParamsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RequestMapping("/external/params") +@RestController +public class ParamsController { + + @Autowired + private ParamsService paramsService; + + /** + * 获取供热面积 + * @return + */ + @GetMapping("/heat-supply-area/singleAsset") + public AjaxResult getHeatSupplyArea(@RequestParam(value = "assetCode") String assetCode) { + return AjaxResult.success(paramsService.getHeatSupplyArea(assetCode)); + } + + /** + * 获取供气面积 + * @return + */ + @PostMapping("/heat-supply-area/multipleAsset") + public AjaxResult getGasSupplyArea(@RequestBody List assetCodeList) { + return AjaxResult.success(paramsService.getGasSupplyArea(assetCodeList)); + } +} diff --git a/lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java b/lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java new file mode 100644 index 0000000..59b5b4a --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/external/service/ParamsService.java @@ -0,0 +1,37 @@ +package com.lzbi.external.service; + +import com.lzbi.common.constant.ParamsModelCodeConstants; +import com.lzbi.draft.domain.DcBusiParamDraftDay; +import com.lzbi.draft.mapper.DcBusiParamDraftDayMapper; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class ParamsService { + + @Resource + private DcBusiParamDraftDayMapper dcBusiParamDraftDayMapper; + + public Double getHeatSupplyArea(String assetCode) { + DcBusiParamDraftDay dcBusiParamDraftDay = dcBusiParamDraftDayMapper.selectLastDataByAssetCodeAndParamsModelCode(assetCode, ParamsModelCodeConstants.供暖面积); + return dcBusiParamDraftDay.getValLast(); + } + + public Map getGasSupplyArea(List assetCodeList) { + if (CollectionUtils.isEmpty(assetCodeList)) { + throw new RuntimeException("资产编码列表不能为空"); + } + List list = dcBusiParamDraftDayMapper.selectLastDataByAssetCodeListAndParamsModelCode(assetCodeList, ParamsModelCodeConstants.供暖面积); + if (CollectionUtils.isEmpty(list)) { + throw new RuntimeException("暂无数据"); + } + Map map = list.stream().collect(Collectors.toMap(DcBusiParamDraftDay::getAssetCode, DcBusiParamDraftDay::getValLast)); + return map; + } +} diff --git a/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java b/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java index eef1b29..a4579a9 100644 --- a/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java +++ b/lzbi-module/src/main/java/com/lzbi/task/TaskParamDfratProcess.java @@ -78,7 +78,7 @@ public class TaskParamDfratProcess { public void doBills() { DcBusiParamBillMaster dcBusiParamBillMasterDao = new DcBusiParamBillMaster(); - dcBusiParamBillMasterDao.setCheckStatus("1"); + dcBusiParamBillMasterDao.setCheckStatus("0"); List dcBusiParamBillMasterDaos = dcBusiParamBillMasterService.selectDcBusiParamBillMasterDaoList(dcBusiParamBillMasterDao); dcBusiParamBillMasterDaos.forEach(item -> { doBill(item); diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml index 3ca9201..31b568a 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiParamDraftDayMapper.xml @@ -98,6 +98,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + insert into dc_busi_param_draft_day