| | |
| | | # Compiled class file |
| | | *.class |
| | | ###################################################################### |
| | | # Build Tools |
| | | |
| | | # Log file |
| | | .gradle |
| | | /build/ |
| | | !gradle/wrapper/gradle-wrapper.jar |
| | | |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | |
| | | ###################################################################### |
| | | # IDE |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### JRebel ### |
| | | rebel.xml |
| | | |
| | | ### NetBeans ### |
| | | nbproject/private/ |
| | | build/* |
| | | nbbuild/ |
| | | dist/ |
| | | nbdist/ |
| | | .nb-gradle/ |
| | | |
| | | ###################################################################### |
| | | # Others |
| | | *.log |
| | | *.xml.versionsBackup |
| | | *.swp |
| | | |
| | | # BlueJ files |
| | | *.ctxt |
| | | !*/build/*.java |
| | | !*/build/*.html |
| | | !*/build/*.xml |
| | | |
| | | # Mobile Tools for Java (J2ME) |
| | | .mtj.tmp/ |
| | | |
| | | # Package Files # |
| | | *.jar |
| | | *.war |
| | | *.nar |
| | | *.ear |
| | | *.zip |
| | | *.tar.gz |
| | | *.rar |
| | | |
| | | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
| | | hs_err_pid* |
| | | uploadPath |
| | |
| | | |
| | | <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">ä¼ä¸è½æºç®¡çå¹³å°</h1> |
| | | <h4 align="center">åºäºSpringBootåè¥ä¾æ¡æ¶å¼å</h4> |
| | | |
| | | |
| | | #### ä»ç» |
| | | éè¿ç©èç½ææ¯ï¼ééä¼ä¸æ°´ãçµãæ°ãççè½èæ°æ®ï¼å¸®ä¼ä¸å»ºç«è½æºç®¡çä½ç³»ï¼æ¾å°è·åæ»´æ¼ï¼ä»è为ä¼ä¸èè½æä¾ä¾æ®ã |
| | | è¿ä¸æ¥ä¸ºä¼ä¸å®ç°ç¢³è·è¸ªãç¢³çæ¥ã碳交æãè°æ±æ¥çå
¨çå½è¿ç¨ã 为ä¸å½ç¢³è¾¾å³°-碳ä¸åååºè´¡ç®ã |
| | | é对客æ·åºæ¯ï¼æ¿åºãååºãä¼ä¸ãå·¥ç¿ãå
Œ
±å»ºççã |
| | | |
| | | æ¡æ¶ï¼åºäºSpringBootçè¥ä¾æ¡æ¶ æè¯»ææãçé¢ç®æ´ç¾è§ã |
| | | å
³ç³»æ°æ®åºï¼influxdb |
| | | æ¶åºæ°æ®åºï¼mysql æè
postgredb |
| | | ä¸é´ä»¶ï¼redisï¼mq |
| | | |
| | | #### æ°æ®é©±å¨çè®¡ç®æ¨¡ååä¸å¡æ¨¡åé
ç½® |
| | | æ¯æå¨æç¹ä½é
ç½®ãæ°æ®æ¨¡åãä¸å¡æ¨¡åçã |
| | | |
| | | #### ä¸å¡æ¶æ |
| | |  |
| | | #### ææ¯æ¶æãæªæ¥è§åã |
| | |  |
| | | #### 亮ç¹åè½ |
| | |  |
| | | #### åè½è§å |
| | | 1. é¦é¡µçæ¿ |
| | | 2. 宿¶æ°æ®çæµ |
| | | 2.1. 宿¶æ°æ®æ¥ç |
| | | 2.2. ç»æå¾åæï¼svg å¾ç»å®ï¼ |
| | | 3. å岿°æ®åæ |
| | | 4. ç»¼åææ åæ |
| | | 4.1. ç»¼åææ åæï¼æ¥ï¼ |
| | | 4.2. ç»¼åææ åæï¼æï¼ |
| | | 4.3. ç»¼åææ åæï¼å¹´ï¼ |
| | | 5. éç¹è®¾å¤åæ |
| | | 5.1. éç¹è®¾å¤åæï¼æ¥ï¼ |
| | | 5.2. éç¹è®¾å¤åæï¼æï¼ |
| | | 5.3. éç¹è®¾å¤åæï¼å¹´ï¼ |
| | | 6. å·¥åºè½èåæ |
| | | 6.1. å·¥åºè½èåæï¼æ¥ï¼ |
| | | 6.2. å·¥åºè½èåæï¼æï¼ |
| | | 6.3. å·¥åºè½èåæï¼å¹´ï¼ |
| | | 7. å°å³°å¹³è°·åæ |
| | | 7.1. å°å³°å¹³è°·é
ç½® |
| | | 7.2. å°å³°å¹³è°·æ°æ® |
| | | 8. è½è对æ¯åæï¼åè½æºåç§ï¼ |
| | | 8.1. çµåç¯æ¯åæ |
| | | 8.2. æ°´åç¯æ¯åæ |
| | | 9. æºè½æ¥è¦ |
| | | 9.1. æ¥è¦åæ |
| | | 9.2. æ¥è¦é
ç½® |
| | | 10. åèåæ |
| | | 11. 计åä¸å®ç»© |
| | | 12. ç¨è½èæ ¸ |
| | | 13. ç¨è½å¯¹æ |
| | | 14. æ°æ®è¡¥å½ |
| | | 15. èè½é¡¹ç®ç®¡ç |
| | | 16. è½æºå¹³è¡¡åæ |
| | | 17. è½æºå¯¹æ åæ |
| | | 18. 模åé
置管çï¼è®¡ç®æ¨¡åçï¼ |
| | | 19. åºç¡æ°æ®ç®¡çï¼åå
¸ãè½æºç±»åçï¼ |
| | | 20. ç³»ç»ç®¡çï¼ç¨æ·ãè§è²ãæéçï¼ |
| | | |
| | | #### UIå±ç¤ºï¼å¾
å®åï¼ |
| | | |
| | | #### æ¼ç¤ºè´¦å·ï¼å¾
å®åï¼ |
| | | |
| | | #### åä¸è´¡ç® |
| | | |
| | | 1. Fork æ¬ä»åº |
| | | 2. æ°å»º Feat_xxx 忝 |
| | | 3. æäº¤ä»£ç |
| | | 4. æ°å»º Pull Request |
| | | |
| | |
| | | @GetMapping("/meter/list") |
| | | public TableDataInfo meterList(ProductOutput productOutput, @RequestParam Long pageNum, @RequestParam Long pageSize) |
| | | { |
| | | // startPage(); |
| | | productOutput.setDataType("2"); |
| | | Page<ProductOutput> list = auxiliaryInputService.selectProductOutputPage(productOutput,pageNum,pageSize); |
| | | return getDataTable(list); |
| | |
| | | @GetMapping("/energyindex/list") |
| | | public TableDataInfo energyIndexList(ProductOutput productOutput, @RequestParam Long pageNum, @RequestParam Long pageSize) |
| | | { |
| | | startPage(); |
| | | productOutput.setDataType("3"); |
| | | Page<ProductOutput> list = auxiliaryInputService.selectProductOutputPage(productOutput,pageNum,pageSize); |
| | | return getDataTable(list); |
| | |
| | | // @GetMapping("/energyYield/list") |
| | | // public TableDataInfo energyYieldList(ProductOutput productOutput, @RequestParam Long pageNum, @RequestParam Long pageSize) |
| | | // { |
| | | //// startPage(); |
| | | // productOutput.setDataType("5"); |
| | | // productOutput.setTimeType("MONTH"); |
| | | // Page<ProductOutput> list = auxiliaryInputService.selectProductOutputPage(productOutput,pageNum,pageSize); |
| | |
| | | // @GetMapping("/energyPlanYield/list") |
| | | // public TableDataInfo energyPlanYieldList(ProductOutput productOutput, @RequestParam Long pageNum, @RequestParam Long pageSize) |
| | | // { |
| | | //// startPage(); |
| | | // productOutput.setDataType("4"); |
| | | // productOutput.setTimeType("MONTH"); |
| | | // Page<ProductOutput> list = auxiliaryInputService.selectProductOutputPage(productOutput,pageNum,pageSize); |
| | |
| | | // @GetMapping("/energySettlement/list") |
| | | // public TableDataInfo energySettlementList(ProductOutput productOutput, @RequestParam Long pageNum, @RequestParam Long pageSize) |
| | | // { |
| | | //// startPage(); |
| | | // productOutput.setDataType("6"); |
| | | // productOutput.setTimeType("MONTH"); |
| | | // Page<ProductOutput> list = auxiliaryInputService.selectProductOutputPage(productOutput,pageNum,pageSize); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.benchmarkmanage; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage; |
| | | import com.zhitan.benchmarkmanage.service.IEnergyBenchmarkManageService; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.common.utils.ServletUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.framework.web.service.TokenService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * æ æå¼ç®¡çController |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-12 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/benchmarkManage") |
| | | public class EnergyBenchmarkManageController extends BaseController |
| | | { |
| | | @Resource |
| | | private IEnergyBenchmarkManageService energyBenchmarkManageService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡çå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:benchmarkManage:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(EnergyBenchmarkManage energyBenchmarkManage, @RequestParam Long pageNum, @RequestParam Long pageSize) |
| | | { |
| | | // startPage(); |
| | | Page<EnergyBenchmarkManage> list = energyBenchmarkManageService.selectBenchmarkManagePage(energyBenchmarkManage,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¯¼åºæ æå¼ç®¡çå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:benchmarkManage:export')") |
| | | @Log(title = "æ æå¼ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, EnergyBenchmarkManage energyBenchmarkManage) |
| | | { |
| | | List<EnergyBenchmarkManage> list = energyBenchmarkManageService.selectEnergyBenchmarkManageList(energyBenchmarkManage); |
| | | ExcelUtil<EnergyBenchmarkManage> util = new ExcelUtil<EnergyBenchmarkManage>(EnergyBenchmarkManage.class); |
| | | util.exportExcel(response, list, "æ æå¼ç®¡çæ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ æå¼ç®¡ç详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:benchmarkManage:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | | { |
| | | return success(energyBenchmarkManageService.selectEnergyBenchmarkManageById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ æå¼ç®¡ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:benchmarkManage:add')") |
| | | @Log(title = "æ æå¼ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody EnergyBenchmarkManage energyBenchmarkManage) |
| | | { |
| | | if (StringUtils.isBlank(energyBenchmarkManage.getCode())) { |
| | | return error("请è¾å
¥æ æç¼å·ï¼"); |
| | | } |
| | | |
| | | //æ ¡éªå¯ä¸ |
| | | EnergyBenchmarkManage queryParams=new EnergyBenchmarkManage(); |
| | | queryParams.setCode(energyBenchmarkManage.getCode()); |
| | | List<EnergyBenchmarkManage> codeReptList = energyBenchmarkManageService.getList(queryParams); |
| | | if (null!=codeReptList && !codeReptList.isEmpty()) { |
| | | return error("æ æç¼å·éå¤ï¼"); |
| | | } |
| | | queryParams=new EnergyBenchmarkManage(); |
| | | queryParams.setType(energyBenchmarkManage.getType()); |
| | | queryParams.setGrade(energyBenchmarkManage.getGrade()); |
| | | List<EnergyBenchmarkManage> dataReptList = energyBenchmarkManageService.getList(queryParams); |
| | | if (null!=dataReptList && !dataReptList.isEmpty()) { |
| | | return error("æ æä¿¡æ¯å·²ç»´æ¤ï¼"); |
| | | } |
| | | energyBenchmarkManage.setId(UUID.randomUUID().toString()); |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | energyBenchmarkManage.setCreateBy(loginUser.getUsername()); |
| | | return toAjax(energyBenchmarkManageService.insertEnergyBenchmarkManage(energyBenchmarkManage)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ æå¼ç®¡ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:benchmarkManage:edit')") |
| | | @Log(title = "æ æå¼ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody EnergyBenchmarkManage energyBenchmarkManage) |
| | | { |
| | | if (StringUtils.isBlank(energyBenchmarkManage.getCode())) { |
| | | return error("请è¾å
¥æ æç¼å·ï¼"); |
| | | } |
| | | EnergyBenchmarkManage queryParams=new EnergyBenchmarkManage(); |
| | | queryParams.setCode(energyBenchmarkManage.getCode()); |
| | | List<EnergyBenchmarkManage> codeReptList = energyBenchmarkManageService.getList(queryParams); |
| | | if (null!=codeReptList && !codeReptList.isEmpty()) { |
| | | return error("æ æç¼å·éå¤ï¼"); |
| | | } |
| | | queryParams=new EnergyBenchmarkManage(); |
| | | queryParams.setType(energyBenchmarkManage.getType()); |
| | | queryParams.setGrade(energyBenchmarkManage.getGrade()); |
| | | List<EnergyBenchmarkManage> dataReptList = energyBenchmarkManageService.getList(queryParams); |
| | | if (null!=dataReptList && !dataReptList.isEmpty()) { |
| | | return error("æ æä¿¡æ¯å·²ç»´æ¤ï¼"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | energyBenchmarkManage.setUpdateBy(loginUser.getUsername()); |
| | | return toAjax(energyBenchmarkManageService.updateEnergyBenchmarkManage(energyBenchmarkManage)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿 æå¼ç®¡ç |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:benchmarkManage:remove')") |
| | | @Log(title = "æ æå¼ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) |
| | | { |
| | | return toAjax(energyBenchmarkManageService.deleteEnergyBenchmarkManageByIds(ids)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.carbonemission; |
| | | |
| | | import com.zhitan.basicdata.domain.FacilityAnnex; |
| | | import com.zhitan.carbonemission.domain.dto.CarbonEmissionDTO; |
| | | import com.zhitan.carbonemission.domain.vo.carbonEmissionYQVO; |
| | | import com.zhitan.carbonemission.service.ICarbonEmissionService; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.web.controller.basicdata.FacilityAnnexController; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.HttpMediaTypeException; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ç¢³ææ¾æ ¸ç®Controller |
| | | * |
| | | * @author lsk |
| | | * @date 2024-10-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/carbonEmission") |
| | | public class CarbonEmissionController extends BaseController |
| | | { |
| | | |
| | | @Resource |
| | | private ICarbonEmissionService carbonEmissionService; |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(CarbonEmissionController.class); |
| | | |
| | | |
| | | |
| | | @GetMapping("/up") |
| | | public AjaxResult up(CarbonEmissionDTO carbonEmissionDTO) |
| | | { |
| | | final Map<String, Object> upCarbonEmission = carbonEmissionService.getUpCarbonEmission(carbonEmissionDTO); |
| | | return AjaxResult.success(upCarbonEmission); |
| | | } |
| | | |
| | | @GetMapping("/middle") |
| | | public AjaxResult middle(CarbonEmissionDTO carbonEmissionDTO) |
| | | { |
| | | final List<carbonEmissionYQVO> carbonEmissionYQVO = carbonEmissionService.getMiddleCarbonEmission(carbonEmissionDTO); |
| | | return AjaxResult.success(carbonEmissionYQVO); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @ResponseBody |
| | | public void export(HttpServletResponse response, CarbonEmissionDTO carbonEmissionDTO) |
| | | { |
| | | List<carbonEmissionYQVO> carbonEmissionYQVO = carbonEmissionService.getMiddleCarbonEmission(carbonEmissionDTO); |
| | | ExcelUtil<carbonEmissionYQVO> util = new ExcelUtil<carbonEmissionYQVO>(carbonEmissionYQVO.class); |
| | | util.exportExcel(response,carbonEmissionYQVO, "ç¢³ææ¾éåç¯æ¯"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.costmanagement; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.utils.ServletUtils; |
| | | import com.zhitan.framework.web.service.TokenService; |
| | | import com.zhitan.spikesandvalleys.domain.vo.SpikesAndValleysSchemeVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import javax.annotation.Resource; |
| | | 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.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.zhitan.costmanagement.service.ICostElectricityInputService; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãController |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/cost/input") |
| | | public class CostElectricityInputController extends BaseController |
| | | { |
| | | @Resource |
| | | private ICostElectricityInputService costElectricityInputService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:Input:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(CostElectricityInput costElectricityInput,Long pageNum, Long pageSize) |
| | | { |
| | | // startPage(); |
| | | // List<CostElectricityInput> list = costElectricityInputService.selectCostElectricityInputList(costElectricityInput); |
| | | Page<CostElectricityInput> page = costElectricityInputService.selectCostElectricityInputList(costElectricityInput, pageNum, pageSize); |
| | | return getDataTable(page); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导åºã请填ååè½åç§°ãå表 |
| | | */ |
| | | // @PreAuthorize("@ss.hasPermi('system:Input:export')") |
| | | // @Log(title = "ã请填ååè½åç§°ã", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, CostElectricityInput costElectricityInput) |
| | | // { |
| | | // List<CostElectricityInput> list = costElectricityInputService.selectCostElectricityInputList(costElectricityInput); |
| | | // ExcelUtil<CostElectricityInput> util = new ExcelUtil<CostElectricityInput>(CostElectricityInput.class); |
| | | // util.exportExcel(response, list, "ã请填ååè½åç§°ãæ°æ®"); |
| | | // } |
| | | |
| | | /** |
| | | * è·åã请填ååè½åç§°ã详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:Input:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | | { |
| | | return success(costElectricityInputService.selectCostElectricityInputById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:Input:add')") |
| | | @Log(title = "ã请填ååè½åç§°ã", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody CostElectricityInput costElectricityInput) throws Exception { |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | costElectricityInput.setCreateBy(loginUser.getUsername()); |
| | | //æ ¡éªå°å³°å¹³è°·çµéç¸å æ¯å¦=æ»ç¨çµ |
| | | BigDecimal total = costElectricityInput.getFlatElectricity().add(costElectricityInput.getSharpElectricity()). |
| | | add(costElectricityInput.getPeakElectricity()).add(costElectricityInput.getValleyElectricity()); |
| | | if(total.compareTo(costElectricityInput.getElectricityNum())!=0){ |
| | | return AjaxResult.error("å°å³°å¹³è°·çµéç¸å ä¸çäºæ»ç¨çµé"); |
| | | } |
| | | return toAjax(costElectricityInputService.insertCostElectricityInput(costElectricityInput)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:Input:edit')") |
| | | @Log(title = "ã请填ååè½åç§°ã", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody CostElectricityInput costElectricityInput) throws Exception { |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | costElectricityInput.setUpdateBy(loginUser.getUsername()); |
| | | return toAjax(costElectricityInputService.updateCostElectricityInput(costElectricityInput)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ã |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:Input:remove')") |
| | | @Log(title = "ã请填ååè½åç§°ã", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) |
| | | { |
| | | return toAjax(costElectricityInputService.deleteCostElectricityInputByIds(ids)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.costmanagement; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.zhitan.framework.web.service.TokenService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import javax.annotation.Resource; |
| | | 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.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.costmanagement.domain.CostPriceRelevancy; |
| | | import com.zhitan.costmanagement.service.ICostPriceRelevancyService; |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | |
| | | /** |
| | | * åä»·å
³èController |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-09 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/cost/relevancy") |
| | | public class CostPriceRelevancyController extends BaseController |
| | | { |
| | | @Resource |
| | | private ICostPriceRelevancyService costPriceRelevancyService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * æ¥è¯¢åä»·å
³èå表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:relevancy:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(CostPriceRelevancy costPriceRelevancy,Long pageNum, Long pageSize) |
| | | { |
| | | startPage(); |
| | | Page<CostPriceRelevancy> page = costPriceRelevancyService.selectCostPriceRelevancyList(costPriceRelevancy, pageNum, pageSize); |
| | | return getDataTable(page); |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 导åºåä»·å
³èå表 |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:relevancy:export')") |
| | | // @Log(title = "åä»·å
³è", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, CostPriceRelevancy costPriceRelevancy) |
| | | // { |
| | | // List<CostPriceRelevancy> list = costPriceRelevancyService.selectCostPriceRelevancyList(costPriceRelevancy); |
| | | // ExcelUtil<CostPriceRelevancy> util = new ExcelUtil<CostPriceRelevancy>(CostPriceRelevancy.class); |
| | | // util.exportExcel(response, list, "åä»·å
³èæ°æ®"); |
| | | // } |
| | | |
| | | /** |
| | | * è·ååä»·å
³è详ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:relevancy:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | | { |
| | | return success(costPriceRelevancyService.selectCostPriceRelevancyById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åä»·å
³è |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:relevancy:add')") |
| | | @Log(title = "åä»·å
³è", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody CostPriceRelevancy costPriceRelevancy) |
| | | { |
| | | return toAjax(costPriceRelevancyService.insertCostPriceRelevancy(costPriceRelevancy)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åä»·å
³è |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:relevancy:edit')") |
| | | @Log(title = "åä»·å
³è", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody CostPriceRelevancy costPriceRelevancy) |
| | | { |
| | | return toAjax(costPriceRelevancyService.updateCostPriceRelevancy(costPriceRelevancy)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åä»·å
³è |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:relevancy:remove')") |
| | | @Log(title = "åä»·å
³è", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) |
| | | { |
| | | return toAjax(costPriceRelevancyService.deleteCostPriceRelevancyByIds(ids)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.costmanagement; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.common.utils.ServletUtils; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceTacticsVo; |
| | | import com.zhitan.costmanagement.service.ICostPriceTacticsService; |
| | | import com.zhitan.framework.web.service.TokenService; |
| | | import com.zhitan.peakvalley.service.IElectricityPriceDateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ææ¬çç¥Controller |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/cost/tactics") |
| | | public class CostPriceTacticsController extends BaseController |
| | | { |
| | | @Resource |
| | | private ICostPriceTacticsService costPriceTacticsService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private IElectricityPriceDateService electricityPriceDateService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:tactics:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(CostPriceTactics costPriceTactics,Long pageNum, Long pageSize) |
| | | { |
| | | Page<CostPriceTacticsVo> page = costPriceTacticsService.selectCostPriceTacticsList(costPriceTactics, pageNum, pageSize); |
| | | |
| | | return getDataTable(page); |
| | | } |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:tactics:list')") |
| | | @GetMapping("/allList") |
| | | public AjaxResult allList() |
| | | { |
| | | List<CostPriceTacticsVo> list = costPriceTacticsService.selectCostPriceTacticsListAll(); |
| | | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | // /** |
| | | // * å¯¼åºææ¬çç¥å表 |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:export')") |
| | | // @Log(title = "ææ¬çç¥", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, CostPriceTactics costPriceTactics) |
| | | // { |
| | | // List<CostPriceTactics> list = costPriceTacticsService.selectCostPriceTacticsList(costPriceTactics); |
| | | // ExcelUtil<CostPriceTactics> util = new ExcelUtil<CostPriceTactics>(CostPriceTactics.class); |
| | | // util.exportExcel(response, list, "ææ¬çç¥æ°æ®"); |
| | | // } |
| | | |
| | | /** |
| | | * è·åææ¬çç¥è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:tactics:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | | { |
| | | return success(costPriceTacticsService.selectCostPriceTacticsById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ææ¬çç¥ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:tactics:add')") |
| | | @Log(title = "ææ¬çç¥", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody CostPriceTacticsVo costPriceTacticsVo) throws Exception { |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | costPriceTacticsVo.setCreateBy(loginUser.getUsername()); |
| | | return toAjax(costPriceTacticsService.insertCostPriceTactics(costPriceTacticsVo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ææ¬çç¥ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:tactics:edit')") |
| | | @Log(title = "ææ¬çç¥", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody CostPriceTacticsVo costPriceTacticsVo) |
| | | { |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | costPriceTacticsVo.setUpdateBy(loginUser.getUsername()); |
| | | return toAjax(costPriceTacticsService.updateCostPriceTactics(costPriceTacticsVo)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿æ¬çç¥ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('costmanagement:tactics:remove')") |
| | | @Log(title = "ææ¬çç¥", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) |
| | | { |
| | | return toAjax(costPriceTacticsService.deleteCostPriceTacticsByIds(ids)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | //package com.zhitan.web.controller.costmanagement; |
| | | // |
| | | //import java.util.List; |
| | | // |
| | | //import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | //import com.zhitan.common.core.domain.model.LoginUser; |
| | | //import com.zhitan.common.core.page.TableDataInfo; |
| | | //import com.zhitan.common.utils.ServletUtils; |
| | | //import com.zhitan.costmanagement.domain.vo.ElectricityPriceDateVo; |
| | | //import com.zhitan.framework.web.service.TokenService; |
| | | //import com.zhitan.peakvalley.domain.ElectricityPriceDate; |
| | | //import com.zhitan.peakvalley.service.IElectricityPriceDateService; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.security.access.prepost.PreAuthorize; |
| | | //import javax.annotation.Resource; |
| | | //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.zhitan.common.annotation.Log; |
| | | //import com.zhitan.common.core.controller.BaseController; |
| | | //import com.zhitan.common.core.domain.AjaxResult; |
| | | //import com.zhitan.common.enums.BusinessType; |
| | | //import com.zhitan.costmanagement.service.ICostPriceTacticsService; |
| | | // |
| | | ///** |
| | | // * ææ¬çç¥Controller |
| | | // * |
| | | // * @author ZhiTan |
| | | // * @date 2024-11-08 |
| | | // */ |
| | | //@RestController |
| | | //@RequestMapping("/cost/tactics") |
| | | //public class CostPriceTacticsTestController extends BaseController |
| | | //{ |
| | | // @Resource |
| | | // private ICostPriceTacticsService costPriceTacticsService; |
| | | // @Autowired |
| | | // private TokenService tokenService; |
| | | // @Resource |
| | | // private IElectricityPriceDateService electricityPriceDateService; |
| | | // |
| | | // |
| | | // /** |
| | | // * æ¥è¯¢ææ¬çç¥å表 |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:list')") |
| | | // @GetMapping("/list") |
| | | // public TableDataInfo list(ElectricityPriceDate electricityPriceDate, Long pageNum, Long pageSize) |
| | | // { |
| | | // Page<ElectricityPriceDateVo> page = electricityPriceDateService.selectElectricityPriceDatePageTactics(electricityPriceDate, pageNum, pageSize); |
| | | // |
| | | // return getDataTable(page); |
| | | // } |
| | | // /** |
| | | // * æ¥è¯¢ææ¬çç¥å表 |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:list')") |
| | | // @GetMapping("/allList") |
| | | // public AjaxResult allList() |
| | | // { |
| | | // List<ElectricityPriceDate> list = electricityPriceDateService.selectElectricityPriceDatePageTacticsAll(); |
| | | // return AjaxResult.success(list); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // /** |
| | | // * è·åææ¬çç¥è¯¦ç»ä¿¡æ¯ |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:query')") |
| | | // @GetMapping(value = "/{id}") |
| | | // public AjaxResult getInfo(@PathVariable("id") String id) |
| | | // { |
| | | // return success(electricityPriceDateService.selectCostPriceTacticsById(id)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * æ°å¢ææ¬çç¥ |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:add')") |
| | | // @Log(title = "ææ¬çç¥", businessType = BusinessType.INSERT) |
| | | // @PostMapping |
| | | // public AjaxResult add(@RequestBody ElectricityPriceDateVo electricityPriceDateVo) throws Exception { |
| | | // LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | // electricityPriceDateVo.setCreateBy(loginUser.getUsername()); |
| | | // return toAjax(electricityPriceDateService.insertCostPriceTactics(electricityPriceDateVo)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * ä¿®æ¹ææ¬çç¥ |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:edit')") |
| | | // @Log(title = "ææ¬çç¥", businessType = BusinessType.UPDATE) |
| | | // @PutMapping |
| | | // public AjaxResult edit(@RequestBody ElectricityPriceDateVo electricityPriceDateVo) |
| | | // { |
| | | // LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | // electricityPriceDateVo.setUpdateBy(loginUser.getUsername()); |
| | | // return toAjax(electricityPriceDateService.updateCostPriceTactics(electricityPriceDateVo)); |
| | | // } |
| | | // |
| | | // /** |
| | | // * å 餿æ¬çç¥ |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('costmanagement:tactics:remove')") |
| | | // @Log(title = "ææ¬çç¥", businessType = BusinessType.DELETE) |
| | | // @DeleteMapping("/{ids}") |
| | | // public AjaxResult remove(@PathVariable String[] ids) |
| | | // { |
| | | // return toAjax(electricityPriceDateService.deleteCostPriceTacticsByIds(ids)); |
| | | // } |
| | | //} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.costmanagement; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | import com.zhitan.common.utils.ServletUtils; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.zhitan.costmanagement.domain.vo.*; |
| | | import com.zhitan.costmanagement.service.DeviationAnalysisService; |
| | | import com.zhitan.costmanagement.service.ICostElectricityInputService; |
| | | import com.zhitan.framework.web.service.TokenService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãController |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/cost/statistics") |
| | | public class DeviationAnalysisController extends BaseController |
| | | { |
| | | @Resource |
| | | private ICostElectricityInputService costElectricityInputService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private DeviationAnalysisService deviationAnalysisService; |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥å表 |
| | | */ |
| | | |
| | | @GetMapping("/statistics") |
| | | public AjaxResult statistics(DeviationAnalysisDTO dto) throws ParseException { |
| | | Map<String,Object>result = new HashMap<>(); |
| | | StatisticsDataOutItem statisticsDataItem = deviationAnalysisService.getStatisticsDataItem(dto); |
| | | ElectricityDataOutItem electricityDataItem = deviationAnalysisService.getElectricityDataItem(dto); |
| | | result.put("CostElectricityData",electricityDataItem); |
| | | result.put("CostStatisticsData",statisticsDataItem); |
| | | |
| | | return AjaxResult.success(result); |
| | | } |
| | | @GetMapping("/test") |
| | | public AjaxResult test(DeviationAnalysisDTO dto) throws ParseException { |
| | | deviationAnalysisService.getStatisticsInfoList(dto); |
| | | return AjaxResult.success(deviationAnalysisService.getStatisticsInfoList2(dto)); |
| | | } |
| | | |
| | | @GetMapping("/getStatisticsInfoList") |
| | | public AjaxResult getStatisticsInfoList(DeviationAnalysisDTO dto) throws ParseException { |
| | | |
| | | return AjaxResult.success(deviationAnalysisService.getStatisticsInfoList(dto)); |
| | | } |
| | | |
| | | @GetMapping("/getStatisticsInfoEcharts") |
| | | public AjaxResult echarts(DeviationAnalysisDTO dto) throws ParseException { |
| | | Map<String,Object>result = new HashMap<>(); |
| | | |
| | | |
| | | result = deviationAnalysisService.getEcharst(dto); |
| | | |
| | | return AjaxResult.success(result); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.energydatastatistics; |
| | | |
| | | import com.zhitan.common.annotation.Anonymous; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.energydata.service.IEnergyDataStatisticService; |
| | | import com.zhitan.energydata.vo.FactoryEnergyConsumptionVo; |
| | | import com.zhitan.energydata.vo.PurchaseConsumptionVo; |
| | | import com.zhitan.home.domain.vo.HomePeakValleyVO; |
| | | import com.zhitan.home.service.impl.IHomePageService; |
| | | import com.zhitan.peakvalley.domain.dto.PeakValleyDTO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æé¦è½æºæ°æ®ç»¼ååæ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-30 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/energydatahomepage") |
| | | @Anonymous |
| | | public class EnergyDataStatisticsController extends BaseController |
| | | { |
| | | |
| | | @Autowired |
| | | public IHomePageService homepageService; |
| | | |
| | | @Autowired |
| | | private IEnergyDataStatisticService statisticService; |
| | | |
| | | /** |
| | | * @description: 彿¥è½èç»è®¡ |
| | | * @return |
| | | */ |
| | | @GetMapping("/energyConsumptionSummation/day") |
| | | public AjaxResult energyConsumptionSummationDay() { |
| | | try { |
| | | String timeType = "DAY"; |
| | | String modelCode = "COMPREHENSIVE_CODE"; |
| | | return AjaxResult.success(homepageService.energyConsumptionSummation(timeType,modelCode)); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * çµåç¯æ¯åæ |
| | | * @param timeType:monthãyear |
| | | * @return |
| | | */ |
| | | @GetMapping("/energyConsumptionSummation") |
| | | public AjaxResult energyConsumptionSummation(String timeType) { |
| | | try { |
| | | String modelCode = "COMPREHENSIVE_CODE"; |
| | | return AjaxResult.success(statisticService.energyConsumptionSummation(timeType,modelCode)); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description: åååºå½æè½èç»è®¡ |
| | | * @return |
| | | */ |
| | | @GetMapping("/factoryEnergyConsumption") |
| | | public AjaxResult factoryEnergyConsumption() { |
| | | try { |
| | | String timeType = "MONTH"; |
| | | String modelCode = "COMPREHENSIVE_CODE"; |
| | | FactoryEnergyConsumptionVo vo=statisticService.factoryEnergyConsumption(timeType,modelCode); |
| | | return AjaxResult.success(vo); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç¨çµè¶å¿åæ---æå¹´ï¼å¾åæ¨12个æï¼æ¯ä¸ªæç»è®¡ |
| | | * @return |
| | | */ |
| | | @GetMapping("/segmentAnalysis/year") |
| | | public AjaxResult segmentAnalysisMonth() { |
| | | PeakValleyDTO dto =new PeakValleyDTO(); |
| | | dto.setModelCode("COMPREHENSIVE_CODE"); |
| | | dto.setTimeType("YEAR"); |
| | | dto.setQueryTime(new Date()); |
| | | return AjaxResult.success(statisticService.segmentAnalysisMonth(dto)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç¨çµè¶å¿ç»è®¡---ææ |
| | | * @return |
| | | */ |
| | | @GetMapping("/segmentAnalysis/month") |
| | | public AjaxResult segmentAnalysisDay() { |
| | | PeakValleyDTO dto =new PeakValleyDTO(); |
| | | dto.setModelCode("COMPREHENSIVE_CODE"); |
| | | dto.setTimeType("MONTH"); |
| | | dto.setQueryTime(new Date()); |
| | | return AjaxResult.success(statisticService.segmentAnalysisDay(dto)); |
| | | } |
| | | |
| | | /** |
| | | * ç¨çµè¶å¿ç»è®¡---ææ¥ |
| | | * @return |
| | | */ |
| | | @GetMapping("/segmentAnalysis/day") |
| | | public AjaxResult segmentAnalysisHour() { |
| | | PeakValleyDTO dto =new PeakValleyDTO(); |
| | | dto.setModelCode("COMPREHENSIVE_CODE"); |
| | | dto.setTimeType("DAY"); |
| | | dto.setQueryTime(new Date()); |
| | | return AjaxResult.success(statisticService.segmentAnalysisHour(dto)); |
| | | } |
| | | |
| | | /** |
| | | * @description: è´å
¥åæ¶èå¯¹æ¯ |
| | | * @return |
| | | */ |
| | | @GetMapping("/purchaseConsumption") |
| | | public AjaxResult purchaseConsumption() { |
| | | String timeType="MONTH"; |
| | | String modelCode = "COMPREHENSIVE_CODE"; |
| | | List<PurchaseConsumptionVo> consumptionAnalysisVO = statisticService.purchaseConsumption(modelCode,timeType); |
| | | return AjaxResult.success(consumptionAnalysisVO); |
| | | } |
| | | |
| | | /** |
| | | * @description: ç§å®¤è½èæå |
| | | * @return |
| | | */ |
| | | @GetMapping("/energyConsumptionRanking") |
| | | public AjaxResult energyConsumptionRanking(String timeType) { |
| | | String modelCode = "COMPREHENSIVE_CODE"; |
| | | List<RankingEnergyData> consumptionAnalysisVO = statisticService.energyConsumptionRanking(modelCode,timeType); |
| | | return AjaxResult.success(consumptionAnalysisVO); |
| | | } |
| | | |
| | | /** |
| | | * @description: è½æºææ¬å æ¯ |
| | | * @return |
| | | */ |
| | | @GetMapping("/costProp") |
| | | public AjaxResult costProp(String timeType) { |
| | | String modelCode = "COMPREHENSIVE_CODE"; |
| | | List<PurchaseConsumptionVo> consumptionAnalysisVO = statisticService.costProp(modelCode, timeType); |
| | | return AjaxResult.success(consumptionAnalysisVO); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @description: å°å³°å¹³è°·å æ¯ |
| | | * @param timeType |
| | | */ |
| | | @GetMapping("/peakValley") |
| | | public AjaxResult peakValley(String timeType) { |
| | | try { |
| | | String modelcode = "COMPREHENSIVE_CODE"; |
| | | List<HomePeakValleyVO> vo = homepageService.peakValley(timeType,modelcode); |
| | | return AjaxResult.success(vo); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | | return AjaxResult.error("è·ååºé!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(GatewaySetting gatewaySetting,@RequestParam Long pageNum,@RequestParam Long pageSize) |
| | | { |
| | | // startPage(); |
| | | Page<GatewaySetting> list = gatewaySettingService.selectGatewaySettingPage(gatewaySetting,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | |
| | | /** |
| | | * @description: å
¨åè½èç»è®¡ |
| | | * @param timeType |
| | | * @return |
| | | * @return |
| | | * @author: hmj |
| | | * @date: 2024/10/8 13:41 |
| | | */ |
| | | @GetMapping("/energyConsumptionSummation") |
| | | public AjaxResult energyConsumptionSummation(String timeType) { |
| | | try { |
| | | String modelcode = "Composite_Indicators"; |
| | | // String modelcode = "Composite_Indicators"; |
| | | String modelcode = "COMPREHENSIVE_CODE"; |
| | | return AjaxResult.success(homepageService.energyConsumptionSummation(timeType,modelcode)); |
| | | } catch (Exception ex) { |
| | | logger.error("è·ååºéï¼", ex); |
| | |
| | | @GetMapping("/energyConsumptionTrend") |
| | | public AjaxResult energyConsumptionTrend(String timeType) { |
| | | try { |
| | | String modelcode = "Composite_Indicators"; |
| | | String modelcode = "COMPREHENSIVE_CODE"; |
| | | HomeEnergyConsumptionTrendVO vo = homepageService.energyConsumptionTrend(timeType,modelcode); |
| | | |
| | | return AjaxResult.success(vo); |
| | |
| | | @GetMapping("/energyConsumptionRanking") |
| | | public AjaxResult energyConsumptionRanking(String timeType) { |
| | | try { |
| | | String modelcode = "Composite_Indicators"; |
| | | String modelcode = "COMPREHENSIVE_CODE"; |
| | | List<RankingEnergyData> consumptionAnalysisVO = homepageService.energyConsumptionRanking(modelcode,timeType); |
| | | return AjaxResult.success(consumptionAnalysisVO); |
| | | } catch (Exception ex) { |
| | |
| | | public AjaxResult peakValley(String timeType) { |
| | | try { |
| | | // String modelcode = "Composite_Indicators"; |
| | | String modelcode = "PEAK_VALLEY"; |
| | | String modelcode = "COMPREHENSIVE_CODE"; |
| | | List<HomePeakValleyVO> vo = homepageService.peakValley(timeType,modelcode); |
| | | return AjaxResult.success(vo); |
| | | } catch (Exception ex) { |
| | |
| | | package com.zhitan.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | |
| | | import com.zhitan.framework.web.service.SysPasswordService; |
| | | import com.zhitan.system.domain.SysLoginInfo; |
| | | import com.zhitan.system.service.ISysLoginInfoService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®è®°å½ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysLoginInfo logininfor) |
| | | public TableDataInfo list(SysLoginInfo logininfor,Long pageNum, Long pageSize) |
| | | { |
| | | startPage(); |
| | | List<SysLoginInfo> list = logininforService.selectLogininforList(logininfor); |
| | | Page<SysLoginInfo> list = logininforService.selectLogininforPage(logininfor,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | package com.zhitan.web.controller.monitor; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.system.domain.SysOperLog; |
| | | import com.zhitan.system.service.ISysOperLogService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä½æ¥å¿è®°å½ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysOperLog operLog) |
| | | public TableDataInfo list(SysOperLog operLog, Long pageNum, Long pageSize) |
| | | { |
| | | startPage(); |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | Page<SysOperLog> list = operLogService.selectOperLogPage(operLog,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "è·åå°å³°å¹³è°·åæ¶ç»è®¡") |
| | | public AjaxResult segmentAnalysisDay(PeakValleyDTO dto) { |
| | | return AjaxResult.success(rulesService.segmentAnalysisDay(dto)); |
| | | // return AjaxResult.success(rulesService.segmentAnalysisDayCustomize(dto)); |
| | | } |
| | | |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.powerDistribution; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.services.IMeterImplementService; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.powerDistribution.domain.PowerDistribution; |
| | | import com.zhitan.powerDistribution.services.IPowerDistributionService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/powerDistribution") |
| | | public class PowerDistributionController extends BaseController { |
| | | |
| | | @Resource |
| | | private IPowerDistributionService powerDistributionService; |
| | | |
| | | @Resource |
| | | private IMeterImplementService meterImplementService; |
| | | |
| | | /** |
| | | * é
çµå®¤å表 |
| | | * |
| | | * @param powerDistribution |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult list(PowerDistribution powerDistribution) { |
| | | List<PowerDistribution> list = powerDistributionService.selectPowerDistributionList(powerDistribution); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * é
çµå®¤å表å页æ¥è¯¢ |
| | | * |
| | | * @param powerDistribution |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @GetMapping("/pageList") |
| | | public AjaxResult pageList(PowerDistribution powerDistribution, |
| | | @RequestParam(required = false, defaultValue = "1") int pageNo, |
| | | @RequestParam(required = false, defaultValue = "10") int pageSize) { |
| | | Page<PowerDistribution> page = new Page<>(pageNo, pageSize); |
| | | IPage<PowerDistribution> pageList = powerDistributionService.pageList(powerDistribution, page); |
| | | return AjaxResult.success(pageList); |
| | | } |
| | | |
| | | /** |
| | | * æ¥çé
çµå®¤è¯¦æ
|
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDetail") |
| | | public AjaxResult getDetail(@RequestParam("id") String id) { |
| | | PowerDistribution powerDistribution = powerDistributionService.getById(id); |
| | | return AjaxResult.success(powerDistribution); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢é
çµå®¤ |
| | | * |
| | | * @param powerDistribution |
| | | * @return |
| | | */ |
| | | @PostMapping("/add") |
| | | public AjaxResult addPowerDistribution(@RequestBody PowerDistribution powerDistribution) { |
| | | List<PowerDistribution> checkList = powerDistributionService.list(new QueryWrapper<PowerDistribution>().eq("code", powerDistribution.getCode())); |
| | | if (CollectionUtils.isNotEmpty(checkList)) { |
| | | return AjaxResult.error("é
çµå®¤ç¼ç ä¸è½éå¤ï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | return AjaxResult.success(powerDistributionService.save(powerDistribution)); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾é
çµå®¤ |
| | | * |
| | | * @param powerDistribution |
| | | * @return |
| | | */ |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@RequestBody PowerDistribution powerDistribution) { |
| | | List<PowerDistribution> checkList = powerDistributionService.list(new QueryWrapper<PowerDistribution>().ne("id", powerDistribution.getId()).eq("code", powerDistribution.getCode())); |
| | | if (CollectionUtils.isNotEmpty(checkList)) { |
| | | return AjaxResult.error("é
çµå®¤ç¼ç ä¸è½éå¤ï¼è¯·éæ°è¾å
¥"); |
| | | } |
| | | return AjaxResult.success(powerDistributionService.updateById(powerDistribution)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤é
çµå®¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/remove") |
| | | public AjaxResult remove(@RequestParam("ids") String[] ids) { |
| | | List<String> idList = new ArrayList<>(); |
| | | List<String> errorList = new ArrayList<>(); |
| | | for (String id : ids) { |
| | | List<MeterImplement> meterList = meterImplementService.listMeterImplByInstallLocation(id); |
| | | if (CollectionUtils.isEmpty(meterList)) { |
| | | idList.add(id); |
| | | } else { |
| | | errorList.add(id); |
| | | } |
| | | } |
| | | if (CollectionUtils.isNotEmpty(errorList)) { |
| | | return AjaxResult.error("æ¤é
çµå®¤å·²å¨è®¡éå¨å
·ä¸é
ç½®ï¼ä¸è½å é¤"); |
| | | } else { |
| | | return AjaxResult.success(powerDistributionService.deleteByIds(idList)); |
| | | } |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.singlelogin; |
| | | |
| | | import com.zhitan.common.annotation.Anonymous; |
| | | import com.zhitan.common.constant.Constants; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.framework.web.service.SysLoginService; |
| | | import com.zhitan.singlelogin.service.ISingleLoginService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * åç¹ç»å½æ¥å£å¯¹æ¥ |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | | public class SingleLoginController |
| | | { |
| | | @Resource |
| | | private ISingleLoginService singleLoginService; |
| | | |
| | | @Resource |
| | | private SysLoginService loginService; |
| | | /** |
| | | * ç»å½æ¹æ³ |
| | | * |
| | | * @param token ç»å½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | @Anonymous |
| | | @GetMapping("/singleLogin") |
| | | public AjaxResult singleLogin(@RequestParam String token) |
| | | { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | if(StringUtils.isEmpty(token)){ |
| | | return AjaxResult.error("tokenä¸è½ä¸ºç©º"); |
| | | } |
| | | SysUser user = singleLoginService.singleLogin(token); |
| | | if(null == user){ |
| | | return AjaxResult.error("ç»å½å¤±è´¥"); |
| | | } |
| | | // çæä»¤ç |
| | | String newtoken = loginService.loginNoCode(user.getUserName()); |
| | | ajax.put(Constants.TOKEN, newtoken); |
| | | return ajax; |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.web.controller.spikesandvalleys; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.alarm.domain.LimitType; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.core.page.TableDataInfo; |
| | | import com.zhitan.common.utils.ServletUtils; |
| | | import com.zhitan.framework.web.service.TokenService; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | import com.zhitan.spikesandvalleys.domain.vo.SpikesAndValleysSchemeVo; |
| | | import com.zhitan.spikesandvalleys.service.ISpikesAndValleysSchemeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import javax.annotation.Resource; |
| | | 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.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | | import com.zhitan.common.enums.BusinessType; |
| | | |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ¶é´æ®µæç»Controller |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/scheme") |
| | | public class SpikesAndValleysSchemeController extends BaseController |
| | | { |
| | | @Resource |
| | | private ISpikesAndValleysSchemeService spikesAndValleysSchemeService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç»å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:scheme:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SpikesAndValleysScheme spikesAndValleysScheme, Long pageNum, Long pageSize) |
| | | { |
| | | // startPage(); |
| | | |
| | | Page<SpikesAndValleysSchemeVo> page = spikesAndValleysSchemeService.selectSpikesAndValleysSchemeList(spikesAndValleysScheme, pageNum, pageSize); |
| | | |
| | | return getDataTable(page); |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 导åºå°å³°å¹³è°·æ¶é´æ®µæç»å表 |
| | | // */ |
| | | // @PreAuthorize("@ss.hasPermi('system:scheme:export')") |
| | | // @Log(title = "å°å³°å¹³è°·æ¶é´æ®µæç»", businessType = BusinessType.EXPORT) |
| | | // @PostMapping("/export") |
| | | // public void export(HttpServletResponse response, SpikesAndValleysScheme spikesAndValleysScheme) |
| | | // { |
| | | // List<SpikesAndValleysScheme> list = spikesAndValleysSchemeService.selectSpikesAndValleysSchemeList(spikesAndValleysScheme); |
| | | // ExcelUtil<SpikesAndValleysScheme> util = new ExcelUtil<SpikesAndValleysScheme>(SpikesAndValleysScheme.class); |
| | | // util.exportExcel(response, list, "å°å³°å¹³è°·æ¶é´æ®µæç»æ°æ®"); |
| | | // } |
| | | |
| | | /** |
| | | * è·åå°å³°å¹³è°·æ¶é´æ®µæç»è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:scheme:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | | { |
| | | return success(spikesAndValleysSchemeService.selectSpikesAndValleysSchemeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:scheme:add')") |
| | | @Log(title = "å°å³°å¹³è°·æ¶é´æ®µæç»", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody SpikesAndValleysSchemeVo spikesAndValleysScheme) |
| | | { |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | spikesAndValleysScheme.setCreateBy(loginUser.getUsername()); |
| | | return toAjax(spikesAndValleysSchemeService.insertSpikesAndValleysScheme(spikesAndValleysScheme)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:scheme:edit')") |
| | | @Log(title = "å°å³°å¹³è°·æ¶é´æ®µæç»", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody SpikesAndValleysSchemeVo spikesAndValleysScheme) |
| | | { |
| | | LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); |
| | | spikesAndValleysScheme.setUpdateBy(loginUser.getUsername()); |
| | | return toAjax(spikesAndValleysSchemeService.updateSpikesAndValleysScheme(spikesAndValleysScheme)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:scheme:remove')") |
| | | @Log(title = "å°å³°å¹³è°·æ¶é´æ®µæç»", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable String[] ids) |
| | | { |
| | | return toAjax(spikesAndValleysSchemeService.deleteSpikesAndValleysSchemeByIds(ids)); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.web.controller.system; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysDictData dictData) |
| | | public TableDataInfo list(SysDictData dictData,Long pageNum, Long pageSize) |
| | | { |
| | | startPage(); |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | Page<SysDictData> list = dictDataService.selectDictDataPage(dictData,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | package com.zhitan.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | |
| | | import com.zhitan.common.utils.poi.ExcelUtil; |
| | | import com.zhitan.system.domain.SysPost; |
| | | import com.zhitan.system.service.ISysPostService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯æä½å¤ç |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | public TableDataInfo list(SysPost post,Long pageNum,Long pageSize) |
| | | { |
| | | startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | Page<SysPost> list = postService.selectPostPage(post,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | |
| | | @Log(title = "å²ä½ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @PostMapping("/export") |
| | |
| | | package com.zhitan.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | |
| | | import com.zhitan.system.service.ISysDeptService; |
| | | import com.zhitan.system.service.ISysRoleService; |
| | | import com.zhitan.system.service.ISysUserService; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysRole role) |
| | | public TableDataInfo list(SysRole role, Long pageNum, Long pageSize) |
| | | { |
| | | startPage(); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | Page<SysRole> list = roleService.selectRolePage(role, pageNum, pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | return error("ä¿®æ¹è§è²'" + role.getRoleName() + "'失败ï¼è§è²æéå·²åå¨"); |
| | | } |
| | | role.setUpdateBy(getUsername()); |
| | | |
| | | |
| | | if (roleService.updateRole(role) > 0) |
| | | { |
| | | // æ´æ°ç¼åç¨æ·æé |
| | |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | | } |
| | |
| | | package com.zhitan.web.controller.system; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.annotation.Log; |
| | | import com.zhitan.common.core.controller.BaseController; |
| | | import com.zhitan.common.core.domain.AjaxResult; |
| | |
| | | import com.zhitan.system.service.ISysPostService; |
| | | import com.zhitan.system.service.ISysRoleService; |
| | | import com.zhitan.system.service.ISysUserService; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @RestController |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:user:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysUser user) |
| | | public TableDataInfo list(SysUser user, Long pageNum, Long pageSize) |
| | | { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | Page<SysUser> list = userService.selectUserPage(user,pageNum,pageSize); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | # é
ç½®ä¸ä¸ªè¿æ¥å¨æ± 䏿大çåçæ¶é´ï¼å使¯æ¯«ç§ |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # é
ç½®æ£æµè¿æ¥æ¯å¦ææ |
| | | validationQuery: SELECT 1 |
| | | validationQuery: SELECT 1 |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | |
| | | druid: |
| | | # ä¸»åºæ°æ®æº |
| | | master: |
| | | url: jdbc:postgresql://127.0.0.1:5432/energy |
| | | url: jdbc:postgresql://127.0.0.1:5432/energy_ml |
| | | username: root |
| | | password: 123456 |
| | | # ä»åºæ°æ®æº |
| | |
| | | package com.zhitan.common.core.domain.entity; |
| | | |
| | | import java.util.Set; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * è§è²è¡¨ sys_role |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @TableName("sys_role") |
| | |
| | | private String delFlag; |
| | | |
| | | /** ç¨æ·æ¯å¦å卿¤è§è²æ è¯ é»è®¤ä¸åå¨ */ |
| | | @TableField(exist = false) |
| | | private boolean flag = false; |
| | | |
| | | /** èåç» */ |
| | | @TableField(exist = false) |
| | | private Long[] menuIds; |
| | | |
| | | /** é¨é¨ç»ï¼æ°æ®æéï¼ */ |
| | | @TableField(exist = false) |
| | | private Long[] deptIds; |
| | | |
| | | /** è§è²èåæé */ |
| | | @TableField(exist = false) |
| | | private Set<String> permissions; |
| | | |
| | | public SysRole() |
| | |
| | | package com.zhitan.common.core.domain.entity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import javax.validation.constraints.*; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.annotation.Excels; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import com.zhitan.common.xss.Xss; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.Email; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·å¯¹è±¡ sys_user |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @TableName("sys_user") |
| | |
| | | @Excel(name = "é¨é¨åç§°", targetAttr = "deptName", type = Excel.Type.EXPORT), |
| | | @Excel(name = "é¨é¨è´è´£äºº", targetAttr = "leader", type = Excel.Type.EXPORT) |
| | | }) |
| | | @TableField(exist = false) |
| | | private SysDept dept; |
| | | |
| | | /** è§è²å¯¹è±¡ */ |
| | | @TableField(exist = false) |
| | | private List<SysRole> roles; |
| | | |
| | | /** è§è²ç» */ |
| | | @TableField(exist = false) |
| | | private Long[] roleIds; |
| | | |
| | | /** å²ä½ç» */ |
| | | @TableField(exist = false) |
| | | private Long[] postIds; |
| | | |
| | | /** è§è²ID */ |
| | | @TableField(exist = false) |
| | | private Long roleId; |
| | | |
| | | private String singleUser; |
| | | |
| | | public SysUser() |
| | | { |
| | |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | | public String getSingleUser() { |
| | | return singleUser; |
| | | } |
| | | |
| | | public void setSingleUser(String singleUser) { |
| | | this.singleUser = singleUser; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | SHARP("å°"), |
| | | PEAK("å³°"), |
| | | FLAT("å¹³"), |
| | | VALLEY("è°·"); |
| | | VALLEY("è°·"), |
| | | DEEP("深谷"); |
| | | |
| | | |
| | | private final String desc; |
| | | |
| | |
| | | ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); |
| | | return Date.from(zdt.toInstant()); |
| | | } |
| | | |
| | | /** |
| | | * è·åæå®æ¥æé¢æä»½ç天æ°ï¼å¹¶è½¬æ¢ææ°ç» |
| | | * @param date æ¥æ |
| | | * @return æ¥ææ°ç» |
| | | */ |
| | | public static String[] getDays(Date date) { |
| | | if (date == null) { |
| | | throw new IllegalArgumentException("æ¥æåæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | // å° Date 转æ¢ä¸º LocalDate |
| | | LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | int daysInMonth = localDate.lengthOfMonth(); |
| | | String[] strings = new String[daysInMonth]; |
| | | |
| | | for (int i = 1; i <= daysInMonth; i++) { |
| | | // 使ç¨String.formatç®åé¶å¡«å
|
| | | strings[i - 1] = String.format("%02d", i); |
| | | } |
| | | |
| | | return strings; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zhitan.framework.config; |
| | | |
| | | import com.sun.istack.internal.NotNull; |
| | | |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.utils.ReflectionUtils; |
| | | import com.zhitan.common.utils.SecurityUtils; |
| | |
| | | import org.apache.ibatis.plugin.*; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.lang.reflect.Field; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | import com.zhitan.framework.security.filter.JwtAuthenticationTokenFilter; |
| | | import com.zhitan.framework.security.handle.AuthenticationEntryPointImpl; |
| | | import com.zhitan.framework.security.handle.LogoutSuccessHandlerImpl; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.zhitan.framework.security.single.SingleAuthenticationProvider; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | |
| | | import org.springframework.security.web.authentication.logout.LogoutFilter; |
| | | import org.springframework.web.filter.CorsFilter; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * spring securityé
ç½® |
| | |
| | | */ |
| | | @Resource |
| | | private JwtAuthenticationTokenFilter authenticationTokenFilter; |
| | | |
| | | /** |
| | | * token认è¯è¿æ»¤å¨ |
| | | */ |
| | | @Resource |
| | | private SingleAuthenticationProvider singleAuthenticationProvider; |
| | | |
| | | /** |
| | | * è·¨åè¿æ»¤å¨ |
| | |
| | | @Override |
| | | protected void configure(AuthenticationManagerBuilder auth) throws Exception { |
| | | auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); |
| | | auth.authenticationProvider(singleAuthenticationProvider); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.framework.mqtt; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zhitan.framework.mqtt.domain.EletricData; |
| | | import com.zhitan.realtimedata.data.influxdb.InfluxDBRepository; |
| | | import com.zhitan.realtimedata.domain.TagValue; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; |
| | | import org.eclipse.paho.client.mqttv3.MqttCallback; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class MqttMessageCallback implements MqttCallback { |
| | | |
| | | private ExecutorService executorService = Executors.newFixedThreadPool(10); // å建ä¸ä¸ªçº¿ç¨æ± |
| | | |
| | | @Autowired |
| | | private InfluxDBRepository repository; |
| | |
| | | } |
| | | @Override |
| | | public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { |
| | | log.info("æ¥æ¶å°æ¶æ¯å
·ä½ä¿¡æ¯---->{}",new String(mqttMessage.getPayload())); |
| | | // final String msg = new String(mqttMessage.getPayload()); |
| | | // JSONObject jsonObject = JSON.parseObject(msg); |
| | | // final String values = jsonObject.getString("values"); |
| | | // final List<EletricData> eletricData = JSON.parseArray(values, EletricData.class); |
| | | // List<TagValue> tagValueList = new ArrayList<>(); |
| | | // //ç»åä¸å¡ ç¼åå
·ä½ä¿¡æ¯å³å¯ |
| | | // eletricData.forEach(ele->{ |
| | | // final String key = ele.getKey(); |
| | | // TagValue tagValue = new TagValue(); |
| | | // tagValue.setDataTime(new DateTime(ele.getTime())); |
| | | // tagValue.setValue(ele.getVaule()); |
| | | // tagValue.setTagCode(key.substring(key.lastIndexOf(".") + 1)); |
| | | // tagValueList.add(tagValue); |
| | | // }); |
| | | // repository.store(tagValueList); |
| | | |
| | | executorService.submit(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | final String msg = new String(mqttMessage.getPayload()); |
| | | JSONObject jsonObject = JSON.parseObject(msg); |
| | | final String values = jsonObject.getString("values"); |
| | | final List<EletricData> eletricData = JSON.parseArray(values, EletricData.class); |
| | | List<TagValue> tagValueList = new ArrayList<>(); |
| | | |
| | | //EMS.HB.High.9_42302035834_Voltagec |
| | | //9 æ¯é
çµç®±ï¼42302035834æ¯çµè¡¨å· |
| | | //ç»åä¸å¡ ç¼åå
·ä½ä¿¡æ¯å³å¯ |
| | | eletricData.forEach(ele->{ |
| | | final String key = ele.getKey(); |
| | | TagValue tagValue = new TagValue(); |
| | | tagValue.setDataTime(new DateTime(ele.getTime())); |
| | | tagValue.setValue(ele.getVaule()); |
| | | final String eNoIndex = key.substring(key.indexOf("_") + 1); |
| | | String tagValueString = formateTag(eNoIndex); |
| | | tagValue.setTagCode(tagValueString); |
| | | tagValueList.add(tagValue); |
| | | }); |
| | | repository.store(tagValueList); |
| | | } |
| | | }); |
| | | |
| | | // |
| | | } |
| | | |
| | | //å°çµè¡¨å·åææ 42302035834_Voltagec è½¬æ¢ææä»¬ç³»ç»ç |
| | | private String formateTag(String tag) { |
| | | final String[] tags = tag.split("_"); |
| | | String index = tags[1]; |
| | | String tagValue = tags[0] + "_"; |
| | | switch (index){ |
| | | case "PowFactorT": //åçå æ° |
| | | tagValue += "PowFactorT"; |
| | | break; |
| | | case "Imp": //æ£åçµè½ |
| | | tagValue += "ActiveZT"; |
| | | break; |
| | | // case "spare": // |
| | | // tagValue += ""; |
| | | // break; |
| | | // case "CurrentD": // |
| | | // tagValue += "CurrentD"; |
| | | // break; |
| | | // case "EXP": //ååçµè½ |
| | | // tagValue += ""; |
| | | // break; |
| | | // case "Total": //çµè½æ»å |
| | | // tagValue += ""; |
| | | // break; |
| | | default: |
| | | tagValue = tag; |
| | | } |
| | | return tagValue; |
| | | } |
| | | |
| | | @Override |
| | | public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.framework.security.single; |
| | | |
| | | import com.zhitan.framework.web.service.UserDetailsServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.AuthenticationProvider; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Collections; |
| | | |
| | | @Component |
| | | public class SingleAuthenticationProvider implements AuthenticationProvider { |
| | | @Autowired |
| | | private UserDetailsServiceImpl userDetailsService; |
| | | |
| | | /** |
| | | * 认è¯é»è¾ |
| | | */ |
| | | @Override |
| | | public Authentication authenticate(Authentication authentication) throws AuthenticationException { |
| | | SingleAuthenticationToken SingleAuthenticationToken = (SingleAuthenticationToken) authentication; |
| | | |
| | | String username = (String) SingleAuthenticationToken.getPrincipal(); |
| | | UserDetails user = userDetailsService.loadUserByUsername(username); |
| | | SingleAuthenticationToken result = new SingleAuthenticationToken(user, Collections.emptyList()); |
| | | /* |
| | | Details ä¸å
å«äº ipå°åã sessionId çç屿§ ä¹å¯ä»¥åå¨ä¸äºèªå·±æ³è¦æ¾è¿å»çå
容 |
| | | */ |
| | | result.setDetails(SingleAuthenticationToken.getDetails()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | *UserIdAuthenticationToken交ç»UserIdAuthenticationProviderå¤ç |
| | | * @param aClass |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean supports(Class<?> aClass) { |
| | | return SingleAuthenticationToken.class.isAssignableFrom(aClass); |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.framework.security.single; |
| | | |
| | | import org.springframework.security.authentication.AbstractAuthenticationToken; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | public class SingleAuthenticationToken extends AbstractAuthenticationToken { |
| | | |
| | | private final Object principal; |
| | | |
| | | public SingleAuthenticationToken(Object principal) { |
| | | super(null); |
| | | this.principal = principal; |
| | | this.setAuthenticated(false); |
| | | } |
| | | |
| | | public SingleAuthenticationToken(Object principal, Collection<? extends GrantedAuthority> authorities) { |
| | | super(authorities); |
| | | this.principal = principal; |
| | | super.setAuthenticated(true); |
| | | } |
| | | |
| | | @Override |
| | | public Object getCredentials() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Object getPrincipal() { |
| | | return this.principal; |
| | | } |
| | | |
| | | @Override |
| | | public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { |
| | | if (isAuthenticated) { |
| | | throw new IllegalArgumentException( |
| | | "Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); |
| | | } |
| | | |
| | | super.setAuthenticated(false); |
| | | } |
| | | |
| | | @Override |
| | | public void eraseCredentials() { |
| | | super.eraseCredentials(); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.framework.web.service; |
| | | |
| | | import java.util.Set; |
| | | |
| | | import com.zhitan.framework.security.context.PermissionContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | import com.zhitan.common.constant.Constants; |
| | | import com.zhitan.common.core.domain.entity.SysRole; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.utils.SecurityUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.framework.security.context.PermissionContextHolder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * é¦å èªå®ä¹æéå®ç°ï¼ssåèªSpringSecurityé¦åæ¯ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service("ss") |
| | |
| | | { |
| | | /** |
| | | * éªè¯ç¨æ·æ¯å¦å
·å¤ææé |
| | | * |
| | | * |
| | | * @param permission æéå符串 |
| | | * @return ç¨æ·æ¯å¦å
·å¤ææé |
| | | */ |
| | | public boolean hasPermi(String permission) |
| | | { |
| | | return true; |
| | | // if (StringUtils.isEmpty(permission)) |
| | | // { |
| | | // return false; |
| | | // } |
| | | // LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | // if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) |
| | | // { |
| | | // return false; |
| | | // } |
| | | // PermissionContextHolder.setContext(permission); |
| | | // return hasPermissions(loginUser.getPermissions(), permission); |
| | | if (StringUtils.isEmpty(permission)) |
| | | { |
| | | return false; |
| | | } |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) |
| | | { |
| | | return false; |
| | | } |
| | | PermissionContextHolder.setContext(permission); |
| | | return hasPermissions(loginUser.getPermissions(), permission); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * å¤æç¨æ·æ¯å¦æ¥ææä¸ªè§è² |
| | | * |
| | | * |
| | | * @param role è§è²å符串 |
| | | * @return ç¨æ·æ¯å¦å
·å¤æè§è² |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 夿æ¯å¦å
嫿é |
| | | * |
| | | * |
| | | * @param permissions æéå表 |
| | | * @param permission æéå符串 |
| | | * @return ç¨æ·æ¯å¦å
·å¤ææé |
| | |
| | | package com.zhitan.framework.web.service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.zhitan.framework.manager.AsyncManager; |
| | | import com.zhitan.framework.manager.factory.AsyncFactory; |
| | | import com.zhitan.framework.security.context.AuthenticationContextHolder; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.stereotype.Component; |
| | | import com.zhitan.common.constant.CacheConstants; |
| | | import com.zhitan.common.constant.Constants; |
| | | import com.zhitan.common.constant.UserConstants; |
| | |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.core.redis.RedisCache; |
| | | import com.zhitan.common.exception.ServiceException; |
| | | import com.zhitan.common.exception.user.BlackListException; |
| | | import com.zhitan.common.exception.user.CaptchaException; |
| | | import com.zhitan.common.exception.user.CaptchaExpireException; |
| | | import com.zhitan.common.exception.user.UserNotExistsException; |
| | | import com.zhitan.common.exception.user.UserPasswordNotMatchException; |
| | | import com.zhitan.common.exception.user.*; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.MessageUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.ip.IpUtils; |
| | | import com.zhitan.framework.manager.AsyncManager; |
| | | import com.zhitan.framework.manager.factory.AsyncFactory; |
| | | import com.zhitan.framework.security.context.AuthenticationContextHolder; |
| | | import com.zhitan.framework.security.single.SingleAuthenticationToken; |
| | | import com.zhitan.system.service.ISysConfigService; |
| | | import com.zhitan.system.service.ISysUserService; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * ç»å½æ ¡éªæ¹æ³ |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Component |
| | |
| | | |
| | | @Resource |
| | | private RedisCache redisCache; |
| | | |
| | | |
| | | @Resource |
| | | private ISysUserService userService; |
| | | |
| | |
| | | |
| | | /** |
| | | * ç»å½éªè¯ |
| | | * |
| | | * |
| | | * @param username ç¨æ·å |
| | | * @param password å¯ç |
| | | * @param code éªè¯ç |
| | |
| | | |
| | | /** |
| | | * æ ¡éªéªè¯ç |
| | | * |
| | | * |
| | | * @param username ç¨æ·å |
| | | * @param code éªè¯ç |
| | | * @param uuid å¯ä¸æ è¯ |
| | |
| | | sysUser.setLoginDate(DateUtils.getNowDate()); |
| | | userService.updateUserProfile(sysUser); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ç»å½éªè¯ |
| | | * @param username |
| | | * @return ç»æ |
| | | */ |
| | | public String loginNoCode(String username) |
| | | { |
| | | // ç¨æ·éªè¯ |
| | | Authentication authentication = null; |
| | | try |
| | | { |
| | | authentication = authenticationManager |
| | | .authenticate(new SingleAuthenticationToken(username)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | if (e instanceof BadCredentialsException) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLoginInfo(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | | else |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLoginInfo(username, Constants.LOGIN_FAIL, e.getMessage())); |
| | | throw new ServiceException(e.getMessage()); |
| | | } |
| | | } |
| | | AsyncManager.me().execute(AsyncFactory.recordLoginInfo(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | LoginUser loginUser = (LoginUser) authentication.getPrincipal(); |
| | | recordLoginInfo(loginUser.getUserId()); |
| | | // çætoken |
| | | return tokenService.createToken(loginUser); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.framework.web.service; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | import com.zhitan.common.core.domain.model.LoginUser; |
| | | import com.zhitan.common.enums.UserStatus; |
| | |
| | | import com.zhitan.common.utils.MessageUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.system.service.ISysUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | import org.springframework.security.core.userdetails.UserDetailsService; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * ç¨æ·éªè¯å¤ç |
| | |
| | | |
| | | @Resource |
| | | private ISysUserService userService; |
| | | |
| | | |
| | | @Resource |
| | | private SysPasswordService passwordService; |
| | | |
| | |
| | | throw new ServiceException(MessageUtils.message("user.blocked")); |
| | | } |
| | | |
| | | passwordService.validate(user); |
| | | // passwordService.validate(user); |
| | | |
| | | return createLoginUser(user); |
| | | } |
| | |
| | | <groupId>com.zhitan</groupId> |
| | | <artifactId>zhitan-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- hutoolå·¥å
·ç±» --> |
| | | <dependency> |
| | | <groupId>cn.hutool</groupId> |
| | | <artifactId>hutool-all</artifactId> |
| | | <version>5.2.4</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | | </project> |
| | |
| | | @Excel(name = "å
许æå¤§åç") |
| | | private String maxAllowablePower; |
| | | |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private String installLocationName; |
| | | |
| | | public String getInstallLocationName() { |
| | | return installLocationName; |
| | | } |
| | | |
| | | public void setInstallLocationName(String installLocationName) { |
| | | this.installLocationName = installLocationName; |
| | | } |
| | | |
| | | public String getGatewayId() { |
| | | return gatewayId; |
| | | } |
| | |
| | | List<MeterImplement> listMeterImplementByIds(@Param("meterIdList") List<String> meterIdList); |
| | | |
| | | MeterImplement selectByNodeIdIndexId(@Param("nodeId") String nodeId, @Param("indexId") String indexId); |
| | | |
| | | List<MeterImplement> listMeterImplByInstallLocation(@Param("installactionLocation") String installactionLocation); |
| | | } |
| | |
| | | List<MeterImplement> listMeterImplementByIds(List<String> meterIdList); |
| | | |
| | | Page<MeterImplement> selectMeterImplementPage(MeterImplement meterImplement, Long pageNum, Long pageSize); |
| | | |
| | | List<MeterImplement> listMeterImplByInstallLocation(String id); |
| | | } |
| | |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.mapper.DaqTemplateMapper; |
| | | import com.zhitan.model.mapper.EnergyIndexMapper; |
| | | import com.zhitan.powerDistribution.domain.PowerDistribution; |
| | | import com.zhitan.powerDistribution.mapper.PowerDistributionMapper; |
| | | import com.zhitan.system.mapper.SysDictDataMapper; |
| | | import com.zhitan.system.service.impl.SysUserServiceImpl; |
| | | import org.slf4j.Logger; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计éå¨å
·æ¡£æ¡ç»´æ¤Serviceä¸å¡å±å¤ç |
| | |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | |
| | | @Autowired |
| | | private PowerDistributionMapper distributionMapper; |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class); |
| | | @Autowired |
| | |
| | | |
| | | @Override |
| | | public Page<MeterImplement> selectMeterImplementPage(MeterImplement meterImplement, Long pageNum, Long pageSize) { |
| | | Page<MeterImplement> meterImplementPage =new Page<>(); |
| | | LambdaQueryWrapper<MeterImplement> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(meterImplement.getCode()),MeterImplement::getCode,meterImplement.getCode()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(meterImplement.getMeterName()),MeterImplement::getMeterName,meterImplement.getMeterName()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(meterImplement.getMeterType()),MeterImplement::getMeterType,meterImplement.getMeterType()); |
| | | queryWrapper.orderByDesc(MeterImplement::getCreateTime); |
| | | final Page<MeterImplement> meterImplementPage = meterImplementMapper.selectPage(new Page<>(pageNum, pageSize), queryWrapper); |
| | | |
| | | // é
çµå®¤è¡¨ï¼PowerDistribution |
| | | if (StringUtils.isNotBlank(meterImplement.getInstallactionLocation())){ |
| | | LambdaQueryWrapper<PowerDistribution> installLocationWrapper = new LambdaQueryWrapper<>(); |
| | | installLocationWrapper.like(StringUtils.isNotEmpty(meterImplement.getInstallactionLocation()),PowerDistribution::getName,meterImplement.getInstallactionLocation()); |
| | | List<PowerDistribution> installList=distributionMapper.selectList(installLocationWrapper); |
| | | |
| | | if (!installList.isEmpty()){ |
| | | queryWrapper.in(MeterImplement::getInstallactionLocation,installList.stream().map(PowerDistribution::getId).collect(Collectors.toList())); |
| | | }else{ |
| | | return meterImplementPage; |
| | | } |
| | | } |
| | | |
| | | meterImplementPage=meterImplementMapper.selectPage(new Page<>(pageNum, pageSize), queryWrapper); |
| | | |
| | | if (meterImplementPage.getTotal() > 0){ |
| | | meterImplementPage.getRecords().forEach(v->{ |
| | | PowerDistribution distribution=distributionMapper.selectById(v.getInstallactionLocation()); |
| | | if (null!=distribution && StringUtils.isNotEmpty(distribution.getName())) { |
| | | v.setInstallLocationName(distribution.getName()); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | return meterImplementPage; |
| | | } |
| | | |
| | | @Override |
| | | public List<MeterImplement> listMeterImplByInstallLocation(String installLocation) { |
| | | return meterImplementMapper.listMeterImplByInstallLocation(installLocation); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.benchmarkmanage.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * æ æå¼ç®¡ç对象 energy_benchmark_manage |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-12 |
| | | */ |
| | | @TableName("energy_benchmark_manage") |
| | | @Data |
| | | public class EnergyBenchmarkManage extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** uuidä¸»é® */ |
| | | private String id; |
| | | |
| | | /** æ æç¼ç */ |
| | | @Excel(name = "æ æç¼ç ") |
| | | private String code; |
| | | |
| | | /** æ æç±»å */ |
| | | @Excel(name = "æ æç±»å") |
| | | private String type; |
| | | |
| | | /** æ æç级 */ |
| | | @Excel(name = "æ æç级") |
| | | private String grade; |
| | | |
| | | /** æ æå¼ */ |
| | | @Excel(name = "æ æå¼") |
| | | private String value; |
| | | |
| | | /** 彿 ç¼å· */ |
| | | @Excel(name = "彿 ç¼å·") |
| | | private String nationalNum; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.benchmarkmanage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ æå¼ç®¡çMapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-12 |
| | | */ |
| | | public interface EnergyBenchmarkManageMapper extends BaseMapper<EnergyBenchmarkManage> { |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡ç |
| | | * |
| | | * @param id æ æå¼ç®¡çä¸»é® |
| | | * @return æ æå¼ç®¡ç |
| | | */ |
| | | public EnergyBenchmarkManage selectEnergyBenchmarkManageById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡çå表 |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return æ æå¼ç®¡çéå |
| | | */ |
| | | public List<EnergyBenchmarkManage> selectEnergyBenchmarkManageList(EnergyBenchmarkManage energyBenchmarkManage); |
| | | |
| | | /** |
| | | * æ°å¢æ æå¼ç®¡ç |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | public int insertEnergyBenchmarkManage(EnergyBenchmarkManage energyBenchmarkManage); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ æå¼ç®¡ç |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | public int updateEnergyBenchmarkManage(EnergyBenchmarkManage energyBenchmarkManage); |
| | | |
| | | /** |
| | | * å 餿 æå¼ç®¡ç |
| | | * |
| | | * @param id æ æå¼ç®¡çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteEnergyBenchmarkManageById(String id); |
| | | |
| | | /** |
| | | * æ¹éå 餿 æå¼ç®¡ç |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteEnergyBenchmarkManageByIds(String[] ids); |
| | | |
| | | List<EnergyBenchmarkManage> getList(EnergyBenchmarkManage queryParams); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.benchmarkmanage.service; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ æå¼ç®¡çServiceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-12 |
| | | */ |
| | | public interface IEnergyBenchmarkManageService extends IService<EnergyBenchmarkManage> { |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡ç |
| | | * |
| | | * @param id æ æå¼ç®¡çä¸»é® |
| | | * @return æ æå¼ç®¡ç |
| | | */ |
| | | public EnergyBenchmarkManage selectEnergyBenchmarkManageById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡çå表 |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return æ æå¼ç®¡çéå |
| | | */ |
| | | public List<EnergyBenchmarkManage> selectEnergyBenchmarkManageList(EnergyBenchmarkManage energyBenchmarkManage); |
| | | |
| | | /** |
| | | * æ°å¢æ æå¼ç®¡ç |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | public int insertEnergyBenchmarkManage(EnergyBenchmarkManage energyBenchmarkManage); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ æå¼ç®¡ç |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | public int updateEnergyBenchmarkManage(EnergyBenchmarkManage energyBenchmarkManage); |
| | | |
| | | /** |
| | | * æ¹éå 餿 æå¼ç®¡ç |
| | | * |
| | | * @param ids éè¦å é¤çæ æå¼ç®¡ç主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteEnergyBenchmarkManageByIds(String[] ids); |
| | | |
| | | /** |
| | | * å 餿 æå¼ç®¡çä¿¡æ¯ |
| | | * |
| | | * @param id æ æå¼ç®¡çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteEnergyBenchmarkManageById(String id); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢æ°æ® |
| | | * @param energyBenchmarkManage |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | Page<EnergyBenchmarkManage> selectBenchmarkManagePage(EnergyBenchmarkManage energyBenchmarkManage, Long pageNum, Long pageSize); |
| | | |
| | | List<EnergyBenchmarkManage> getList(EnergyBenchmarkManage queryParams); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.benchmarkmanage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage; |
| | | import com.zhitan.benchmarkmanage.mapper.EnergyBenchmarkManageMapper; |
| | | import com.zhitan.benchmarkmanage.service.IEnergyBenchmarkManageService; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ æå¼ç®¡çServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-12 |
| | | */ |
| | | @Service |
| | | public class EnergyBenchmarkManageServiceImpl extends ServiceImpl<EnergyBenchmarkManageMapper, EnergyBenchmarkManage> implements IEnergyBenchmarkManageService { |
| | | @Autowired |
| | | private EnergyBenchmarkManageMapper energyBenchmarkManageMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡ç |
| | | * |
| | | * @param id æ æå¼ç®¡çä¸»é® |
| | | * @return æ æå¼ç®¡ç |
| | | */ |
| | | @Override |
| | | public EnergyBenchmarkManage selectEnergyBenchmarkManageById(String id) { |
| | | return energyBenchmarkManageMapper.selectEnergyBenchmarkManageById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ æå¼ç®¡çå表 |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return æ æå¼ç®¡ç |
| | | */ |
| | | @Override |
| | | public List<EnergyBenchmarkManage> selectEnergyBenchmarkManageList(EnergyBenchmarkManage energyBenchmarkManage) { |
| | | return energyBenchmarkManageMapper.selectEnergyBenchmarkManageList(energyBenchmarkManage); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ æå¼ç®¡ç |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertEnergyBenchmarkManage(EnergyBenchmarkManage energyBenchmarkManage) { |
| | | energyBenchmarkManage.setCreateTime(DateUtils.getNowDate()); |
| | | return energyBenchmarkManageMapper.insertEnergyBenchmarkManage(energyBenchmarkManage); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ æå¼ç®¡ç |
| | | * |
| | | * @param energyBenchmarkManage æ æå¼ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateEnergyBenchmarkManage(EnergyBenchmarkManage energyBenchmarkManage) { |
| | | energyBenchmarkManage.setUpdateTime(DateUtils.getNowDate()); |
| | | return energyBenchmarkManageMapper.updateEnergyBenchmarkManage(energyBenchmarkManage); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿 æå¼ç®¡ç |
| | | * |
| | | * @param ids éè¦å é¤çæ æå¼ç®¡çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteEnergyBenchmarkManageByIds(String[] ids) { |
| | | return energyBenchmarkManageMapper.deleteEnergyBenchmarkManageByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å 餿 æå¼ç®¡çä¿¡æ¯ |
| | | * |
| | | * @param id æ æå¼ç®¡çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteEnergyBenchmarkManageById(String id) { |
| | | return energyBenchmarkManageMapper.deleteEnergyBenchmarkManageById(id); |
| | | } |
| | | |
| | | @Override |
| | | public Page<EnergyBenchmarkManage> selectBenchmarkManagePage(EnergyBenchmarkManage energyBenchmarkManage, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<EnergyBenchmarkManage> queryWrapper=new LambdaQueryWrapper<EnergyBenchmarkManage>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(energyBenchmarkManage.getCode()),EnergyBenchmarkManage::getCode,energyBenchmarkManage.getCode()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(energyBenchmarkManage.getType()),EnergyBenchmarkManage::getType,energyBenchmarkManage.getType()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(energyBenchmarkManage.getGrade()),EnergyBenchmarkManage::getGrade,energyBenchmarkManage.getGrade()); |
| | | queryWrapper.orderByDesc(EnergyBenchmarkManage::getCreateTime); |
| | | |
| | | return energyBenchmarkManageMapper.selectPage(new Page<EnergyBenchmarkManage>(pageNum, pageSize), queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<EnergyBenchmarkManage> getList(EnergyBenchmarkManage queryParams) { |
| | | return energyBenchmarkManageMapper.getList(queryParams); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.carbonemission.domain; |
| | | |
| | | import com.zhitan.common.enums.Quality; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * å¨ææ°æ®é¡¹. |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "dataItem对象-计ç®ç¢³ææ¾ç¨") |
| | | public class CarbonEmission implements Serializable { |
| | | private static final long serialVersionUID = -2777479013884125925L; |
| | | |
| | | @ApiModelProperty(value = "ææ id") |
| | | private String indexId; |
| | | @ApiModelProperty(value = "ææ åºid") |
| | | private String indexStorageId; |
| | | @ApiModelProperty(value = "ææ code") |
| | | private String indexCode; |
| | | @ApiModelProperty(value = "ææ åç§°") |
| | | private String indexName; |
| | | @ApiModelProperty(value = "å¼å§æ¶é´") |
| | | private Date beginTime; |
| | | @ApiModelProperty(value = "ç»ææ¶é´") |
| | | private Date endTime; |
| | | @ApiModelProperty(value = "æ¥æ") |
| | | private Date dataTime; |
| | | @ApiModelProperty(value = "æ¥æå符串") |
| | | private String dataTimeStr; |
| | | @ApiModelProperty(value = "æ¶é´ç±»åç¼ç ") |
| | | private String timeCode; |
| | | @ApiModelProperty(value = "æ¶é´ç±»å") |
| | | private TimeType timeType; |
| | | @ApiModelProperty(value = "å¼") |
| | | private Double value; |
| | | @ApiModelProperty(value = "è´¨é") |
| | | private Quality quality; |
| | | @ApiModelProperty(value = "") |
| | | private String unitId; |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | private Date createTime; |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private Date updateTime; |
| | | @ApiModelProperty(value = "夿³¨") |
| | | private String remark; |
| | | @ApiModelProperty(value = "è½æºç±»å") |
| | | private String energyId; |
| | | @ApiModelProperty(value = "èç¹åç§°") |
| | | private String nodeName; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.carbonemission.domain.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * ç¢³ææ¾æ ¸ç® |
| | | * |
| | | * @author lsk |
| | | * @date 2024-10-29 17:55 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class CarbonEmissionDTO { |
| | | @ApiModelProperty(value = "èç¹id") |
| | | private String nodeId; |
| | | @ApiModelProperty(value = "æ¶é´ç±»åï¼å¹´ãæãæ¥") |
| | | private String timeType; |
| | | @ApiModelProperty(value = "æ¥è¯¢æ¶é´") |
| | | private Date dataTime; |
| | | @ApiModelProperty(value = "ææ¾ç±»å") |
| | | private String emissionType; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.carbonemission.domain.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CarbonEmissionRankVO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "èç¹åç§°") |
| | | private String nodeName; |
| | | @ApiModelProperty(value = "å
¨é¨ç¢³ææ¾é") |
| | | private Double allValue; |
| | | @ApiModelProperty(value = "æ°´æ¶èé") |
| | | private Double water; |
| | | @ApiModelProperty(value = "çµæ¶èé") |
| | | private Double steam; |
| | | @ApiModelProperty(value = "ç¨çµé") |
| | | private Double electric; |
| | | @ApiModelProperty(value = "忝") |
| | | private String yoyEnery; |
| | | @ApiModelProperty(value = "ç±»ååç§°") |
| | | private String allEneryType; |
| | | @ApiModelProperty(value = "æ»ç¨é") |
| | | private Double totalEnery; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.carbonemission.domain.vo; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class carbonEmissionYQVO { |
| | | |
| | | @Excel(name = "æ¥æ") |
| | | private String xAxis; |
| | | @Excel(name = "ç¢³ææ¾é") |
| | | private String yAxis; |
| | | @Excel(name = "忝") |
| | | private String YOY; |
| | | @Excel(name = "ç¯æ¯") |
| | | private String QOQ; |
| | | |
| | | |
| | | public carbonEmissionYQVO() { |
| | | } |
| | | |
| | | public carbonEmissionYQVO(String xAxis, String yAxis, String YOY, String QOQ) { |
| | | this.xAxis = xAxis; |
| | | this.yAxis = yAxis; |
| | | this.YOY = YOY; |
| | | this.QOQ = QOQ; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.carbonemission.service; |
| | | |
| | | import com.zhitan.carbonemission.domain.dto.CarbonEmissionDTO; |
| | | import com.zhitan.carbonemission.domain.vo.carbonEmissionYQVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ç¢³ææ¾æ ¸ç® |
| | | * |
| | | * @author lsk |
| | | * @date 2024-10-29 |
| | | */ |
| | | public interface ICarbonEmissionService { |
| | | |
| | | /** |
| | | * 计ç®ç¢³ææ¾é - é¡¶é¨ä¸åºé¨ |
| | | * |
| | | * @param carbonEmissionDTO è¾å
¥åæ° |
| | | * @return ç¢³ææ¾é |
| | | */ |
| | | Map<String,Object> getUpCarbonEmission(CarbonEmissionDTO carbonEmissionDTO); |
| | | |
| | | |
| | | /** |
| | | * 计ç®ç¢³ææ¾é - ä¸é´å± |
| | | * |
| | | * @param carbonEmissionDTO è¾å
¥åæ° |
| | | * @return ç¢³ææ¾é |
| | | */ |
| | | List<carbonEmissionYQVO> getMiddleCarbonEmission(CarbonEmissionDTO carbonEmissionDTO); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.carbonemission.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.zhitan.basicdata.domain.SysEnergy; |
| | | import com.zhitan.basicdata.mapper.SysEnergyMapper; |
| | | import com.zhitan.carbonemission.domain.CarbonEmission; |
| | | import com.zhitan.carbonemission.domain.dto.CarbonEmissionDTO; |
| | | import com.zhitan.carbonemission.domain.vo.CarbonEmissionRankVO; |
| | | import com.zhitan.carbonemission.domain.vo.carbonEmissionYQVO; |
| | | import com.zhitan.carbonemission.service.ICarbonEmissionService; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.dataitem.mapper.DataItemMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * ãç¢³ææ¾æ ¸ç®ãServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author lsk |
| | | * @date 2024-10-29 |
| | | */ |
| | | @Service |
| | | public class CarbonEmissionServiceImpl implements ICarbonEmissionService { |
| | | |
| | | @Resource |
| | | private DataItemMapper dataItemMapper; |
| | | |
| | | @Resource |
| | | private SysEnergyMapper sysEnergyMapper; |
| | | |
| | | private final static String[] YEAR = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"}; |
| | | private final static String[] DAY = {"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"}; |
| | | |
| | | //è·å页é¢ä¸é¨åçç¢³ææ¾ |
| | | @Override |
| | | public Map<String, Object> getUpCarbonEmission(CarbonEmissionDTO carbonEmissionDTO) { |
| | | Map<String, Object> stringObjectMap = new HashMap<>(); |
| | | validate(carbonEmissionDTO, "N"); |
| | | |
| | | // è·åæ¥è¯¢æ¶é´çå¼å§åç»ææ¶é´ |
| | | Date queryTime = carbonEmissionDTO.getDataTime(); |
| | | Date beginTime; |
| | | Date endTime; |
| | | switch (carbonEmissionDTO.getTimeType()) { |
| | | case "DAY": |
| | | beginTime = DateUtil.beginOfDay(queryTime); |
| | | endTime = DateUtil.endOfDay(queryTime); |
| | | break; |
| | | case "MONTH": |
| | | beginTime = DateUtil.beginOfMonth(queryTime); |
| | | endTime = DateUtil.endOfMonth(queryTime); |
| | | break; |
| | | case "YEAR": |
| | | beginTime = DateUtil.beginOfYear(queryTime); |
| | | endTime = DateUtil.endOfYear(queryTime); |
| | | break; |
| | | default: |
| | | throw new RuntimeException("æ¶é´ç±»åé误"); |
| | | } |
| | | Date lastTime = DateUtil.offsetMonth(beginTime, -12); |
| | | Date lastEndTime = DateUtil.offsetMonth(endTime, -12); |
| | | // è·åå½å年份åä¸ä¸å¹´ä»½çç¢³ææ¾æ°æ® |
| | | List<CarbonEmission> upCarbonEmission = dataItemMapper.getUpCarbonEmission(beginTime, endTime, carbonEmissionDTO.getTimeType(), carbonEmissionDTO.getNodeId()); |
| | | |
| | | List<CarbonEmission> upLastCarbonEmission = dataItemMapper.getUpCarbonEmission(lastTime, lastEndTime, carbonEmissionDTO.getTimeType(), carbonEmissionDTO.getNodeId()); |
| | | List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(null); |
| | | if (ObjectUtil.isEmpty(sysEnergies)) { |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | // æå»ºè½æºæ å°åç¢³ææ¾æ°æ®æ å° |
| | | Map<String, SysEnergy> energyMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, Function.identity())); |
| | | final List<String> energyType = sysEnergies.stream().map(SysEnergy::getEnersno).collect(Collectors.toList()); |
| | | |
| | | double allValue = 0.0; |
| | | double allLastValue = 0.0; |
| | | |
| | | List<CarbonEmissionRankVO> upData = new ArrayList<>(); |
| | | |
| | | // è®¡ç®æ¯ç§è½æºçå½åå¼åå»å¹´çå¼ |
| | | for (String s : energyType) { |
| | | final double value = getValues(energyMap, upCarbonEmission,energyType); |
| | | final double lastYearValueNum = getValues(energyMap, upLastCarbonEmission,energyType); |
| | | allValue += value; |
| | | allLastValue += lastYearValueNum; |
| | | final CarbonEmissionRankVO carbonEmissionRankVO = new CarbonEmissionRankVO(); |
| | | carbonEmissionRankVO.setAllEneryType(energyMap.get(s).getEnername()); |
| | | carbonEmissionRankVO.setYoyEnery(String.format("%.2f", calculateYOY(value, lastYearValueNum))); |
| | | carbonEmissionRankVO.setTotalEnery(value); |
| | | upData.add(carbonEmissionRankVO); |
| | | } |
| | | CarbonEmissionRankVO carbonEmissionRankVOAll = new CarbonEmissionRankVO(); |
| | | carbonEmissionRankVOAll.setAllEneryType("æ»ç¢³ææ¾é"); |
| | | carbonEmissionRankVOAll.setYoyEnery(String.format("%.2f", calculateYOY(allValue, allLastValue))); |
| | | carbonEmissionRankVOAll.setTotalEnery(allValue); |
| | | upData.add(carbonEmissionRankVOAll); |
| | | |
| | | // 计ç®ä¸æ¹çç¢³ææ¾å¹¶æåº |
| | | List<CarbonEmissionRankVO> carbonEmissionRankVOS = calculateDownCarbonEmission(beginTime, endTime, carbonEmissionDTO, energyMap,sysEnergies); |
| | | carbonEmissionRankVOS.sort(Comparator.comparing(CarbonEmissionRankVO::getAllValue).reversed()); |
| | | stringObjectMap.put("down", carbonEmissionRankVOS); |
| | | stringObjectMap.put("upData", upData); |
| | | |
| | | return stringObjectMap; |
| | | } |
| | | |
| | | // 计ç®åæ¯å¢é¿ç |
| | | private double calculateYOY(double current, double last) { |
| | | if(last !=0.0) { |
| | | return (current - last) / last * 100; |
| | | } |
| | | return 0; |
| | | // return (current - last) / (last == 0.0 ? 1 : last) * 100; |
| | | } |
| | | |
| | | // 计ç®ä¸æ¹çç¢³ææ¾ |
| | | private List<CarbonEmissionRankVO> calculateDownCarbonEmission(Date beginTime, Date endTime, CarbonEmissionDTO carbonEmissionDTO, Map<String, SysEnergy> energyMap,List<SysEnergy> sysEnergies) { |
| | | List<CarbonEmission> downCarbonEmission = dataItemMapper.getDownCarbonEmission(beginTime, endTime, carbonEmissionDTO.getTimeType(), carbonEmissionDTO.getNodeId()); |
| | | List<CarbonEmissionRankVO> carbonEmissionRankVOS = new ArrayList<>(); |
| | | |
| | | final List<String> energyType = sysEnergies.stream().map(SysEnergy::getEnersno).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(downCarbonEmission)) { |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | Map<String, List<CarbonEmission>> nodeNameMap = downCarbonEmission.stream().collect(Collectors.groupingBy(CarbonEmission::getNodeName)); |
| | | |
| | | nodeNameMap.forEach((k, v) -> { |
| | | CarbonEmissionRankVO rankVO = new CarbonEmissionRankVO(); |
| | | rankVO.setNodeName(k); |
| | | double totalValues = 0.0; |
| | | |
| | | // è®¡ç®æ¯ç§è½æºçå¼ |
| | | for (String s : energyType) { |
| | | SysEnergy sysEnergy = energyMap.get(s); |
| | | if (sysEnergy == null || ObjectUtil.isEmpty(sysEnergy.getCoefficient())) { |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ä¸åå¨" + s + "è½æºç±»å"); |
| | | } |
| | | double value = v.stream().filter(ec -> ec.getEnergyId().equals(s)) |
| | | .mapToDouble(CarbonEmission::getValue) |
| | | .sum(); |
| | | double calculatedValue = Double.parseDouble(df.format(sysEnergy.getCoefficient().doubleValue() * value)); |
| | | |
| | | switch (s) { |
| | | case "water": |
| | | rankVO.setWater(calculatedValue); |
| | | break; |
| | | case "steam": |
| | | rankVO.setSteam(calculatedValue); |
| | | break; |
| | | case "electric": |
| | | rankVO.setElectric(calculatedValue); |
| | | break; |
| | | } |
| | | totalValues += calculatedValue; |
| | | } |
| | | rankVO.setAllValue(totalValues); |
| | | carbonEmissionRankVOS.add(rankVO); |
| | | }); |
| | | } |
| | | |
| | | return carbonEmissionRankVOS; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<carbonEmissionYQVO> getMiddleCarbonEmission(CarbonEmissionDTO carbonEmissionDTO) { |
| | | validate(carbonEmissionDTO, "Y"); |
| | | // è¯¥æ¹æ³ç¨äºè®¡ç®ç¢³ææ¾æ»å¼å¹¶è¿åç»æ |
| | | Map<String, Object> stringObjectMap = new HashMap<>(); |
| | | Date beginTime; |
| | | Date endTime; |
| | | final String timeType = carbonEmissionDTO.getTimeType(); |
| | | final Date dataTime = carbonEmissionDTO.getDataTime(); |
| | | String timeTypeStr; |
| | | String[] XAxis; |
| | | switch (timeType) { |
| | | case "DAY": |
| | | timeTypeStr = "HOUR"; |
| | | XAxis = DAY; |
| | | beginTime = DateUtil.beginOfDay(dataTime); |
| | | endTime = DateUtil.endOfDay(dataTime); |
| | | break; |
| | | case "MONTH": |
| | | timeTypeStr = "DAY"; |
| | | XAxis = DateUtils.getDays(dataTime); |
| | | beginTime = DateUtil.beginOfMonth(dataTime); |
| | | endTime = DateUtil.endOfMonth(dataTime); |
| | | break; |
| | | case "YEAR": |
| | | timeTypeStr = "MONTH"; |
| | | XAxis = YEAR; |
| | | beginTime = DateUtil.beginOfYear(dataTime); |
| | | endTime = DateUtil.endOfYear(dataTime); |
| | | break; |
| | | default: |
| | | throw new RuntimeException("æ¶é´ç±»åé误"); |
| | | } |
| | | Date lastTime = DateUtil.offsetMonth(beginTime, -12); |
| | | Date lastEndTime = DateUtil.offsetMonth(endTime, -12); |
| | | |
| | | List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(null); |
| | | if (ObjectUtil.isEmpty(sysEnergies)) { |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | // æå»ºè½æºæ å°åç¢³ææ¾æ°æ®æ å° |
| | | Map<String, SysEnergy> energyMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, Function.identity())); |
| | | final List<String> energyType = sysEnergies.stream().map(SysEnergy::getEnersno).collect(Collectors.toList()); |
| | | final List<CarbonEmission> middleCarbonEmission = dataItemMapper.getMiddleCarbonEmission(beginTime, endTime, timeTypeStr, carbonEmissionDTO.getNodeId(), carbonEmissionDTO.getEmissionType()); |
| | | final List<CarbonEmission> lastMiddleCarbonEmission = dataItemMapper.getMiddleCarbonEmission(lastTime, lastEndTime, timeTypeStr, carbonEmissionDTO.getNodeId(), carbonEmissionDTO.getEmissionType()); |
| | | final Map<String, List<CarbonEmission>> collect = middleCarbonEmission.stream().collect(Collectors.groupingBy(CarbonEmission::getDataTimeStr)); |
| | | final Map<String, List<CarbonEmission>> lastCollect = lastMiddleCarbonEmission.stream().collect(Collectors.groupingBy(CarbonEmission::getDataTimeStr)); |
| | | List<carbonEmissionYQVO> carbonEmissionYQVOS = new ArrayList<>(); |
| | | for (int i = 0; i < XAxis.length; i++) { |
| | | // å½åæ¶é´æ®µçç¢³ææ¾æ°æ® |
| | | final List<CarbonEmission> carbonEmissions = collect.get(XAxis[i]); |
| | | // ä¸ä¸æ¶é´æ®µçç¢³ææ¾æ°æ® |
| | | final List<CarbonEmission> lastCarbonEmissions = lastCollect.get(XAxis[i]); |
| | | // æ»å¼ |
| | | double totalValue = getValues(energyMap, carbonEmissions,energyType); |
| | | // ä¸ä¸æ¶é´æ®µçæ»å¼ |
| | | double totalLastValue = getValues(energyMap, lastCarbonEmissions,energyType); |
| | | // å䏿¬¡çæ»å¼ |
| | | double totalFrontValue = (i == 0) ? 0.0 : getValues(energyMap, collect.get(XAxis[i - 1]),energyType); |
| | | final carbonEmissionYQVO carbonEmissionYQVO = new carbonEmissionYQVO(XAxis[i] , String.format("%.2f", totalValue) ,String.format("%.2f", calculateYOY(totalValue, totalLastValue)) , String.format("%.2f", calculateYOY(totalValue, totalFrontValue))); |
| | | carbonEmissionYQVOS.add(carbonEmissionYQVO); |
| | | } |
| | | return carbonEmissionYQVOS; |
| | | } |
| | | |
| | | // éªè¯ CarbonEmissionDTO 对象çå项屿§æ¯å¦ææ |
| | | public static void validate(CarbonEmissionDTO carbonEmissionDTO, String type) { |
| | | if (ObjectUtil.isNull(carbonEmissionDTO.getDataTime())) { |
| | | throw new RuntimeException("è¯·éæ©æ¶é´"); |
| | | } |
| | | if (StringUtils.isEmpty(carbonEmissionDTO.getTimeType())) { |
| | | throw new RuntimeException("è¯·éæ©æ¶é´ç±»å"); |
| | | } |
| | | if (ObjectUtil.isEmpty(carbonEmissionDTO.getNodeId())) { |
| | | throw new RuntimeException("è¯·éæ©èç¹"); |
| | | } |
| | | if ("Y".equals(type) && ObjectUtil.isEmpty(carbonEmissionDTO.getEmissionType())) { |
| | | throw new RuntimeException("è¯·éæ©ææ¾ç±»å"); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static double getValues(Map<String, SysEnergy> energyMap, List<CarbonEmission> carbonEmissions,List<String> energyType) { |
| | | if (CollectionUtils.isEmpty(carbonEmissions)) { |
| | | return 0.0; |
| | | } |
| | | |
| | | // åå§åæ»å¼ |
| | | double allValue = 0.0; |
| | | |
| | | // æè½æºIDåç» |
| | | final Map<String, List<CarbonEmission>> energyValueMap = carbonEmissions.stream() |
| | | .collect(Collectors.groupingBy(CarbonEmission::getEnergyId)); |
| | | // final List<String> energyType = sysEnergies.stream().map(SysEnergy::getEnersno).collect(Collectors.toList()); |
| | | // è®¡ç®æ¯ç§è½æºçå½åå¼ |
| | | for (String s : energyType) { |
| | | SysEnergy sysEnergy = energyMap.get(s); |
| | | |
| | | // ç¡®ä¿è½æºåå¨ä¸ç³»æ°ä¸ä¸ºç©º |
| | | if (sysEnergy == null || sysEnergy.getCoefficient() == null) { |
| | | throw new RuntimeException("è·åç¢³ææ¾è½¬æ¢çæ¶åºé: ç³»ç»è½æºæ°æ®ä¸ä¸åå¨æç³»æ°ä¸ºç©º" + s + "è½æºç±»å"); |
| | | } |
| | | |
| | | // è·å对åºè½æºçå¼ |
| | | double value = energyValueMap.getOrDefault(s, Collections.emptyList()).stream() |
| | | .mapToDouble(CarbonEmission::getValue) |
| | | .sum(); |
| | | |
| | | // ç´æ¥è®¡ç®æ»å¼ï¼é¿å
åä½çè½¬æ¢ |
| | | allValue += sysEnergy.getCoefficient().doubleValue() * value; |
| | | } |
| | | |
| | | // æ ¼å¼åæç»ç»æ |
| | | return Double.parseDouble(new DecimalFormat("#.00").format(allValue)); |
| | | } |
| | | |
| | | } |
| | |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | final Map<String, Object> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, BigDecimal> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, String> energyNameMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno,SysEnergy::getEnername)); |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | |
| | | final String indexId = dataItem.getIndexId(); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | if(coefficient == null){ |
| | | throw new RuntimeException("è½æºç±»å" + energyId + "没æé
ç½®ææ ç³»æ°ï¼æ æ³è®¡ç®"); |
| | | } |
| | |
| | | final String indexId = dataItem.getIndexId(); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | if(coefficient == null){ |
| | | throw new RuntimeException("è½æºç±»å" + energyId + "没æé
ç½®ææ ç³»æ°ï¼æ æ³è®¡ç®"); |
| | | } |
| | |
| | | indexDataItemMap.forEach((indexId,value)->{ |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | if(coefficient == null){ |
| | | throw new RuntimeException("è½æºç±»å" + energyId + "没æé
ç½®ææ ç³»æ°ï¼æ æ³è®¡ç®"); |
| | | } |
| | |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | final Map<String, Object> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, BigDecimal> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | | final String indexId = n.getIndexId(); |
| | |
| | | final String indexId = dataItem.getIndexId(); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | if(coefficient == null){ |
| | | throw new RuntimeException("è½æºç±»å" + energyId + "没æé
ç½®ææ ç³»æ°ï¼æ æ³è®¡ç®"); |
| | | } |
| | |
| | | indexDataItemMap.forEach((indexId,value)->{ |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | if(coefficient == null){ |
| | | throw new RuntimeException("è½æºç±»å" + energyId + "没æé
ç½®ææ ç³»æ°ï¼æ æ³è®¡ç®"); |
| | | } |
| | |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | //è½æºç¼å·åè½æºææ ç³»æ° |
| | | final Map<String, Object> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, BigDecimal> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | //indexåè½æº |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | |
| | | indexIdList.forEach(indexId->{ |
| | | final List<DataItem> dataItems = dataItemMap.get(indexId); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | |
| | | if(CollectionUtils.isNotEmpty(dataItems) ){ |
| | | BigDecimal sum = BigDecimal.valueOf(dataItems.stream() |
| | |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | final Map<String, Object> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, BigDecimal> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | | final String indexId = n.getIndexId(); |
| | |
| | | final String indexId = dataItem.getIndexId(); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | |
| | | final BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | final BigDecimal coefficient = energyCoefficientMap.get(energyId); |
| | | if(coefficient == null){ |
| | | throw new RuntimeException("è½æºç±»å" + energyId + "没æé
ç½®ææ ç³»æ°ï¼æ æ³è®¡ç®"); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ã对象 cost_electricity_Input |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Data |
| | | @TableName("cost_electricity_Input") |
| | | public class CostElectricityInput extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | private String id; |
| | | |
| | | /** æ¶é´ç±»ååå
¸å¼timeType */ |
| | | @Excel(name = "æ¶é´ç±»ååå
¸å¼timeType") |
| | | private String type; |
| | | |
| | | /** çµé */ |
| | | @Excel(name = "çµé") |
| | | private BigDecimal electricityNum; |
| | | |
| | | /** æ¥è¯¢æ¶é´ */ |
| | | @Excel(name = "æ¥è¯¢æ¶é´") |
| | | private String time; |
| | | |
| | | /** çµè´¹ */ |
| | | @Excel(name = "çµè´¹") |
| | | private BigDecimal electricityFee; |
| | | |
| | | /** åçå æ° */ |
| | | @Excel(name = "åçå æ°") |
| | | private BigDecimal powerFactor; |
| | | |
| | | /** å°æ¶æ®µç¨çµé */ |
| | | @Excel(name = "å°æ¶æ®µç¨çµé") |
| | | private BigDecimal sharpElectricity; |
| | | |
| | | /** å³°æ¶æ®µç¨çµé */ |
| | | @Excel(name = "å³°æ¶æ®µç¨çµé") |
| | | private BigDecimal peakElectricity; |
| | | |
| | | /** å¹³æ¶æ®µç¨çµé */ |
| | | @Excel(name = "å¹³æ¶æ®µç¨çµé") |
| | | private BigDecimal flatElectricity; |
| | | |
| | | /** è°·æ¶æ®µç¨çµé */ |
| | | @Excel(name = "è°·æ¶æ®µç¨çµé") |
| | | private BigDecimal valleyElectricity; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | /** |
| | | * åä»·å
³è对象 cost_price_relevancy |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-09 |
| | | */ |
| | | @TableName("cost_price_relevancy") |
| | | @Data |
| | | public class CostPriceRelevancy extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | private String id; |
| | | |
| | | /** ç¨è½åä½ */ |
| | | @Excel(name = "ç¨è½åä½") |
| | | private String nodeId; |
| | | |
| | | /** åä»·çç¥id */ |
| | | @Excel(name = "åä»·çç¥id") |
| | | private String tacticsId; |
| | | |
| | | /** è½æºåç§ */ |
| | | @Excel(name = "è½æºåç§") |
| | | private Integer energyType; |
| | | |
| | | /** æææå¼å§æ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "æææå¼å§æ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date effectiveBeginTime; |
| | | |
| | | /** æææç»ææ¥æ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "æææç»ææ¥æ", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date effectiveEndTime; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | /** |
| | | * ææ¬çç¥å¯¹è±¡ cost_price_tactics |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @TableName("cost_price_tactics") |
| | | @Data |
| | | public class CostPriceTactics extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | private String id; |
| | | |
| | | /** æ¯å¦é¶æ¢¯ä»·æ ¼0å¦1æ¯ */ |
| | | @Excel(name = "æ¯å¦é¶æ¢¯ä»·æ ¼0å¦1æ¯") |
| | | private String type; |
| | | |
| | | /** çç¥ç¼ç */ |
| | | @Excel(name = "çç¥ç¼ç ") |
| | | private String tacticsNumber; |
| | | |
| | | /** çç¥åç§° */ |
| | | @Excel(name = "çç¥åç§°") |
| | | private String tacticsName; |
| | | |
| | | /** è½æºåç§ */ |
| | | @Excel(name = "è½æºåç§") |
| | | private Integer energyType; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ã对象 cost_price_tactics_item |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @TableName("cost_price_tactics_item") |
| | | @Data |
| | | public class CostPriceTacticsItem extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | private String id; |
| | | |
| | | /** èå´ç±»ååå
¸å¼cost_range_type */ |
| | | @Excel(name = "èå´ç±»ååå
¸å¼cost_range_type") |
| | | private String rangeType; |
| | | |
| | | /** çç¥åç§° */ |
| | | @Excel(name = "çç¥åç§°") |
| | | private String tacticsNumber; |
| | | |
| | | /** å
³èçç¥id */ |
| | | @Excel(name = "å
³èçç¥id") |
| | | private String tacticsId; |
| | | |
| | | /** åå
¸å¼spikes_and_valleys */ |
| | | @Excel(name = "åå
¸å¼spikes_and_valleys") |
| | | private String electricityType; |
| | | |
| | | /** åºé´èå´æå°å¼ */ |
| | | @Excel(name = "åºé´èå´æå°å¼") |
| | | private String slotsMin; |
| | | |
| | | /** åºé´èå´æå¤§å¼ */ |
| | | @Excel(name = "åºé´è崿大å¼") |
| | | private String slotsMax; |
| | | |
| | | /** åä»· */ |
| | | @Excel(name = "åä»·") |
| | | private BigDecimal price; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import com.zhitan.costmanagement.domain.CostPriceRelevancy; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * åä»·å
³è对象 cost_price_relevancy |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-09 |
| | | */ |
| | | @Data |
| | | public class CostPriceRelevancyVo extends CostPriceRelevancy { |
| | | private BigDecimal price; |
| | | private String electricityType; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.costmanagement.domain.CostPriceTacticsItem; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysItem; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ææ¬çç¥å¯¹è±¡ vo |
| | | * |
| | | * |
| | | */ |
| | | @Data |
| | | public class CostPriceTacticsVo extends CostPriceTactics { |
| | | List<CostPriceTacticsItem> itemList; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.zhitan.common.enums.TimeType; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ°æ®å表å®ä½ç±» electricityDataItem |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-06-19 |
| | | */ |
| | | @Data |
| | | |
| | | public class DeviationAnalysisDTO { |
| | | |
| | | /** |
| | | * 模åç¼å· |
| | | */ |
| | | @ApiModelProperty(value = "模åç¼å·") |
| | | @NotBlank(message = "模åç¼å·ä¸è½ä¸ºç©º!") |
| | | private String modelCode; |
| | | |
| | | /** |
| | | * èç¹id |
| | | */ |
| | | @ApiModelProperty(value = "èç¹id") |
| | | @NotBlank(message = "èç¹idä¸è½ä¸ºç©º!") |
| | | private String nodeId; |
| | | |
| | | /** |
| | | * æ¶é´ç±»å |
| | | */ |
| | | @ApiModelProperty(value = "æ¶é´ç±»å") |
| | | @NotBlank(message = "æ¶é´ç±»åä¸è½ä¸ºç©º!") |
| | | private String timeType; |
| | | |
| | | |
| | | private String date; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * åå·®åæè¿å对象 |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Data |
| | | |
| | | public class ElectricityDataOut { |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * åå·®åæè¿å对象 |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Data |
| | | |
| | | public class ElectricityDataOutItem { |
| | | private BigDecimal electricityNum=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFee=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactor=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumLast=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeLast=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorLast=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumYoy=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeYoy=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorYoy=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumQoq=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeQoq=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorQoq=BigDecimal.ZERO; |
| | | |
| | | /** å°æ¶æ®µç¨çµé */ |
| | | private BigDecimal sharpElectricity=BigDecimal.ZERO; |
| | | |
| | | /** å³°æ¶æ®µç¨çµé */ |
| | | private BigDecimal peakElectricity=BigDecimal.ZERO; |
| | | |
| | | /** å¹³æ¶æ®µç¨çµé */ |
| | | private BigDecimal flatElectricity=BigDecimal.ZERO; |
| | | |
| | | /** è°·æ¶æ®µç¨çµé */ |
| | | private BigDecimal valleyElectricity=BigDecimal.ZERO; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import com.zhitan.peakvalley.domain.ElectricityPrice; |
| | | import com.zhitan.peakvalley.domain.ElectricityPriceDate; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·çµä»·æ¶é´æ®µå¯¹è±¡ electricity_price_date |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-10 |
| | | */ |
| | | @Data |
| | | public class ElectricityPriceDateVo extends ElectricityPriceDate { |
| | | List<ElectricityPrice>itemList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * åå·®åæè¿å对象 |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Data |
| | | |
| | | public class StatisticsData { |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import com.zhitan.common.annotation.Excel; |
| | | import lombok.Data; |
| | | import lombok.Value; |
| | | import org.springframework.boot.context.properties.bind.DefaultValue; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * åå·®åæè¿å对象 |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Data |
| | | public class StatisticsDataOutItem { |
| | | |
| | | private BigDecimal electricityNum=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFee=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactor=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumLast=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeLast=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorLast=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumYoy=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeYoy=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorYoy=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumQoq=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeQoq=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorQoq=BigDecimal.ZERO; |
| | | /** å°æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal sharpElectricity=BigDecimal.ZERO; |
| | | |
| | | /** å³°æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal peakElectricity=BigDecimal.ZERO; |
| | | |
| | | /** å¹³æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal flatElectricity=BigDecimal.ZERO; |
| | | |
| | | /** è°·æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal valleyElectricity=BigDecimal.ZERO; |
| | | |
| | | /** å°æ¶æ®µç¨çµéå·®å¼ */ |
| | | |
| | | private BigDecimal sharpElectricityDiff=BigDecimal.ZERO; |
| | | |
| | | /** å³°æ¶æ®µç¨çµéå·®å¼ */ |
| | | |
| | | private BigDecimal peakElectricityDiff=BigDecimal.ZERO; |
| | | |
| | | /** å¹³æ¶æ®µç¨çµéå·®å¼ */ |
| | | |
| | | private BigDecimal flatElectricityDiff=BigDecimal.ZERO; |
| | | |
| | | /** è°·æ¶æ®µç¨çµéå·®å¼ */ |
| | | |
| | | private BigDecimal valleyElectricityDiff=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityNumDiff=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal electricityFeeDiff=BigDecimal.ZERO; |
| | | |
| | | private BigDecimal powerFactorDiff=BigDecimal.ZERO; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.domain.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åå·®åæè¿å对象 |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Data |
| | | public class StatisticsInfoListOut { |
| | | |
| | | private String nodeId; |
| | | |
| | | private BigDecimal electricityNum; |
| | | |
| | | private BigDecimal electricityFee; |
| | | |
| | | |
| | | /** å°æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal sharpElectricity; |
| | | |
| | | /** å³°æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal peakElectricity; |
| | | |
| | | /** å¹³æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal flatElectricity; |
| | | |
| | | /** è°·æ¶æ®µç¨çµé */ |
| | | |
| | | private BigDecimal valleyElectricity; |
| | | |
| | | private BigDecimal electricityNumYoy; |
| | | |
| | | private BigDecimal electricityNumQoq; |
| | | |
| | | private BigDecimal electricityNumRadio; |
| | | |
| | | List<StatisticsInfoListOut>children; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãMapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface CostElectricityInputMapper extends BaseMapper<CostElectricityInput> { |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | public CostElectricityInput selectCostElectricityInputById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ãéå |
| | | */ |
| | | public List<CostElectricityInput> selectCostElectricityInputList(CostElectricityInput costElectricityInput); |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostElectricityInput(CostElectricityInput costElectricityInput); |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostElectricityInput(CostElectricityInput costElectricityInput); |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostElectricityInputById(String id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostElectricityInputByIds(String[] ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.costmanagement.domain.CostPriceRelevancy; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceRelevancyVo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * åä»·å
³èMapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-09 |
| | | */ |
| | | public interface CostPriceRelevancyMapper extends BaseMapper<CostPriceRelevancy> { |
| | | /** |
| | | * æ¥è¯¢åä»·å
³è |
| | | * |
| | | * @param id åä»·å
³èä¸»é® |
| | | * @return åä»·å
³è |
| | | */ |
| | | public CostPriceRelevancy selectCostPriceRelevancyById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢åä»·å
³èå表 |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return åä»·å
³èéå |
| | | */ |
| | | public List<CostPriceRelevancy> selectCostPriceRelevancyList(CostPriceRelevancy costPriceRelevancy); |
| | | |
| | | /** |
| | | * æ°å¢åä»·å
³è |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy); |
| | | |
| | | /** |
| | | * ä¿®æ¹åä»·å
³è |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy); |
| | | |
| | | /** |
| | | * å é¤åä»·å
³è |
| | | * |
| | | * @param id åä»·å
³èä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceRelevancyById(String id); |
| | | |
| | | /** |
| | | * æ¹éå é¤åä»·å
³è |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceRelevancyByIds(String[] ids); |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢èå´å
å¯ä¸çåä»·çç¥å
³èä¿¡æ¯ |
| | | * |
| | | |
| | | */ |
| | | public CostPriceRelevancyVo selectCostPriceRelevancyByNodeId(@Param("nodeId") String nodeId, |
| | | @Param("elType")String elType); |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.costmanagement.domain.CostPriceTacticsItem; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãMapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface CostPriceTacticsItemMapper extends BaseMapper<CostPriceTacticsItem> { |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | public CostPriceTacticsItem selectCostPriceTacticsItemById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ãéå |
| | | */ |
| | | public List<CostPriceTacticsItem> selectCostPriceTacticsItemList(CostPriceTacticsItem costPriceTacticsItem); |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostPriceTacticsItem(CostPriceTacticsItem costPriceTacticsItem); |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostPriceTacticsItem(CostPriceTacticsItem costPriceTacticsItem); |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsItemById(String id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsItemByIds(String[] ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceTacticsVo; |
| | | |
| | | /** |
| | | * ææ¬çç¥Mapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface CostPriceTacticsMapper extends BaseMapper<CostPriceTactics> { |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥ |
| | | * |
| | | * @param id ææ¬çç¥ä¸»é® |
| | | * @return ææ¬çç¥ |
| | | */ |
| | | public CostPriceTactics selectCostPriceTacticsById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥å表 |
| | | * |
| | | * @param costPriceTactics ææ¬çç¥ |
| | | * @return ææ¬çç¥éå |
| | | */ |
| | | public List<CostPriceTactics> selectCostPriceTacticsList(CostPriceTactics costPriceTactics); |
| | | |
| | | /** |
| | | * æ°å¢ææ¬çç¥ |
| | | * |
| | | * @param costPriceTactics ææ¬çç¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostPriceTactics(CostPriceTactics costPriceTactics); |
| | | |
| | | /** |
| | | * ä¿®æ¹ææ¬çç¥ |
| | | * |
| | | * @param costPriceTactics ææ¬çç¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostPriceTactics(CostPriceTactics costPriceTactics); |
| | | |
| | | /** |
| | | * å 餿æ¬çç¥ |
| | | * |
| | | * @param id ææ¬çç¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsById(String id); |
| | | |
| | | /** |
| | | * æ¹éå 餿æ¬çç¥ |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsByIds(String[] ids); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææåä»·çç¥å表 |
| | | * |
| | | |
| | | * @return ææ¬çç¥éå |
| | | */ |
| | | public List<CostPriceTacticsVo> selectCostPriceTacticsListAll(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service; |
| | | |
| | | import com.zhitan.costmanagement.domain.vo.DeviationAnalysisDTO; |
| | | import com.zhitan.costmanagement.domain.vo.ElectricityDataOutItem; |
| | | import com.zhitan.costmanagement.domain.vo.StatisticsDataOutItem; |
| | | import com.zhitan.costmanagement.domain.vo.StatisticsInfoListOut; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ææ¬çç¥Serviceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface DeviationAnalysisService { |
| | | StatisticsDataOutItem getStatisticsDataItem(DeviationAnalysisDTO dto) throws ParseException; |
| | | |
| | | ElectricityDataOutItem getElectricityDataItem(DeviationAnalysisDTO dto) throws ParseException; |
| | | |
| | | |
| | | StatisticsInfoListOut getStatisticsInfoList(DeviationAnalysisDTO dto)throws ParseException; |
| | | List<StatisticsInfoListOut> getStatisticsInfoNewList(DeviationAnalysisDTO dto)throws ParseException; |
| | | |
| | | StatisticsInfoListOut getStatisticsInfoList2(DeviationAnalysisDTO dto)throws ParseException; |
| | | |
| | | |
| | | |
| | | |
| | | Map<String,Object>getEcharst(DeviationAnalysisDTO dto)throws ParseException; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service; |
| | | |
| | | import java.util.List; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | /** |
| | | * ã请填ååè½åç§°ãServiceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface ICostElectricityInputService extends IService<CostElectricityInput> { |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | public CostElectricityInput selectCostElectricityInputById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ãéå |
| | | */ |
| | | public Page<CostElectricityInput> selectCostElectricityInputList(CostElectricityInput costElectricityInput,Long pageNum, Long pageSize); |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostElectricityInput(CostElectricityInput costElectricityInput) throws Exception; |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostElectricityInput(CostElectricityInput costElectricityInput) throws Exception; |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çã请填ååè½åç§°ã主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostElectricityInputByIds(String[] ids); |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ãä¿¡æ¯ |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostElectricityInputById(String id); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service; |
| | | |
| | | import java.util.List; |
| | | import com.zhitan.costmanagement.domain.CostPriceRelevancy; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | /** |
| | | * åä»·å
³èServiceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-09 |
| | | */ |
| | | public interface ICostPriceRelevancyService extends IService<CostPriceRelevancy> { |
| | | /** |
| | | * æ¥è¯¢åä»·å
³è |
| | | * |
| | | * @param id åä»·å
³èä¸»é® |
| | | * @return åä»·å
³è |
| | | */ |
| | | public CostPriceRelevancy selectCostPriceRelevancyById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢åä»·å
³èå表 |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return åä»·å
³èéå |
| | | */ |
| | | public Page<CostPriceRelevancy> selectCostPriceRelevancyList(CostPriceRelevancy costPriceRelevancy,Long pageNum, Long pageSize); |
| | | |
| | | /** |
| | | * æ°å¢åä»·å
³è |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy); |
| | | |
| | | /** |
| | | * ä¿®æ¹åä»·å
³è |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy); |
| | | |
| | | /** |
| | | * æ¹éå é¤åä»·å
³è |
| | | * |
| | | * @param ids éè¦å é¤çåä»·å
³è主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceRelevancyByIds(String[] ids); |
| | | |
| | | /** |
| | | * å é¤åä»·å
³èä¿¡æ¯ |
| | | * |
| | | * @param id åä»·å
³èä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceRelevancyById(String id); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service; |
| | | |
| | | import java.util.List; |
| | | import com.zhitan.costmanagement.domain.CostPriceTacticsItem; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãServiceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface ICostPriceTacticsItemService extends IService<CostPriceTacticsItem> { |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | public CostPriceTacticsItem selectCostPriceTacticsItemById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ãéå |
| | | */ |
| | | public List<CostPriceTacticsItem> selectCostPriceTacticsItemList(CostPriceTacticsItem costPriceTacticsItem); |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostPriceTacticsItem(CostPriceTacticsItem costPriceTacticsItem); |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostPriceTacticsItem(CostPriceTacticsItem costPriceTacticsItem); |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çã请填ååè½åç§°ã主é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsItemByIds(String[] ids); |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ãä¿¡æ¯ |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsItemById(String id); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service; |
| | | |
| | | import java.util.List; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceTacticsVo; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | /** |
| | | * ææ¬çç¥Serviceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | public interface ICostPriceTacticsService extends IService<CostPriceTactics> { |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥ |
| | | * |
| | | * @param id ææ¬çç¥ä¸»é® |
| | | * @return ææ¬çç¥ |
| | | */ |
| | | public CostPriceTactics selectCostPriceTacticsById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥å表 |
| | | * |
| | | * @param costPriceTactics ææ¬çç¥ |
| | | * @return ææ¬çç¥éå |
| | | */ |
| | | public Page<CostPriceTacticsVo> selectCostPriceTacticsList(CostPriceTactics costPriceTactics, Long pageNum, Long pageSize); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææåä»·çç¥å表 |
| | | * |
| | | |
| | | * @return ææ¬çç¥éå |
| | | */ |
| | | public List<CostPriceTacticsVo> selectCostPriceTacticsListAll(); |
| | | |
| | | /** |
| | | * æ°å¢ææ¬çç¥ |
| | | * |
| | | * @param costPriceTacticsVo ææ¬çç¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertCostPriceTactics(CostPriceTacticsVo costPriceTacticsVo) throws Exception; |
| | | |
| | | /** |
| | | * ä¿®æ¹ææ¬çç¥ |
| | | * |
| | | * @param costPriceTacticsVo ææ¬çç¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateCostPriceTactics(CostPriceTacticsVo costPriceTacticsVo); |
| | | |
| | | /** |
| | | * æ¹éå 餿æ¬çç¥ |
| | | * |
| | | * @param ids éè¦å é¤çææ¬çç¥ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsByIds(String[] ids); |
| | | |
| | | /** |
| | | * å 餿æ¬çç¥ä¿¡æ¯ |
| | | * |
| | | * @param id ææ¬çç¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteCostPriceTacticsById(String id); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysItem; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | import com.zhitan.spikesandvalleys.domain.vo.SpikesAndValleysSchemeVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.costmanagement.mapper.CostElectricityInputMapper; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.zhitan.costmanagement.service.ICostElectricityInputService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Service |
| | | public class CostElectricityInputServiceImpl extends ServiceImpl<CostElectricityInputMapper, CostElectricityInput> implements ICostElectricityInputService { |
| | | @Autowired |
| | | private CostElectricityInputMapper costElectricityInputMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | @Override |
| | | public CostElectricityInput selectCostElectricityInputById(String id) { |
| | | return costElectricityInputMapper.selectCostElectricityInputById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | @Override |
| | | public Page<CostElectricityInput> selectCostElectricityInputList(CostElectricityInput costElectricityInput,Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<CostElectricityInput> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(costElectricityInput.getTime()),CostElectricityInput::getTime,costElectricityInput.getTime()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(costElectricityInput.getType()),CostElectricityInput::getType,costElectricityInput.getType()); |
| | | queryWrapper.orderByDesc(CostElectricityInput::getCreateTime); |
| | | Page<CostElectricityInput> page = costElectricityInputMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | |
| | | |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int insertCostElectricityInput(CostElectricityInput costElectricityInput) throws Exception { |
| | | costElectricityInput.setCreateTime(DateUtils.getNowDate()); |
| | | costElectricityInput.setId(UUID.randomUUID().toString()); |
| | | |
| | | CostElectricityInput search = costElectricityInputMapper.selectOne(new QueryWrapper<CostElectricityInput>(). |
| | | eq("type",costElectricityInput.getType()).eq("time",costElectricityInput.getTime())); |
| | | if (search!=null){ |
| | | throw new Exception("该æ¶é´æ®µå·²ç»´æ¤çµéä¿¡æ¯ï¼"); |
| | | } |
| | | return costElectricityInputMapper.insertCostElectricityInput(costElectricityInput); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param costElectricityInput ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateCostElectricityInput(CostElectricityInput costElectricityInput) throws Exception { |
| | | costElectricityInput.setUpdateTime(DateUtils.getNowDate()); |
| | | CostElectricityInput search = costElectricityInputMapper.selectOne(new QueryWrapper<CostElectricityInput>(). |
| | | eq("type",costElectricityInput.getType()).eq("time",costElectricityInput.getTime())); |
| | | if (search!=null){ |
| | | throw new Exception("该æ¶é´æ®µå·²ç»´æ¤çµéä¿¡æ¯ï¼"); |
| | | } |
| | | return costElectricityInputMapper.updateCostElectricityInput(costElectricityInput); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteCostElectricityInputByIds(String[] ids) { |
| | | return costElectricityInputMapper.deleteCostElectricityInputByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ãä¿¡æ¯ |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteCostElectricityInputById(String id) { |
| | | return costElectricityInputMapper.deleteCostElectricityInputById(id); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; |
| | | import com.zhitan.costmanagement.domain.CostPriceRelevancy; |
| | | import com.zhitan.costmanagement.service.ICostPriceRelevancyService; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | /** |
| | | * åä»·å
³èServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-09 |
| | | */ |
| | | @Service |
| | | public class CostPriceRelevancyServiceImpl extends ServiceImpl<CostPriceRelevancyMapper, CostPriceRelevancy> implements ICostPriceRelevancyService { |
| | | @Autowired |
| | | private CostPriceRelevancyMapper costPriceRelevancyMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢åä»·å
³è |
| | | * |
| | | * @param id åä»·å
³èä¸»é® |
| | | * @return åä»·å
³è |
| | | */ |
| | | @Override |
| | | public CostPriceRelevancy selectCostPriceRelevancyById(String id) { |
| | | return costPriceRelevancyMapper.selectCostPriceRelevancyById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢åä»·å
³èå表 |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return åä»·å
³è |
| | | */ |
| | | @Override |
| | | public Page<CostPriceRelevancy> selectCostPriceRelevancyList(CostPriceRelevancy costPriceRelevancy,Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<CostPriceRelevancy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(costPriceRelevancy.getNodeId()),CostPriceRelevancy::getNodeId,costPriceRelevancy.getNodeId()); |
| | | if(costPriceRelevancy.getEnergyType()!=null){ |
| | | queryWrapper.eq(StringUtils.isNotEmpty(costPriceRelevancy.getEnergyType().toString()),CostPriceRelevancy::getEnergyType,costPriceRelevancy.getEnergyType()); |
| | | |
| | | } |
| | | queryWrapper.orderByDesc(CostPriceRelevancy::getCreateTime); |
| | | Page<CostPriceRelevancy> page = costPriceRelevancyMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åä»·å
³è |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy) { |
| | | costPriceRelevancy.setCreateTime(DateUtils.getNowDate()); |
| | | costPriceRelevancy.setId(UUID.randomUUID().toString()); |
| | | return costPriceRelevancyMapper.insertCostPriceRelevancy(costPriceRelevancy); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åä»·å
³è |
| | | * |
| | | * @param costPriceRelevancy åä»·å
³è |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateCostPriceRelevancy(CostPriceRelevancy costPriceRelevancy) { |
| | | costPriceRelevancy.setUpdateTime(DateUtils.getNowDate()); |
| | | return costPriceRelevancyMapper.updateCostPriceRelevancy(costPriceRelevancy); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤åä»·å
³è |
| | | * |
| | | * @param ids éè¦å é¤çåä»·å
³èä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteCostPriceRelevancyByIds(String[] ids) { |
| | | return costPriceRelevancyMapper.deleteCostPriceRelevancyByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åä»·å
³èä¿¡æ¯ |
| | | * |
| | | * @param id åä»·å
³èä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteCostPriceRelevancyById(String id) { |
| | | return costPriceRelevancyMapper.deleteCostPriceRelevancyById(id); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.util.List; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.costmanagement.mapper.CostPriceTacticsItemMapper; |
| | | import com.zhitan.costmanagement.domain.CostPriceTacticsItem; |
| | | import com.zhitan.costmanagement.service.ICostPriceTacticsItemService; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Service |
| | | public class CostPriceTacticsItemServiceImpl extends ServiceImpl<CostPriceTacticsItemMapper, CostPriceTacticsItem> implements ICostPriceTacticsItemService { |
| | | @Autowired |
| | | private CostPriceTacticsItemMapper costPriceTacticsItemMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | @Override |
| | | public CostPriceTacticsItem selectCostPriceTacticsItemById(String id) { |
| | | return costPriceTacticsItemMapper.selectCostPriceTacticsItemById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | @Override |
| | | public List<CostPriceTacticsItem> selectCostPriceTacticsItemList(CostPriceTacticsItem costPriceTacticsItem) { |
| | | return costPriceTacticsItemMapper.selectCostPriceTacticsItemList(costPriceTacticsItem); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertCostPriceTacticsItem(CostPriceTacticsItem costPriceTacticsItem) { |
| | | costPriceTacticsItem.setCreateTime(DateUtils.getNowDate()); |
| | | return costPriceTacticsItemMapper.insertCostPriceTacticsItem(costPriceTacticsItem); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param costPriceTacticsItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateCostPriceTacticsItem(CostPriceTacticsItem costPriceTacticsItem) { |
| | | costPriceTacticsItem.setUpdateTime(DateUtils.getNowDate()); |
| | | return costPriceTacticsItemMapper.updateCostPriceTacticsItem(costPriceTacticsItem); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteCostPriceTacticsItemByIds(String[] ids) { |
| | | return costPriceTacticsItemMapper.deleteCostPriceTacticsItemByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ãä¿¡æ¯ |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteCostPriceTacticsItemById(String id) { |
| | | return costPriceTacticsItemMapper.deleteCostPriceTacticsItemById(id); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.costmanagement.domain.CostPriceTacticsItem; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceTacticsVo; |
| | | import com.zhitan.costmanagement.mapper.CostPriceTacticsItemMapper; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysItem; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | import com.zhitan.spikesandvalleys.domain.vo.SpikesAndValleysSchemeVo; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.costmanagement.mapper.CostPriceTacticsMapper; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.costmanagement.service.ICostPriceTacticsService; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * ææ¬çç¥Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Service |
| | | public class CostPriceTacticsServiceImpl extends ServiceImpl<CostPriceTacticsMapper, CostPriceTactics> implements ICostPriceTacticsService { |
| | | @Autowired |
| | | private CostPriceTacticsMapper costPriceTacticsMapper; |
| | | @Autowired |
| | | private CostPriceTacticsItemMapper costPriceTacticsItemMapper; |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥ |
| | | * |
| | | * @param id ææ¬çç¥ä¸»é® |
| | | * @return ææ¬çç¥ |
| | | */ |
| | | @Override |
| | | public CostPriceTactics selectCostPriceTacticsById(String id) { |
| | | CostPriceTacticsVo result = new CostPriceTacticsVo(); |
| | | CostPriceTactics info = costPriceTacticsMapper.selectCostPriceTacticsById(id); |
| | | BeanUtil.copyProperties(info,result); |
| | | LambdaQueryWrapper<CostPriceTacticsItem> queryWrapperItem = new LambdaQueryWrapper<>(); |
| | | queryWrapperItem.eq(CostPriceTacticsItem::getTacticsId,id); |
| | | List<CostPriceTacticsItem> itemListOld = costPriceTacticsItemMapper.selectList(queryWrapperItem); |
| | | result.setItemList(itemListOld); |
| | | return result ; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¬çç¥å表 |
| | | * |
| | | * @param costPriceTactics ææ¬çç¥ |
| | | * @return ææ¬çç¥ |
| | | */ |
| | | @Override |
| | | public Page<CostPriceTacticsVo> selectCostPriceTacticsList(CostPriceTactics costPriceTactics, Long pageNum, Long pageSize) { |
| | | |
| | | LambdaQueryWrapper<CostPriceTactics> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(costPriceTactics.getTacticsName()),CostPriceTactics::getTacticsName,costPriceTactics.getTacticsName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(costPriceTactics.getTacticsNumber()),CostPriceTactics::getTacticsNumber,costPriceTactics.getTacticsNumber()); |
| | | |
| | | queryWrapper.eq(StringUtils.isNotEmpty(costPriceTactics.getType()),CostPriceTactics::getType,costPriceTactics.getType()); |
| | | queryWrapper.orderByDesc(CostPriceTactics::getCreateTime); |
| | | Page<CostPriceTactics> page = costPriceTacticsMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | IPage aa = page.convert(s->{ |
| | | CostPriceTacticsVo v = new CostPriceTacticsVo(); |
| | | BeanUtil.copyProperties(s, v); |
| | | LambdaQueryWrapper<CostPriceTacticsItem> queryWrapperItem = new LambdaQueryWrapper<>(); |
| | | queryWrapperItem.eq(CostPriceTacticsItem::getTacticsId,s.getId()); |
| | | List<CostPriceTacticsItem> itemListOld = costPriceTacticsItemMapper.selectList(queryWrapperItem); |
| | | v.setItemList(itemListOld); |
| | | return v; |
| | | }); |
| | | |
| | | return (Page<CostPriceTacticsVo>) aa; |
| | | } |
| | | |
| | | @Override |
| | | public List<CostPriceTacticsVo> selectCostPriceTacticsListAll() { |
| | | return costPriceTacticsMapper.selectCostPriceTacticsListAll(); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ææ¬çç¥ |
| | | * |
| | | * @param costPriceTacticsVo ææ¬çç¥ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int insertCostPriceTactics(CostPriceTacticsVo costPriceTacticsVo) throws Exception { |
| | | |
| | | CostPriceTactics search = costPriceTacticsMapper.selectOne(new QueryWrapper<CostPriceTactics>().eq("tactics_number",costPriceTacticsVo.getTacticsNumber())); |
| | | if (search!=null){ |
| | | throw new Exception("该çç¥ç¼ç å·²åå¨ï¼"); |
| | | } |
| | | costPriceTacticsVo.setCreateTime(DateUtils.getNowDate()); |
| | | costPriceTacticsVo.setId(UUID.randomUUID().toString()); |
| | | CostPriceTactics costPriceTactics = new CostPriceTactics(); |
| | | BeanUtil.copyProperties(costPriceTacticsVo,costPriceTactics); |
| | | int result = costPriceTacticsMapper.insert(costPriceTactics); |
| | | //æå
¥å表 |
| | | List<CostPriceTacticsItem> itemList = costPriceTacticsVo.getItemList(); |
| | | itemList.stream().forEach(s->{ |
| | | s.setId(UUID.randomUUID().toString()); |
| | | s.setCreateTime(DateUtils.getNowDate()); |
| | | s.setCreateBy(costPriceTacticsVo.getCreateBy()); |
| | | s.setTacticsId(costPriceTacticsVo.getId()); |
| | | costPriceTacticsItemMapper.insert(s); |
| | | }); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ææ¬çç¥ |
| | | * |
| | | * @param costPriceTacticsVo ææ¬çç¥ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateCostPriceTactics(CostPriceTacticsVo costPriceTacticsVo) { |
| | | costPriceTacticsVo.setUpdateTime(DateUtils.getNowDate()); |
| | | CostPriceTactics costPriceTactics = new CostPriceTactics(); |
| | | BeanUtil.copyProperties(costPriceTacticsVo,costPriceTactics); |
| | | int result = costPriceTacticsMapper.updateCostPriceTactics(costPriceTactics); |
| | | //å é¤å表 |
| | | LambdaQueryWrapper<CostPriceTacticsItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CostPriceTacticsItem::getTacticsId,costPriceTactics.getId()); |
| | | List<CostPriceTacticsItem> itemListOld = costPriceTacticsItemMapper.selectList(queryWrapper); |
| | | List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | String[] ids = idList.toArray(new String[idList.size()]); |
| | | costPriceTacticsItemMapper.deleteCostPriceTacticsItemByIds(ids); |
| | | //æå
¥å表 |
| | | List<CostPriceTacticsItem> itemList = costPriceTacticsVo.getItemList(); |
| | | itemList.stream().forEach(s->{ |
| | | s.setId(UUID.randomUUID().toString()); |
| | | s.setCreateTime(DateUtils.getNowDate()); |
| | | s.setCreateBy(costPriceTacticsVo.getCreateBy()); |
| | | s.setTacticsId(costPriceTacticsVo.getId()); |
| | | costPriceTacticsItemMapper.insert(s); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå 餿æ¬çç¥ |
| | | * |
| | | * @param ids éè¦å é¤çææ¬çç¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteCostPriceTacticsByIds(String[] ids) { |
| | | //å é¤å表 |
| | | List<String> list = Arrays.asList(ids); |
| | | list.stream().forEach(item->{ |
| | | LambdaQueryWrapper<CostPriceTacticsItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CostPriceTacticsItem::getTacticsId,item); |
| | | List<CostPriceTacticsItem> itemListOld = costPriceTacticsItemMapper.selectList(queryWrapper); |
| | | List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | String[] itemIds = idList.toArray(new String[idList.size()]); |
| | | costPriceTacticsItemMapper.deleteCostPriceTacticsItemByIds(itemIds); |
| | | }); |
| | | |
| | | return costPriceTacticsMapper.deleteCostPriceTacticsByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å 餿æ¬çç¥ä¿¡æ¯ |
| | | * |
| | | * @param id ææ¬çç¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteCostPriceTacticsById(String id) { |
| | | LambdaQueryWrapper<CostPriceTacticsItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(CostPriceTacticsItem::getTacticsId,id); |
| | | List<CostPriceTacticsItem> itemListOld = costPriceTacticsItemMapper.selectList(queryWrapper); |
| | | List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | String[] itemIds = idList.toArray(new String[idList.size()]); |
| | | costPriceTacticsItemMapper.deleteCostPriceTacticsItemByIds(itemIds); |
| | | return costPriceTacticsMapper.deleteCostPriceTacticsById(id); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.costmanagement.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zhitan.common.enums.ElectricityTypeEnum; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.zhitan.costmanagement.domain.vo.*; |
| | | import com.zhitan.costmanagement.mapper.CostElectricityInputMapper; |
| | | import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; |
| | | import com.zhitan.costmanagement.service.DeviationAnalysisService; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.mapper.ModelInfoMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.peakvalley.domain.ElectricityDataItem; |
| | | import com.zhitan.peakvalley.mapper.PeakValleyMapper; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | | import java.time.Year; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.zhitan.common.utils.DateUtils.YYYY; |
| | | import static com.zhitan.common.utils.DateUtils.YYYY_MM; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãServiceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-11-08 |
| | | */ |
| | | @Service |
| | | public class DeviationAnalysisServiceServiceImpl implements DeviationAnalysisService { |
| | | @Resource |
| | | private CostElectricityInputMapper costElectricityInputMapper; |
| | | @Resource |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Resource |
| | | private ModelInfoMapper modelInfoMapper; |
| | | @Resource |
| | | private PeakValleyMapper electricityDataItemMapper; |
| | | @Resource |
| | | CostPriceRelevancyMapper costPriceRelevancyMapper; |
| | | |
| | | |
| | | @Override |
| | | public ElectricityDataOutItem getElectricityDataItem(DeviationAnalysisDTO dto) throws ParseException { |
| | | ElectricityDataOutItem ed = new ElectricityDataOutItem(); |
| | | CostElectricityInput search = costElectricityInputMapper.selectOne(new QueryWrapper<CostElectricityInput>(). |
| | | eq("type",dto.getTimeType()).eq("time",dto.getDate())); |
| | | if(search!=null){ |
| | | ed.setElectricityFee(search.getElectricityFee()); |
| | | ed.setElectricityNum(search.getElectricityNum()); |
| | | ed.setPowerFactor(search.getPowerFactor()); |
| | | ed.setSharpElectricity(search.getSharpElectricity()); |
| | | ed.setPeakElectricity(search.getPeakElectricity()); |
| | | ed.setFlatElectricity(search.getFlatElectricity()); |
| | | ed.setValleyElectricity(search.getValleyElectricity()); |
| | | //妿ç»è®¡çæ¯å¹´ï¼å
è·åä¸ä¸å¹´ |
| | | |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM); |
| | | String lastDate = ""; |
| | | |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | CostElectricityInput searchMonth = costElectricityInputMapper.selectOne(new QueryWrapper<CostElectricityInput>(). |
| | | eq("type",dto.getTimeType()).eq("time",lastMonth)); |
| | | |
| | | ed.setElectricityFeeQoq(percentage(search.getElectricityFee(),searchMonth.getElectricityFee())); |
| | | ed.setElectricityNumQoq(percentage(search.getElectricityNum(),searchMonth.getElectricityNum())); |
| | | ed.setPowerFactorQoq(percentage(search.getPowerFactor(),searchMonth.getPowerFactor())); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | } |
| | | |
| | | CostElectricityInput searchLastYear = costElectricityInputMapper.selectOne(new QueryWrapper<CostElectricityInput>(). |
| | | eq("type",dto.getTimeType()).eq("time",lastDate)); |
| | | if(searchLastYear!=null){ |
| | | ed.setElectricityFeeYoy(percentage(search.getElectricityFee(),searchLastYear.getElectricityFee())); |
| | | ed.setElectricityNumYoy(percentage(search.getElectricityNum(),searchLastYear.getElectricityNum())); |
| | | ed.setPowerFactorYoy(percentage(search.getPowerFactor(),searchLastYear.getPowerFactor())); |
| | | }else{ |
| | | ed.setElectricityFeeYoy(new BigDecimal(100)); |
| | | ed.setElectricityNumYoy(new BigDecimal(100)); |
| | | ed.setPowerFactorYoy(new BigDecimal(100)); |
| | | } |
| | | |
| | | } |
| | | |
| | | return ed; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public StatisticsInfoListOut getStatisticsInfoList(DeviationAnalysisDTO dto) throws ParseException { |
| | | StatisticsInfoListOut out = new StatisticsInfoListOut(); |
| | | List<ModelNode>modelNodeList = modelNodeMapper.getModelNodeByModelCode(dto.getModelCode()); |
| | | |
| | | List<ModelNode>modelNodeList2 = modelNodeList.stream().filter(s->s.getParentId()==null).collect(Collectors.toList()); |
| | | List<ModelNode>modelNodeList3 = modelNodeList.stream().filter(s->s.getParentId()!=null).collect(Collectors.toList()); |
| | | String nodeId = modelNodeList2.get(0).getNodeId(); |
| | | |
| | | List<ModelNode>childList = modelNodeList3.stream().filter(t->nodeId.equals(t.getParentId())).collect(Collectors.toList()); |
| | | |
| | | List<String>nodes = childList.stream().map(s->s.getNodeId()).collect(Collectors.toList()); |
| | | if(nodes!=null&& nodes.size()>0){ |
| | | out = computeInfoList(dto,nodes,modelNodeList,nodeId); |
| | | }else{ |
| | | out.setNodeId(nodeId); |
| | | List<StatisticsInfoListOut> child = new ArrayList<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | | out.setElectricityNumRadio(new BigDecimal(100)); |
| | | |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM); |
| | | String lastDate = ""; |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | //妿ç»è®¡çæ¯æ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | |
| | | StatisticsDataOutItem lastMonthData = compute(dto.getTimeType(),lastMonth,nodeId,dataItemList); |
| | | out.setElectricityNumQoq(percentage(out.getElectricityNum(),lastMonthData.getElectricityNum())); |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | |
| | | } |
| | | StatisticsDataOutItem lastYearData = compute(dto.getTimeType(),lastDate,nodeId,dataItemList); |
| | | out.setElectricityNumYoy(percentage(out.getElectricityNum(),lastYearData.getElectricityNum())); |
| | | } |
| | | out.setChildren(child); |
| | | } |
| | | |
| | | |
| | | return out; |
| | | } |
| | | |
| | | @Override |
| | | public List<StatisticsInfoListOut> getStatisticsInfoNewList(DeviationAnalysisDTO dto) throws ParseException { |
| | | List<StatisticsInfoListOut>result=new ArrayList<>(); |
| | | List<ModelNode>modelNodeList = modelNodeMapper.getModelNodeByModelCode(dto.getModelCode()); |
| | | List<ModelNode>modelNodeList2 = modelNodeList.stream().filter(s->s.getParentId()==null).collect(Collectors.toList()); |
| | | BigDecimal totalNum = new BigDecimal(0); |
| | | String nodeIdP = modelNodeList2.get(0).getNodeId(); |
| | | |
| | | for(ModelNode modelNode:modelNodeList){ |
| | | StatisticsInfoListOut out = new StatisticsInfoListOut(); |
| | | String nodeId = modelNode.getNodeId(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | | if (nodeIdP.equals(nodeId)) { |
| | | totalNum = nowData.getElectricityNum(); |
| | | } |
| | | out.setElectricityNumRadio(nowData.getElectricityNum().divide(totalNum)); |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM); |
| | | String lastDate = ""; |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | //妿ç»è®¡çæ¯æ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | |
| | | StatisticsDataOutItem lastMonthData = compute(dto.getTimeType(),lastMonth,nodeId,dataItemList); |
| | | out.setElectricityNumQoq(percentage(out.getElectricityNum(),lastMonthData.getElectricityNum())); |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | |
| | | } |
| | | StatisticsDataOutItem lastYearData = compute(dto.getTimeType(),lastDate,nodeId,dataItemList); |
| | | out.setElectricityNumYoy(percentage(out.getElectricityNum(),lastYearData.getElectricityNum())); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getEcharst(DeviationAnalysisDTO dto) throws ParseException { |
| | | List<String>xData = new ArrayList<>(); |
| | | List<String>xData2 = new ArrayList<>(); |
| | | List<BigDecimal>yData = new ArrayList<>(); |
| | | Map<String, Object>result = new HashMap<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | |
| | | String dateStr = dto.getDate(); |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | |
| | | List<ElectricityDataItem> dataItemList = new ArrayList<>(); |
| | | |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | dateStr = "D"+dateStr.replace("-",""); |
| | | dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, TimeType.DAY.name()); |
| | | }else{ |
| | | dateStr = "M"+dateStr; |
| | | dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, TimeType.MONTH.name()); |
| | | } |
| | | String finalDateStr1 = dateStr; |
| | | List<ElectricityDataItem>dataNow = new ArrayList<>(); |
| | | |
| | | dataNow = dataItemList.stream().filter(s->s.getTimeCode().substring(0,7).equals(finalDateStr1)).collect(Collectors.toList()); |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | electricityDataMap = dataNow.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | // xData = dataNow.stream().map(s->DateUtil.formatDateTime(s.getDataTime())).collect(Collectors.toList()); |
| | | for(String date : electricityDataMap.keySet()){ |
| | | List<ElectricityDataItem> ylist = electricityDataMap.get(date); |
| | | BigDecimal allNum = BigDecimal.ZERO; |
| | | for(ElectricityDataItem i : ylist){ |
| | | allNum = allNum.add(i.getElectricity()); |
| | | } |
| | | yData.add(allNum); |
| | | String mapKey = DateUtil.formatDate(DateUtil.parseDate(date)); |
| | | xData2.add(mapKey); |
| | | } |
| | | |
| | | } |
| | | result.put("xData",xData2); |
| | | result.put("yData",yData); |
| | | |
| | | |
| | | |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public StatisticsDataOutItem getStatisticsDataItem(DeviationAnalysisDTO dto) throws ParseException { |
| | | ElectricityDataOutItem electricityDataOutItem = this.getElectricityDataItem(dto); |
| | | StatisticsDataOutItem result = new StatisticsDataOutItem(); |
| | | |
| | | // // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),dto.getNodeId(),dataItemList); |
| | | BeanUtil.copyProperties(nowData,result); |
| | | result.setPowerFactor(new BigDecimal(0.9).setScale(2, RoundingMode.HALF_UP)); |
| | | result.setPowerFactorQoq(new BigDecimal(0).setScale(2, RoundingMode.HALF_UP)); |
| | | result.setPowerFactorYoy(new BigDecimal(0.6).setScale(2, RoundingMode.HALF_UP)); |
| | | result.setPowerFactorDiff(result.getPowerFactor().subtract(electricityDataOutItem.getPowerFactor())); |
| | | result.setElectricityNumDiff(result.getElectricityNum().subtract(electricityDataOutItem.getElectricityNum())); |
| | | result.setElectricityFeeDiff(result.getElectricityFee().subtract(electricityDataOutItem.getElectricityFee())); |
| | | result.setSharpElectricityDiff(result.getSharpElectricity().subtract(electricityDataOutItem.getSharpElectricity())); |
| | | result.setPeakElectricityDiff(result.getPeakElectricity().subtract(electricityDataOutItem.getPeakElectricity())); |
| | | result.setFlatElectricityDiff(result.getFlatElectricity().subtract(electricityDataOutItem.getFlatElectricity())); |
| | | result.setValleyElectricityDiff(result.getValleyElectricity().subtract(electricityDataOutItem.getValleyElectricity())); |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM); |
| | | String lastDate = ""; |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | //妿ç»è®¡çæ¯æ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | |
| | | StatisticsDataOutItem lastMonthData = compute(dto.getTimeType(),lastMonth,dto.getNodeId(),dataItemList); |
| | | result.setElectricityFeeQoq(percentage(result.getElectricityFee(),lastMonthData.getElectricityFee())); |
| | | result.setElectricityNumQoq(percentage(result.getElectricityNum(),lastMonthData.getElectricityNum())); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | // result.setPowerFactorQoq(percentage(result.getPowerFactor(),lastMonthData.getPowerFactor())); |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | // result.setPowerFactorQoq(percentage(result.getPowerFactor(),lastYearData.getPowerFactor())); |
| | | } |
| | | StatisticsDataOutItem lastYearData = compute(dto.getTimeType(),lastDate,dto.getNodeId(),dataItemList); |
| | | result.setElectricityFeeYoy(percentage(result.getElectricityFee(),lastYearData.getElectricityFee())); |
| | | result.setElectricityNumYoy(percentage(result.getElectricityNum(),lastYearData.getElectricityNum())); |
| | | |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | //计ç®çµè´¹ãèçµé |
| | | private StatisticsDataOutItem compute(String timeType,String dateStr,String nodeId,List<ElectricityDataItem>dataItemList){ |
| | | StatisticsDataOutItem sd = new StatisticsDataOutItem(); |
| | | if(TimeType.MONTH.name().equals(timeType)){ |
| | | dateStr = "M"+dateStr.replace("-",""); |
| | | }else{ |
| | | dateStr = "Y"+dateStr; |
| | | } |
| | | |
| | | String finalDateStr = dateStr; |
| | | List<ElectricityDataItem>dataNow = new ArrayList<>(); |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | | BigDecimal peakFee = BigDecimal.ZERO; |
| | | BigDecimal peakPower = BigDecimal.ZERO; |
| | | BigDecimal flatFee = BigDecimal.ZERO; |
| | | BigDecimal flatPower = BigDecimal.ZERO; |
| | | BigDecimal valleyFee = BigDecimal.ZERO; |
| | | BigDecimal valleyPower = BigDecimal.ZERO; |
| | | BigDecimal DeepFee = BigDecimal.ZERO; |
| | | BigDecimal DeepPower = BigDecimal.ZERO; |
| | | |
| | | dataNow = dataItemList.stream().filter(s->s.getTimeCode().equals(finalDateStr)).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(dataNow)) { |
| | | for (ElectricityDataItem electricityDataItem : dataNow) { |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.VALLEY.name().equals(electricityType)){ |
| | | |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | }else if (ElectricityTypeEnum.DEEP.name().equals(electricityType)){ |
| | | |
| | | DeepPower = DeepPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId,ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId,ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId,ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId, ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | CostPriceRelevancyVo voD = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId, ElectricityTypeEnum.DEEP.name()); |
| | | if(voV!=null){ |
| | | DeepFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | BigDecimal allNum = sharpPower.add(peakPower).add(flatPower).add(valleyPower); |
| | | BigDecimal allFee = sharpFee.add(peakFee).add(flatFee).add(valleyFee); |
| | | sd.setSharpElectricity(sharpPower); |
| | | sd.setPeakElectricity(peakPower); |
| | | sd.setFlatElectricity(flatPower); |
| | | sd.setValleyElectricity(valleyPower); |
| | | sd.setElectricityFee(allFee); |
| | | sd.setElectricityNum(allNum); |
| | | |
| | | } |
| | | return sd; |
| | | } |
| | | /** |
| | | * åç¯æ¯è®¡ç® |
| | | * @param thisData |
| | | * @param lastData |
| | | * @return |
| | | */ |
| | | private BigDecimal percentage(BigDecimal thisData, BigDecimal lastData) { |
| | | BigDecimal rate = new BigDecimal(100); |
| | | if(lastData.compareTo(BigDecimal.ZERO)==1){ |
| | | BigDecimal differ = thisData.subtract(lastData); |
| | | rate = differ.multiply(new BigDecimal(100)).divide(lastData,BigDecimal.ROUND_CEILING).setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | } |
| | | |
| | | return rate; |
| | | } |
| | | |
| | | private StatisticsInfoListOut computeInfoList(DeviationAnalysisDTO dto,List<String>nodes,List<ModelNode>modelNodeList,String nodeId){ |
| | | StatisticsInfoListOut out = new StatisticsInfoListOut(); |
| | | List<StatisticsInfoListOut> child = new ArrayList<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | | out.setElectricityNumRadio(new BigDecimal(100)); |
| | | out.setNodeId(nodeId); |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM); |
| | | String lastDate = ""; |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | //妿ç»è®¡çæ¯æ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | |
| | | StatisticsDataOutItem lastMonthData = compute(dto.getTimeType(),lastMonth,nodeId,dataItemList); |
| | | out.setElectricityNumQoq(percentage(out.getElectricityNum(),lastMonthData.getElectricityNum())); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | |
| | | } |
| | | StatisticsDataOutItem lastYearData = compute(dto.getTimeType(),lastDate,nodeId,dataItemList); |
| | | out.setElectricityNumYoy(percentage(out.getElectricityNum(),lastYearData.getElectricityNum())); |
| | | if(nodes!=null&&nodes.size()>0){ |
| | | for(String node : nodes){ |
| | | |
| | | StatisticsInfoListOut out2 = new StatisticsInfoListOut(); |
| | | out2.setNodeId(node); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList2 = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), node); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList2)) { |
| | | Set<String> indexSet2 = nodeIndexInfoList2.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList2 = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet2, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData2 = compute(dto.getTimeType(),dto.getDate(),node,dataItemList2); |
| | | BeanUtil.copyProperties(nowData2,out2); |
| | | out2.setElectricityNumRadio(new BigDecimal(100)); |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | //妿ç»è®¡çæ¯æ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | |
| | | StatisticsDataOutItem lastMonthData = compute(dto.getTimeType(),lastMonth,node,dataItemList2); |
| | | |
| | | out2.setElectricityNumQoq(percentage(out2.getElectricityNum(),lastMonthData.getElectricityNum())); |
| | | |
| | | |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | |
| | | } |
| | | StatisticsDataOutItem lastYearData2 = compute(dto.getTimeType(),lastDate,dto.getNodeId(),dataItemList2); |
| | | out2.setElectricityNumYoy(percentage(out2.getElectricityNum(),lastYearData2.getElectricityNum())); |
| | | |
| | | } |
| | | child.add(out2); |
| | | // List<ModelNode>childList = modelNodeList.stream().filter(s->s.getParentId().equals(node)).collect(Collectors.toList()); |
| | | // List<String>node2s = childList.stream().map(s->s.getNodeId()).collect(Collectors.toList()); |
| | | // if(){ |
| | | // |
| | | // } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | out.setChildren(child); |
| | | return out; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public StatisticsInfoListOut getStatisticsInfoList2(DeviationAnalysisDTO dto) throws ParseException { |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | StatisticsInfoListOut out = new StatisticsInfoListOut(); |
| | | List<ModelNode>modelNodeList = modelNodeMapper.getModelNodeByModelCode(dto.getModelCode()); |
| | | |
| | | List<ModelNode>modelNodeList2 = modelNodeList.stream().filter(s->s.getParentId()==null).collect(Collectors.toList()); |
| | | List<ModelNode>modelNodeList3 = modelNodeList.stream().filter(s->s.getParentId()!=null).collect(Collectors.toList()); |
| | | String nodeId = modelNodeList2.get(0).getNodeId(); |
| | | |
| | | List<ModelNode>childList = modelNodeList3.stream().filter(t->nodeId.equals(t.getParentId())).collect(Collectors.toList()); |
| | | |
| | | List<String>nodes = childList.stream().map(s->s.getNodeId()).collect(Collectors.toList()); |
| | | if(nodes!=null&& nodes.size()>0){ |
| | | out = computeInfoList(dto,nodes,modelNodeList,nodeId); |
| | | }else{ |
| | | out.setNodeId(nodeId); |
| | | List<StatisticsInfoListOut> child = new ArrayList<>(); |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatisticsDeviationAnalysis(indexSet, dto.getTimeType()); |
| | | StatisticsDataOutItem nowData = compute(dto.getTimeType(),dto.getDate(),nodeId,dataItemList); |
| | | BeanUtil.copyProperties(nowData,out); |
| | | out.setElectricityNumRadio(new BigDecimal(100)); |
| | | |
| | | DateTimeFormatter df = DateTimeFormatter.ofPattern(YYYY_MM); |
| | | String lastDate = ""; |
| | | if(TimeType.MONTH.name().equals(dto.getTimeType())){ |
| | | //妿ç»è®¡çæ¯æ |
| | | YearMonth yearMonth = YearMonth.parse(dto.getDate(), df); |
| | | lastDate = yearMonth.minusYears(1).format(df); |
| | | //妿ç»è®¡çæ¯æ |
| | | String lastMonth = yearMonth.minusMonths(1).format(df); |
| | | |
| | | StatisticsDataOutItem lastMonthData = compute(dto.getTimeType(),lastMonth,nodeId,dataItemList); |
| | | out.setElectricityNumQoq(percentage(out.getElectricityNum(),lastMonthData.getElectricityNum())); |
| | | }else{ |
| | | df = DateTimeFormatter.ofPattern(YYYY); |
| | | Year year = Year.parse(dto.getDate(), df); |
| | | lastDate = year.minusYears(1).format(df); |
| | | |
| | | } |
| | | StatisticsDataOutItem lastYearData = compute(dto.getTimeType(),lastDate,nodeId,dataItemList); |
| | | out.setElectricityNumYoy(percentage(out.getElectricityNum(),lastYearData.getElectricityNum())); |
| | | } |
| | | out.setChildren(child); |
| | | } |
| | | |
| | | |
| | | return out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * éå½å»ºç«æ å½¢ç»æ ï¼ç®æ³ï¼ |
| | | * @param lists |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | // private List<StatisticsInfoListOut> createTree(List<StatisticsInfoListOut> lists, int pid) { |
| | | // List<StatisticsInfoListOut> tree = new ArrayList<>(); |
| | | // for (StatisticsInfoListOut catelog : lists) { |
| | | // if (catelog.get() == pid) { |
| | | // catelog.setChirldren(createTree(lists,catelog.getId())); |
| | | // tree.add(catelog); |
| | | // } |
| | | // } |
| | | // return tree; |
| | | // } |
| | | |
| | | } |
| | |
| | | package com.zhitan.dataitem.mapper; |
| | | |
| | | import com.zhitan.carbonemission.domain.CarbonEmission; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.dataitem.domain.StagseDataEntry; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | |
| | | */ |
| | | BigDecimal getDataItemValueByIndexIds(@Param("timeCode") String timeCode, @Param("indexIds") List<String> indexIds); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®indexId䏿¶é´èå´æ¥è¯¢ç¢³ææ¾æ°æ®ï¼ä¸åé¨å |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexId |
| | | * @return |
| | | */ |
| | | List<CarbonEmission> getUpCarbonEmission(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, @Param("indexId") String indexId); |
| | | |
| | | |
| | | /** |
| | | * æ ¹æ®indexId䏿¶é´èå´æ¥è¯¢ç¢³ææ¾æ°æ®ï¼ä¸é´é¨å |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexId |
| | | * @return |
| | | */ |
| | | List<CarbonEmission> getMiddleCarbonEmission(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, @Param("indexId") String indexId,@Param("emissionType") String emissionType); |
| | | |
| | | /** |
| | | * æ ¹æ®indexId䏿¶é´èå´æ¥è¯¢ç¢³ææ¾æ°æ®ï¼ä¸åé¨å |
| | | * @param beginTime |
| | | * @param endTime |
| | | * @param timeType |
| | | * @param indexId |
| | | * @return |
| | | */ |
| | | List<CarbonEmission> getDownCarbonEmission(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime, |
| | | @Param("timeType") String timeType, @Param("indexId") String indexId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.mapper; |
| | | |
| | | import com.zhitan.model.domain.CalcFunction; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface EnergyDataStatisticMapper |
| | | { |
| | | List<ModelNodeIndexInfor> getModelNodeIndexIdByFixedNodeIds(@Param("modelCode")String modelCode,@Param("fixedNodeIds") List<String> fixedNodeIds); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.service; |
| | | |
| | | |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.energydata.vo.EnergyChainYoyVO; |
| | | import com.zhitan.energydata.vo.FactoryEnergyConsumptionVo; |
| | | import com.zhitan.energydata.vo.PurchaseConsumptionVo; |
| | | import com.zhitan.peakvalley.domain.dto.PeakValleyDTO; |
| | | import com.zhitan.peakvalley.domain.vo.peakvalley.PeakValleyDayVO; |
| | | import com.zhitan.peakvalley.domain.vo.peakvalley.PeakValleyHourVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IEnergyDataStatisticService { |
| | | PeakValleyDayVO segmentAnalysisMonth(PeakValleyDTO dto); |
| | | |
| | | List<RankingEnergyData> energyConsumptionRanking(String modelCode, String timeType); |
| | | |
| | | FactoryEnergyConsumptionVo factoryEnergyConsumption(String timeType, String modelCode); |
| | | |
| | | List<PurchaseConsumptionVo> purchaseConsumption(String modelCode, String timeType ); |
| | | |
| | | List<PurchaseConsumptionVo> costProp(String modelCode, String timeType); |
| | | |
| | | List<EnergyChainYoyVO> energyConsumptionSummation(String timeType, String modelCode); |
| | | |
| | | PeakValleyDayVO segmentAnalysisDay(PeakValleyDTO dto); |
| | | |
| | | PeakValleyHourVO segmentAnalysisHour(PeakValleyDTO dto); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.domain.SysEnergy; |
| | | import com.zhitan.basicdata.mapper.MeterImplementMapper; |
| | | import com.zhitan.basicdata.mapper.SysEnergyMapper; |
| | | import com.zhitan.common.constant.CommonConst; |
| | | import com.zhitan.common.enums.ElectricityTypeEnum; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.bean.BeanUtils; |
| | | import com.zhitan.consumptionanalysis.domain.vo.RankingEnergyData; |
| | | import com.zhitan.costmanagement.domain.CostElectricityInput; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceRelevancyVo; |
| | | import com.zhitan.costmanagement.mapper.CostElectricityInputMapper; |
| | | import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; |
| | | import com.zhitan.dataitem.service.IDataItemService; |
| | | import com.zhitan.energydata.mapper.EnergyDataStatisticMapper; |
| | | import com.zhitan.energydata.service.IEnergyDataStatisticService; |
| | | import com.zhitan.energydata.vo.EnergyChainYoyVO; |
| | | import com.zhitan.energydata.vo.FactoryEnergyConsumptionItemVo; |
| | | import com.zhitan.energydata.vo.FactoryEnergyConsumptionVo; |
| | | import com.zhitan.energydata.vo.PurchaseConsumptionVo; |
| | | import com.zhitan.home.domain.vo.HomeEnergyStatisticsVO; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelNode; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.mapper.EnergyIndexMapper; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | | import com.zhitan.model.service.IModelNodeService; |
| | | import com.zhitan.peakvalley.domain.ElectricityDataItem; |
| | | import com.zhitan.peakvalley.domain.dto.PeakValleyDTO; |
| | | import com.zhitan.peakvalley.domain.vo.peakvalley.*; |
| | | import com.zhitan.peakvalley.mapper.PeakValleyMapper; |
| | | import com.zhitan.realtimedata.domain.DataItem; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æé¦ç»¼åæ²»ç大屿¥å£å®ç°ç±» |
| | | */ |
| | | @Service |
| | | public class EnergyDataStatisticServiceImpl implements IEnergyDataStatisticService { |
| | | |
| | | @Autowired |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Autowired |
| | | private PeakValleyMapper electricityDataItemMapper; |
| | | @Autowired |
| | | CostPriceRelevancyMapper costPriceRelevancyMapper; |
| | | |
| | | @Autowired |
| | | CostElectricityInputMapper electricityInputMapper; |
| | | @Autowired |
| | | private IDataItemService dataItemService; |
| | | |
| | | @Autowired |
| | | private SysEnergyMapper sysEnergyMapper; |
| | | @Autowired |
| | | private IModelNodeService modelNodeService; |
| | | @Autowired |
| | | private IEnergyIndexService energyIndexService; |
| | | |
| | | @Autowired |
| | | private EnergyDataStatisticMapper statisticMapper; |
| | | |
| | | @Autowired |
| | | private EnergyIndexMapper energyIndexMapper; |
| | | |
| | | @Autowired |
| | | private MeterImplementMapper meterImplementMapper; |
| | | |
| | | @Override |
| | | public List<EnergyChainYoyVO> energyConsumptionSummation(String timeType, String modelcode) { |
| | | Date currentTime = new Date(); |
| | | // Date currentTime = DateUtil.parseDateTime("2023-04-11 00:00:00"); |
| | | |
| | | DateTime tongbiTime = DateUtil.offsetMonth(currentTime, -12); |
| | | DateTime huanbiTime = DateUtil.offsetMonth(currentTime, -1); |
| | | final List<EnergyChainYoyVO> resultData = new ArrayList<>(); |
| | | final List<HomeEnergyStatisticsVO> current = getEnergyTotalByTime(timeType, modelcode, currentTime); |
| | | final List<HomeEnergyStatisticsVO> tongbi = getEnergyTotalByTime(timeType, modelcode, tongbiTime); |
| | | final List<HomeEnergyStatisticsVO> huanbi = getEnergyTotalByTime(timeType, modelcode, huanbiTime); |
| | | |
| | | final Map<String, List<HomeEnergyStatisticsVO>> tongbiMap = tongbi.stream().collect(Collectors.groupingBy(HomeEnergyStatisticsVO::getEnergyNo)); |
| | | final Map<String, List<HomeEnergyStatisticsVO>> huanbiMap = huanbi.stream().collect(Collectors.groupingBy(HomeEnergyStatisticsVO::getEnergyNo)); |
| | | |
| | | current.stream().forEach(vo->{ |
| | | EnergyChainYoyVO chainYoyVO = new EnergyChainYoyVO(); |
| | | |
| | | final String energyNo = vo.getEnergyNo(); |
| | | final Double count = vo.getCount(); |
| | | final Double tongbiCount = tongbiMap.get(energyNo).stream().map(HomeEnergyStatisticsVO::getCount).mapToDouble(Double::doubleValue).sum(); |
| | | final Double huanbiCount = huanbiMap.get(energyNo).stream().map(HomeEnergyStatisticsVO::getCount).mapToDouble(Double::doubleValue).sum(); |
| | | |
| | | vo.setTonCount(format2Double( vo.getCount() * Double.valueOf(vo.getCoefficient()))); |
| | | if (tongbiCount != 0) { |
| | | vo.setTongbi(format2Double( (count - tongbiCount) / tongbiCount * 100)); |
| | | }else { |
| | | vo.setTongbi(0D); |
| | | } |
| | | |
| | | if (huanbiCount != 0) { |
| | | vo.setHuanbi (format2Double((count - huanbiCount) / huanbiCount * 100)); |
| | | }else { |
| | | vo.setHuanbi(0D); |
| | | } |
| | | |
| | | BeanUtils.copyProperties(vo, chainYoyVO); |
| | | chainYoyVO.setSamePeriodCount(BigDecimal.valueOf(tongbiCount)); |
| | | chainYoyVO.setCount(BigDecimal.valueOf(vo.getCount())); |
| | | chainYoyVO.setTongbi(BigDecimal.valueOf(vo.getTongbi())); |
| | | chainYoyVO.setHuanbi(BigDecimal.valueOf(vo.getHuanbi())); |
| | | chainYoyVO.setTonCount(BigDecimal.valueOf(vo.getTonCount())); |
| | | resultData.add(chainYoyVO); |
| | | }); |
| | | return resultData; |
| | | } |
| | | /** |
| | | * ç¨çµè¶å¿åæ--鿩年 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PeakValleyDayVO segmentAnalysisMonth(PeakValleyDTO dto) { |
| | | PeakValleyDayVO peakValleyVO = new PeakValleyDayVO(); |
| | | List<PeakValleyDayDataVO> reportVOList = new ArrayList<>(); |
| | | //è·ånodeId |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dto.getModelCode()); |
| | | dto.setNodeId(modelNode.getNodeId()); |
| | | // æ¥è¯¢æ¶é´èå´ |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DATE, 1); |
| | | calendar.set(Calendar.HOUR, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | Date endTime =calendar.getTime(); |
| | | calendar.add(Calendar.MONTH, -12); |
| | | Date startTime = calendar.getTime(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String timeType = dto.getTimeType(); |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | } |
| | | while (!startTime.after(endTime)) { |
| | | String mapKey = DateUtil.formatDateTime(startTime); |
| | | List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); |
| | | |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | | BigDecimal peakFee = BigDecimal.ZERO; |
| | | BigDecimal peakPower = BigDecimal.ZERO; |
| | | BigDecimal flatFee = BigDecimal.ZERO; |
| | | BigDecimal flatPower = BigDecimal.ZERO; |
| | | BigDecimal valleyFee = BigDecimal.ZERO; |
| | | BigDecimal valleyPower = BigDecimal.ZERO; |
| | | |
| | | if (CollectionUtils.isNotEmpty(dataItemList)) { |
| | | for (ElectricityDataItem electricityDataItem : dataItemList) { |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | } |
| | | PeakValleyDayDataVO peakAndValleyReportVO = new PeakValleyDayDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | | |
| | | reportVOList.add(peakAndValleyReportVO); |
| | | |
| | | startTime = DateUtil.offsetMonth(startTime, 1); |
| | | } |
| | | List<PeakValleyLineChatVO> costList = new ArrayList<>(); |
| | | List<PeakValleyLineChatVO> powerConsumptionList = new ArrayList<>(); |
| | | PeakValleyDayTotalVO peakValleyDayTotalVO = new PeakValleyDayTotalVO(); |
| | | |
| | | AtomicReference<BigDecimal> flatFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> tipFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> troughFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> peakFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> flatCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> tipCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> troughCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> peakCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | |
| | | reportVOList.stream().forEach(r->{ |
| | | PeakValleyLineChatVO costVO = new PeakValleyLineChatVO(); |
| | | PeakValleyLineChatVO powerConsumptionVO = new PeakValleyLineChatVO(); |
| | | |
| | | /** |
| | | * ç¨çµé |
| | | */ |
| | | final BigDecimal peakPower = r.getPeakPower(); |
| | | final BigDecimal valleyPower = r.getValleyPower(); |
| | | final BigDecimal sharpPower = r.getSharpPower(); |
| | | final BigDecimal flatPower = r.getFlatPower(); |
| | | powerConsumptionVO.setXdata(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,r.getTime())); |
| | | powerConsumptionVO.setYtip(sharpPower); |
| | | powerConsumptionVO.setYpeak(peakPower); |
| | | powerConsumptionVO.setYtrough(valleyPower); |
| | | powerConsumptionVO.setYflat(flatPower); |
| | | powerConsumptionList.add(powerConsumptionVO); |
| | | |
| | | /** |
| | | * ç¨çµè´¹ç¨ |
| | | */ |
| | | final BigDecimal peakFee = r.getPeakFee(); |
| | | final BigDecimal valleyFee = r.getValleyFee(); |
| | | final BigDecimal sharpFee = r.getSharpFee(); |
| | | final BigDecimal flatFee = r.getFlatFee(); |
| | | costVO.setXdata(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,r.getTime())); |
| | | costVO.setYtip(sharpFee); |
| | | costVO.setYpeak(peakFee); |
| | | costVO.setYtrough(valleyFee); |
| | | costVO.setYflat(flatFee); |
| | | costList.add(costVO); |
| | | |
| | | flatCount.set(flatCount.get().add(r.getFlatPower())); |
| | | tipCount.set(tipCount.get().add(r.getSharpPower())); |
| | | troughCount.set(troughCount.get().add(r.getValleyPower())); |
| | | peakCount.set(peakCount.get().add(r.getPeakPower())); |
| | | |
| | | flatFreeCount.set(flatFreeCount.get().add(r.getFlatFee())); |
| | | tipFreeCount.set(tipFreeCount.get().add(r.getSharpFee())); |
| | | troughFreeCount.set(troughFreeCount.get().add(r.getValleyFee())); |
| | | peakFreeCount.set(peakFreeCount.get().add(r.getPeakFee())); |
| | | }); |
| | | |
| | | peakValleyDayTotalVO.setPeakPowerCost(peakFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setPeakPowerConsumption(peakCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerCost(flatFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerConsumption(flatCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerCost(tipFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerConsumption(tipCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerCost(troughFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerConsumption(troughCount.get().doubleValue()); |
| | | |
| | | BigDecimal powerTotal = peakCount.get().add(tipCount.get()).add(troughCount.get()).add(flatCount.get()); |
| | | if(powerTotal.compareTo(BigDecimal.ZERO) > 0) { |
| | | peakValleyDayTotalVO.setPeakPowerProportion(peakCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerProportion(flatCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerProportion(tipCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerProportion(troughCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | }else { |
| | | peakValleyDayTotalVO.setPeakPowerProportion(0); |
| | | peakValleyDayTotalVO.setFlatPowerProportion(0); |
| | | peakValleyDayTotalVO.setTipPowerProportion(0); |
| | | peakValleyDayTotalVO.setTroughPowerProportion(0); |
| | | } |
| | | |
| | | BigDecimal freeTotal = peakFreeCount.get().add(tipFreeCount.get()).add(troughFreeCount.get()).add(flatFreeCount.get()); |
| | | if(freeTotal.compareTo(BigDecimal.ZERO) > 0) { |
| | | peakValleyDayTotalVO.setPeakPowerCostProportion(peakFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerCostProportion(flatFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerCostProportion(tipFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerCostProportion(troughFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | }else { |
| | | peakValleyDayTotalVO.setPeakPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setFlatPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setTipPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setTroughPowerCostProportion(0); |
| | | } |
| | | |
| | | peakValleyDayTotalVO.setTotalCost(powerTotal.doubleValue()); |
| | | peakValleyDayTotalVO.setTotalPowerConsumption(freeTotal.doubleValue()); |
| | | peakValleyVO.setTotalVO(peakValleyDayTotalVO); |
| | | peakValleyVO.setCostList(costList); |
| | | peakValleyVO.setPowerConsumptionList(powerConsumptionList); |
| | | |
| | | return peakValleyVO; |
| | | } |
| | | |
| | | @Override |
| | | public PeakValleyDayVO segmentAnalysisDay(PeakValleyDTO dto) { |
| | | PeakValleyDayVO peakValleyVO = new PeakValleyDayVO(); |
| | | List<PeakValleyDayDataVO> reportVOList = new ArrayList<>(); |
| | | //è·ånodeId |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dto.getModelCode()); |
| | | dto.setNodeId(modelNode.getNodeId()); |
| | | // æ¥è¯¢æ¶é´èå´ |
| | | Date startTime = DateUtil.beginOfMonth(dto.getQueryTime()); |
| | | Date endTime = DateUtil.endOfMonth(startTime); |
| | | String timeType = dto.getTimeType(); |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | } |
| | | while (!startTime.after(endTime)) { |
| | | String mapKey = DateUtil.formatDateTime(startTime); |
| | | List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); |
| | | |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | | BigDecimal peakFee = BigDecimal.ZERO; |
| | | BigDecimal peakPower = BigDecimal.ZERO; |
| | | BigDecimal flatFee = BigDecimal.ZERO; |
| | | BigDecimal flatPower = BigDecimal.ZERO; |
| | | BigDecimal valleyFee = BigDecimal.ZERO; |
| | | BigDecimal valleyPower = BigDecimal.ZERO; |
| | | |
| | | if (CollectionUtils.isNotEmpty(dataItemList)) { |
| | | for (ElectricityDataItem electricityDataItem : dataItemList) { |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | // CostPriceRelevancyVo voD = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.DEEP.name()); |
| | | // if(voV!=null){ |
| | | // DeepFee = voV.getPrice().multiply(valleyPower); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyDayDataVO peakAndValleyReportVO = new PeakValleyDayDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | | |
| | | reportVOList.add(peakAndValleyReportVO); |
| | | switch (TimeType.valueOf(timeType)) { |
| | | case HOUR: |
| | | startTime = DateUtil.offsetHour(startTime, 1); |
| | | break; |
| | | case DAY: |
| | | startTime = DateUtil.offsetDay(startTime, 1); |
| | | break; |
| | | case MONTH: |
| | | startTime = DateUtil.offsetMonth(startTime, 1); |
| | | break; |
| | | default: |
| | | startTime = DateUtil.offsetMonth(startTime, 12); |
| | | break; |
| | | } |
| | | } |
| | | List<PeakValleyLineChatVO> costList = new ArrayList<>(); |
| | | List<PeakValleyLineChatVO> powerConsumptionList = new ArrayList<>(); |
| | | PeakValleyDayTotalVO peakValleyDayTotalVO = new PeakValleyDayTotalVO(); |
| | | |
| | | AtomicReference<BigDecimal> flatFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> tipFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> troughFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> peakFreeCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> flatCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> tipCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> troughCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> peakCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | |
| | | reportVOList.stream().forEach(r->{ |
| | | PeakValleyLineChatVO costVO = new PeakValleyLineChatVO(); |
| | | PeakValleyLineChatVO powerConsumptionVO = new PeakValleyLineChatVO(); |
| | | |
| | | /** |
| | | * ç¨çµé |
| | | */ |
| | | final BigDecimal peakPower = r.getPeakPower(); |
| | | final BigDecimal valleyPower = r.getValleyPower(); |
| | | final BigDecimal sharpPower = r.getSharpPower(); |
| | | final BigDecimal flatPower = r.getFlatPower(); |
| | | powerConsumptionVO.setXdata(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,r.getTime())); |
| | | powerConsumptionVO.setYtip(sharpPower); |
| | | powerConsumptionVO.setYpeak(peakPower); |
| | | powerConsumptionVO.setYtrough(valleyPower); |
| | | powerConsumptionVO.setYflat(flatPower); |
| | | powerConsumptionList.add(powerConsumptionVO); |
| | | |
| | | /** |
| | | * ç¨çµè´¹ç¨ |
| | | */ |
| | | final BigDecimal peakFee = r.getPeakFee(); |
| | | final BigDecimal valleyFee = r.getValleyFee(); |
| | | final BigDecimal sharpFee = r.getSharpFee(); |
| | | final BigDecimal flatFee = r.getFlatFee(); |
| | | costVO.setXdata(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,r.getTime())); |
| | | costVO.setYtip(sharpFee); |
| | | costVO.setYpeak(peakFee); |
| | | costVO.setYtrough(valleyFee); |
| | | costVO.setYflat(flatFee); |
| | | costList.add(costVO); |
| | | |
| | | flatCount.set(flatCount.get().add(r.getFlatPower())); |
| | | tipCount.set(tipCount.get().add(r.getSharpPower())); |
| | | troughCount.set(troughCount.get().add(r.getValleyPower())); |
| | | peakCount.set(peakCount.get().add(r.getPeakPower())); |
| | | |
| | | flatFreeCount.set(flatFreeCount.get().add(r.getFlatFee())); |
| | | tipFreeCount.set(tipFreeCount.get().add(r.getSharpFee())); |
| | | troughFreeCount.set(troughFreeCount.get().add(r.getValleyFee())); |
| | | peakFreeCount.set(peakFreeCount.get().add(r.getPeakFee())); |
| | | }); |
| | | |
| | | peakValleyDayTotalVO.setPeakPowerCost(peakFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setPeakPowerConsumption(peakCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerCost(flatFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerConsumption(flatCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerCost(tipFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerConsumption(tipCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerCost(troughFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerConsumption(troughCount.get().doubleValue()); |
| | | |
| | | BigDecimal powerTotal = peakCount.get().add(tipCount.get()).add(troughCount.get()).add(flatCount.get()); |
| | | if(powerTotal.compareTo(BigDecimal.ZERO) > 0) { |
| | | peakValleyDayTotalVO.setPeakPowerProportion(peakCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerProportion(flatCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerProportion(tipCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerProportion(troughCount.get().divide(powerTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | }else { |
| | | peakValleyDayTotalVO.setPeakPowerProportion(0); |
| | | peakValleyDayTotalVO.setFlatPowerProportion(0); |
| | | peakValleyDayTotalVO.setTipPowerProportion(0); |
| | | peakValleyDayTotalVO.setTroughPowerProportion(0); |
| | | } |
| | | |
| | | BigDecimal freeTotal = peakFreeCount.get().add(tipFreeCount.get()).add(troughFreeCount.get()).add(flatFreeCount.get()); |
| | | if(freeTotal.compareTo(BigDecimal.ZERO) > 0) { |
| | | peakValleyDayTotalVO.setPeakPowerCostProportion(peakFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerCostProportion(flatFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTipPowerCostProportion(tipFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | peakValleyDayTotalVO.setTroughPowerCostProportion(troughFreeCount.get().divide(freeTotal.multiply(new BigDecimal(0.01)), 2, RoundingMode.HALF_UP).doubleValue()); |
| | | }else { |
| | | peakValleyDayTotalVO.setPeakPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setFlatPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setTipPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setTroughPowerCostProportion(0); |
| | | } |
| | | |
| | | // peakValleyDayTotalVO.setTotalCost(powerTotal.doubleValue()); |
| | | // peakValleyDayTotalVO.setTotalPowerConsumption(freeTotal.doubleValue()); |
| | | peakValleyDayTotalVO.setTotalCost(freeTotal.doubleValue()); |
| | | peakValleyDayTotalVO.setTotalPowerConsumption(powerTotal.doubleValue()); |
| | | peakValleyVO.setTotalVO(peakValleyDayTotalVO); |
| | | peakValleyVO.setCostList(costList); |
| | | peakValleyVO.setPowerConsumptionList(powerConsumptionList); |
| | | |
| | | return peakValleyVO; |
| | | } |
| | | |
| | | @Override |
| | | public PeakValleyHourVO segmentAnalysisHour(PeakValleyDTO dto) { |
| | | PeakValleyHourVO peakValleyVO = new PeakValleyHourVO(); |
| | | List<PeakValleyHourDataVO> reportVOList = new ArrayList<>(); |
| | | //è·ånodeId |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(dto.getModelCode()); |
| | | dto.setNodeId(modelNode.getNodeId()); |
| | | |
| | | // æ¥è¯¢æ¶é´èå´ |
| | | Date startTime = DateUtil.beginOfDay(dto.getQueryTime()); |
| | | Date endTime = DateUtil.endOfDay(startTime); |
| | | String timeType = dto.getTimeType(); |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | } |
| | | while (!startTime.after(endTime)) { |
| | | String mapKey = DateUtil.formatDateTime(startTime); |
| | | List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); |
| | | |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | | BigDecimal peakFee = BigDecimal.ZERO; |
| | | BigDecimal peakPower = BigDecimal.ZERO; |
| | | BigDecimal flatFee = BigDecimal.ZERO; |
| | | BigDecimal flatPower = BigDecimal.ZERO; |
| | | BigDecimal valleyFee = BigDecimal.ZERO; |
| | | BigDecimal valleyPower = BigDecimal.ZERO; |
| | | |
| | | if (CollectionUtils.isNotEmpty(dataItemList)) { |
| | | for (ElectricityDataItem electricityDataItem : dataItemList) { |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyHourDataVO peakAndValleyReportVO = new PeakValleyHourDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | | |
| | | reportVOList.add(peakAndValleyReportVO); |
| | | switch (TimeType.valueOf(timeType)) { |
| | | case HOUR: |
| | | startTime = DateUtil.offsetHour(startTime, 1); |
| | | break; |
| | | case DAY: |
| | | startTime = DateUtil.offsetDay(startTime, 1); |
| | | break; |
| | | case MONTH: |
| | | startTime = DateUtil.offsetMonth(startTime, 1); |
| | | break; |
| | | default: |
| | | startTime = DateUtil.offsetMonth(startTime, 12); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | peakValleyVO.setDataList(reportVOList); |
| | | List<PeakValleyLineChatVO> peakValleyLineChatVOS = new ArrayList<>(); |
| | | AtomicReference<BigDecimal> flatCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> tipCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> troughCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> peakCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | reportVOList.stream().forEach(r->{ |
| | | PeakValleyLineChatVO lineChatVO = new PeakValleyLineChatVO(); |
| | | lineChatVO.setXdata(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,r.getTime())); |
| | | lineChatVO.setYtip(r.getSharpPower()); |
| | | lineChatVO.setYflat(r.getFlatPower()); |
| | | lineChatVO.setYtrough(r.getValleyPower()); |
| | | lineChatVO.setYpeak(r.getPeakPower()); |
| | | peakValleyLineChatVOS.add(lineChatVO); |
| | | BigDecimal flat = flatCount.get().add(r.getFlatPower()); |
| | | flatCount.set(flat); |
| | | BigDecimal tip = tipCount.get().add(r.getSharpPower()); |
| | | tipCount.set(tip); |
| | | BigDecimal trough = troughCount.get().add(r.getValleyPower()); |
| | | troughCount.set(trough); |
| | | BigDecimal peak = peakCount.get().add(r.getPeakPower()); |
| | | peakCount.set(peak); |
| | | |
| | | }); |
| | | PeakValleyPieChatVO peakValleyPieChatVO = new PeakValleyPieChatVO(); |
| | | BigDecimal total = peakCount.get().add(tipCount.get()).add(troughCount.get()).add(flatCount.get()).multiply(new BigDecimal(0.01)); |
| | | if(total.compareTo(BigDecimal.ZERO) > 0) { |
| | | peakValleyPieChatVO.setPeak(peakCount.get().divide(total, 2, RoundingMode.HALF_UP).toString()); |
| | | peakValleyPieChatVO.setFlat(flatCount.get().divide(total, 2, RoundingMode.HALF_UP).toString()); |
| | | peakValleyPieChatVO.setTip(tipCount.get().divide(total, 2, RoundingMode.HALF_UP).toString()); |
| | | peakValleyPieChatVO.setTrough(troughCount.get().divide(total, 2, RoundingMode.HALF_UP).toString()); |
| | | }else { |
| | | peakValleyPieChatVO.setPeak("0"); |
| | | peakValleyPieChatVO.setFlat("0"); |
| | | peakValleyPieChatVO.setTip("0"); |
| | | peakValleyPieChatVO.setTrough("0"); |
| | | } |
| | | peakValleyVO.setPieChat(peakValleyPieChatVO); |
| | | peakValleyVO.setLineChat(peakValleyLineChatVOS); |
| | | return peakValleyVO; |
| | | } |
| | | |
| | | /** |
| | | * è½èç§å®¤æåå10 |
| | | * @param modelCode |
| | | * @param timeType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<RankingEnergyData> energyConsumptionRanking(String modelCode, String timeType) { |
| | | List<RankingEnergyData> energyDataList = new ArrayList<>(); |
| | | String nodeCategory = "2"; |
| | | LambdaQueryWrapper<ModelNode> modelNodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | modelNodeLambdaQueryWrapper.eq(ModelNode::getModelCode,modelCode); |
| | | modelNodeLambdaQueryWrapper.eq(ModelNode::getNodeCategory,nodeCategory); |
| | | List<ModelNode> modelNodeList = modelNodeMapper.selectList(modelNodeLambdaQueryWrapper); |
| | | if(CollectionUtils.isEmpty(modelNodeList)){ |
| | | return energyDataList; |
| | | } |
| | | final List<String> nodeIds = modelNodeList.stream().map(ModelNode::getNodeId).collect(Collectors.toList()); |
| | | List<ModelNodeIndexInfor> nodeIndexInforList = modelNodeMapper.selectIndexByNodeIds(modelCode ,nodeIds); |
| | | |
| | | final Map<String, String> nodeNameMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | | final String id = n.getNodeId(); |
| | | final String name = n.getName(); |
| | | if(!nodeNameMap.containsKey(id)){ |
| | | nodeNameMap.put(id,name); |
| | | } |
| | | }); |
| | | |
| | | // æç
§ç¹ä½è¿è¡åç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = nodeIndexInforList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | final List<String> eneryIdList = nodeIndexInforList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | //è½æºç¼å·åè½æºææ ç³»æ° |
| | | final Map<String, Object> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno, SysEnergy::getCoefficient)); |
| | | //indexåè½æº |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | nodeIndexInforList.forEach(n->{ |
| | | final String indexId = n.getIndexId(); |
| | | final String energyId = n.getEnergyId(); |
| | | if(!indexIdEnergyIdMap.containsKey(indexId)){ |
| | | indexIdEnergyIdMap.put(indexId,energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | Date queryTime = new Date(); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String shixuTimeType; |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfDay(queryTime); |
| | | endTime = DateUtil.endOfDay(queryTime); |
| | | shixuTimeType = TimeType.HOUR.name(); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfMonth(queryTime); |
| | | endTime = DateUtil.endOfMonth(queryTime); |
| | | shixuTimeType = TimeType.DAY.name(); |
| | | // å¹´ |
| | | } else { |
| | | beginTime = DateUtil.beginOfYear(queryTime); |
| | | endTime = DateUtil.endOfYear(queryTime); |
| | | shixuTimeType = TimeType.MONTH.name(); |
| | | } |
| | | // æ ¹æ®indexIdæ¥è¯¢dataItem |
| | | List<DataItem> dataItemList = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(indexIds)) { |
| | | dataItemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | } |
| | | Map<String, List<DataItem>> dataItemMap = dataItemList.stream().collect(Collectors.groupingBy(DataItem::getIndexId)); |
| | | |
| | | Map<String,BigDecimal> resultMap = new HashMap<>(); |
| | | nodeIndexMap.forEach((key, value) -> { |
| | | // æ¾åºindexIds |
| | | List<String> indexIdList = value.stream().map(ModelNodeIndexInfor::getIndexId).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | if (null!=indexIdList &&!indexIdList.isEmpty()){ |
| | | indexIdList.forEach(indexId -> { |
| | | final List<DataItem> dataItems = dataItemMap.get(indexId); |
| | | final String energyId = indexIdEnergyIdMap.get(indexId); |
| | | BigDecimal coefficient = (BigDecimal) energyCoefficientMap.get(energyId); |
| | | |
| | | if (coefficient == null && StringUtils.isBlank(energyId)) { |
| | | EnergyIndex energyIndex = energyIndexMapper.selectEnergyIndexById(indexId); |
| | | MeterImplement meterImplement = meterImplementMapper.selectMeterImplementById(energyIndex.getMeterId()); |
| | | coefficient = (BigDecimal) energyCoefficientMap.get(meterImplement.getEnergyType()); |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(dataItems)) { |
| | | BigDecimal sum = BigDecimal.valueOf(dataItems.stream() |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP).multiply(coefficient); |
| | | |
| | | if (resultMap.containsKey(key)) { |
| | | resultMap.put(key, resultMap.get(key).add(sum)); |
| | | } else { |
| | | resultMap.put(key, sum); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | resultMap.forEach((key,value)->{ |
| | | RankingEnergyData rankingEnergyData = new RankingEnergyData(); |
| | | rankingEnergyData.setNodeId(key); |
| | | rankingEnergyData.setNodeName(nodeNameMap.get(key)); |
| | | rankingEnergyData.setEnergyConsumption(value.doubleValue()); |
| | | energyDataList.add(rankingEnergyData); |
| | | }); |
| | | Collections.sort(energyDataList, Comparator.comparingDouble((RankingEnergyData item) -> item.getEnergyConsumption()).reversed()); |
| | | // è·åå10æ¡è®°å½ |
| | | List<RankingEnergyData> top5Items = energyDataList.subList(0, Math.min(10, energyDataList.size())); |
| | | |
| | | return top5Items; |
| | | } |
| | | |
| | | /** |
| | | * å个车é´è½èåæ |
| | | * @param timeType |
| | | * @param modelCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public FactoryEnergyConsumptionVo factoryEnergyConsumption(String timeType, String modelCode) { |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(modelCode); |
| | | //顶鍿¬æç»¼åè½è |
| | | FactoryEnergyConsumptionVo energyConsumptionVo=new FactoryEnergyConsumptionVo(); |
| | | final List<EnergyChainYoyVO> current = energyConsumptionSummation(timeType, modelCode); |
| | | //æ¬æè½èè´¹ç¨ |
| | | BigDecimal monthEnergyAmount=getTotalConsumption(modelCode,modelNode.getNodeId(),timeType); |
| | | energyConsumptionVo.setMonthEnergyAmount(monthEnergyAmount); |
| | | //å个车é´è½è |
| | | final List<FactoryEnergyConsumptionItemVo> factoryCurrent = factoryEnergyConData(timeType, modelCode); |
| | | EnergyChainYoyVO homeEnergyStatisticsVO = current.get(0); |
| | | energyConsumptionVo.setItemVoList(factoryCurrent);// |
| | | energyConsumptionVo.setMonthConsumption(homeEnergyStatisticsVO.getCount()); |
| | | energyConsumptionVo.setCEmission(BigDecimal.ZERO); |
| | | energyConsumptionVo.setUseEnergyIndex(BigDecimal.ZERO); |
| | | return energyConsumptionVo; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * è´å
¥æ¶èå¯¹æ¯ |
| | | * @param modelCode |
| | | * @param timeType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PurchaseConsumptionVo> purchaseConsumption(String modelCode, String timeType) { |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(modelCode); |
| | | List<PurchaseConsumptionVo> voList=new ArrayList<>(); |
| | | |
| | | String queryTime=null; |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | queryTime=DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,new Date()); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | queryTime=DateUtils.parseDateToStr(DateUtils.YYYY_MM,new Date()); |
| | | // å¹´ |
| | | } else { |
| | | queryTime=DateUtils.parseDateToStr(DateUtils.YYYY,new Date()); |
| | | } |
| | | |
| | | //è·åè´å
¥é |
| | | LambdaQueryWrapper<CostElectricityInput> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(CostElectricityInput::getType,timeType); |
| | | queryWrapper.like(CostElectricityInput::getTime,queryTime); |
| | | List<CostElectricityInput> list=electricityInputMapper.selectList(queryWrapper); |
| | | |
| | | //è·åæ¶èé |
| | | BigDecimal totalConsumption=getTotalConsumption(modelCode,modelNode.getNodeId(),timeType); |
| | | //åå
¥å®ä½ç±» |
| | | PurchaseConsumptionVo vo=new PurchaseConsumptionVo(); |
| | | vo.setEnergyNo("electric"); |
| | | vo.setEnergyName("çµ"); |
| | | vo.setConsumptionSum(totalConsumption.divide(BigDecimal.valueOf(1000),RoundingMode.HALF_UP)); |
| | | if (!list.isEmpty()){ |
| | | vo.setPurchaseSum(list.get(0).getElectricityFee().divide(BigDecimal.valueOf(1000),RoundingMode.HALF_UP)); |
| | | }else{ |
| | | vo.setPurchaseSum(BigDecimal.ZERO); |
| | | } |
| | | voList.add(vo); |
| | | |
| | | return voList; |
| | | } |
| | | |
| | | /** |
| | | * è½æºææ¬å æ¯ |
| | | * @param modelCode |
| | | * @param timeType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<PurchaseConsumptionVo> costProp(String modelCode, String timeType) { |
| | | List<PurchaseConsumptionVo> list=new ArrayList<>(); |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(modelCode); |
| | | BigDecimal totalConsumption=getTotalConsumption(modelCode, modelNode.getNodeId(), timeType); |
| | | PurchaseConsumptionVo vo=new PurchaseConsumptionVo(); |
| | | vo.setEnergyNo("electric"); |
| | | vo.setEnergyName("çµ"); |
| | | vo.setConsumptionSum(totalConsumption.divide(BigDecimal.valueOf(10000),RoundingMode.HALF_UP)); |
| | | list.add(vo); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å°å³°å¹³è°·è·åæ¶èçµééé¢ |
| | | * @param modelCode |
| | | * @param nodeId |
| | | * @param timeType |
| | | * @return |
| | | */ |
| | | public BigDecimal getTotalConsumption(String modelCode,String nodeId,String timeType){ |
| | | BigDecimal totalConsumption = BigDecimal.ZERO; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.HOUR, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | Date queryTime =calendar.getTime(); |
| | | Date startTime =new Date(); |
| | | Date endTime =new Date(); |
| | | |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | startTime = DateUtil.beginOfDay(queryTime); |
| | | endTime = DateUtil.endOfDay(queryTime); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | calendar.set(Calendar.DATE, 1); |
| | | startTime = DateUtil.beginOfMonth(queryTime); |
| | | endTime = DateUtil.endOfMonth(queryTime); |
| | | // å¹´ |
| | | } else { |
| | | calendar.set(Calendar.DATE, 1); |
| | | startTime = DateUtil.beginOfYear(queryTime); |
| | | endTime = DateUtil.endOfYear(queryTime); |
| | | } |
| | | |
| | | |
| | | |
| | | Map<String, List<ElectricityDataItem>> electricityDataMap = new HashMap<>(); |
| | | // æ¥è¯¢ç¹ä½ä¿¡æ¯ |
| | | List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(modelCode, nodeId); |
| | | if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { |
| | | Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); |
| | | List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime,endTime , timeType); |
| | | |
| | | electricityDataMap = dataItemList.stream() |
| | | .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); |
| | | } |
| | | while (!startTime.after(endTime)) { |
| | | String mapKey = DateUtil.formatDateTime(startTime); |
| | | List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); |
| | | |
| | | BigDecimal sharpFee = BigDecimal.ZERO; |
| | | BigDecimal sharpPower = BigDecimal.ZERO; |
| | | BigDecimal peakFee = BigDecimal.ZERO; |
| | | BigDecimal peakPower = BigDecimal.ZERO; |
| | | BigDecimal flatFee = BigDecimal.ZERO; |
| | | BigDecimal flatPower = BigDecimal.ZERO; |
| | | BigDecimal valleyFee = BigDecimal.ZERO; |
| | | BigDecimal valleyPower = BigDecimal.ZERO; |
| | | |
| | | if (CollectionUtils.isNotEmpty(dataItemList)) { |
| | | for (ElectricityDataItem electricityDataItem : dataItemList) { |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId,ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId,ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId,ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(nodeId, ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | } |
| | | totalConsumption = totalConsumption.add(sharpFee).add(peakFee).add(flatFee).add(valleyFee); |
| | | |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | startTime = DateUtil.offsetDay(startTime, 1); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | startTime = DateUtil.offsetMonth(startTime, 1); |
| | | // å¹´ |
| | | } else { |
| | | startTime = DateUtil.offsetMonth(startTime, 12); |
| | | } |
| | | |
| | | } |
| | | return totalConsumption; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ååºãè½æºç±»ååç»è·åæ¯ä¸ªååºãæ¯ç§è½æºç±»åçæ¶èé |
| | | * @param timeType |
| | | * @param modelCode |
| | | * @return |
| | | */ |
| | | public List<FactoryEnergyConsumptionItemVo> factoryEnergyConData(String timeType, String modelCode){ |
| | | List<FactoryEnergyConsumptionItemVo> energyDataList=new ArrayList<>(); |
| | | |
| | | //ååºåºå®ä¸ºå½å6个 |
| | | List<String> fixedNodeIds=new ArrayList<>(); |
| | | fixedNodeIds.add("d9a155d2-b2dd-4a70-a00b-f8ab5be91f00");//å¶ä¸ |
| | | fixedNodeIds.add("58dcb139-c943-41fe-a764-7cf79f987c9f");//å¶äº |
| | | fixedNodeIds.add("dca20897-5977-40ae-a28a-88a6acdee335");//å¶ä¸ |
| | | fixedNodeIds.add("4912c751-0611-4f4b-afce-0f58629512b7");//ç²¾ç¼ |
| | | fixedNodeIds.add("8eef471f-880c-4636-a428-620a4d2ccd5d");//ç¿ä¸ |
| | | fixedNodeIds.add("6d6a0412-7c6d-4654-9cb3-0079655e23e5");//æé¦æ°ææ |
| | | |
| | | LambdaQueryWrapper<ModelNode> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | nodeLambdaQueryWrapper.eq(ModelNode::getModelCode,modelCode); |
| | | nodeLambdaQueryWrapper.in(ModelNode::getNodeId,fixedNodeIds); |
| | | |
| | | List<ModelNode> nodeList=modelNodeMapper.selectList(nodeLambdaQueryWrapper); |
| | | |
| | | if (nodeList.isEmpty()){ |
| | | throw new RuntimeException("æªæ¥è¯¢å°6个ååºä¿¡æ¯ï¼"); |
| | | } |
| | | |
| | | Map<String,ModelNode> nodeMap=nodeList.stream().collect(Collectors.toMap(ModelNode::getNodeId,x->x)); |
| | | |
| | | List<ModelNodeIndexInfor> indexList=statisticMapper.getModelNodeIndexIdByFixedNodeIds(modelCode,fixedNodeIds); |
| | | |
| | | |
| | | // æ ¹æ®ååºåç» |
| | | Map<String, List<ModelNodeIndexInfor>> nodeIndexMap = indexList.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getNodeId)); |
| | | //æ¥è¯¢ææè½æºç±»å |
| | | final List<String> eneryIdList = indexList.stream().map(ModelNodeIndexInfor::getEnergyId).distinct().collect(Collectors.toList()); |
| | | final LambdaQueryWrapper<SysEnergy> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(CollectionUtils.isNotEmpty(eneryIdList),SysEnergy::getEnersno,eneryIdList); |
| | | |
| | | //indexåè½æº |
| | | final Map<String, String> indexIdEnergyIdMap = new HashMap<>(); |
| | | indexList.forEach(n->{ |
| | | final String indexId = n.getIndexId(); |
| | | final String energyId = n.getEnergyId(); |
| | | if(!indexIdEnergyIdMap.containsKey(indexId)){ |
| | | indexIdEnergyIdMap.put(indexId,energyId); |
| | | } |
| | | }); |
| | | List<String> indexIds = indexList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | // Date queryTime = new Date(); |
| | | Date queryTime = new Date(); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String shixuTimeType; |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfDay(queryTime); |
| | | endTime = DateUtil.endOfDay(queryTime); |
| | | shixuTimeType = TimeType.HOUR.name(); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfMonth(queryTime); |
| | | endTime = DateUtil.endOfMonth(queryTime); |
| | | shixuTimeType = TimeType.DAY.name(); |
| | | // å¹´ |
| | | } else { |
| | | beginTime = DateUtil.beginOfYear(queryTime); |
| | | endTime = DateUtil.endOfYear(queryTime); |
| | | shixuTimeType = TimeType.MONTH.name(); |
| | | } |
| | | // æ ¹æ®indexIdæ¥è¯¢dataItem |
| | | List<DataItem> dataItemList = new ArrayList<>(); |
| | | if(CollectionUtils.isNotEmpty(indexIds)) { |
| | | dataItemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | } |
| | | Map<String, List<DataItem>> dataItemMap = dataItemList.stream().collect(Collectors.groupingBy(DataItem::getIndexId)); |
| | | |
| | | final List<SysEnergy> sysEnergies = sysEnergyMapper.selectList(queryWrapper); |
| | | //è½æºç¼å·åè½æºææ ç³»æ° |
| | | final Map<String, SysEnergy> energyCoefficientMap = sysEnergies.stream().collect(Collectors.toMap(SysEnergy::getEnersno,x->x)); |
| | | |
| | | //è·åæ°æ®:nodeMap |
| | | // nodeIndexMap.forEach((key, value) -> { |
| | | nodeMap.forEach((key,nodeItem)->{ |
| | | |
| | | if (!nodeIndexMap.containsKey(key)){ |
| | | FactoryEnergyConsumptionItemVo voData = new FactoryEnergyConsumptionItemVo(); |
| | | voData.setNodeId(key); |
| | | voData.setNodeName(nodeItem.getName()); |
| | | BigDecimal kgceCount=BigDecimal.ZERO; |
| | | BigDecimal kgceTonCount=BigDecimal.ZERO; |
| | | voData.setKgceCount(kgceCount); |
| | | voData.setKgceTonCount(kgceTonCount); |
| | | voData.setEnergyItemList(new ArrayList<>()); |
| | | energyDataList.add(voData); |
| | | return; |
| | | } |
| | | |
| | | //nodeåindexå
³èéå |
| | | List<ModelNodeIndexInfor> value=nodeIndexMap.get(key); |
| | | |
| | | List<HomeEnergyStatisticsVO> itemVo=new ArrayList<>(); |
| | | //æ ¹æ®è½æºç±»ååç» |
| | | Map<String, List<ModelNodeIndexInfor>> sysEnergyIds = value.stream().collect( |
| | | Collectors.groupingBy(ModelNodeIndexInfor::getEnergyId)); |
| | | |
| | | if (!sysEnergyIds.isEmpty()) { |
| | | //éå |
| | | for (Map.Entry<String, List<ModelNodeIndexInfor>> entry : sysEnergyIds.entrySet()) { |
| | | String energyIndex = entry.getKey(); |
| | | List<ModelNodeIndexInfor> energyValue = entry.getValue(); |
| | | if (energyCoefficientMap.containsKey(energyIndex)) { |
| | | SysEnergy sysEnergy = energyCoefficientMap.get(energyIndex); |
| | | HomeEnergyStatisticsVO item = new HomeEnergyStatisticsVO(); |
| | | item.setEnergyNo(sysEnergy.getEnersno()); |
| | | item.setEnergyName(sysEnergy.getEnername()); |
| | | item.setEnergyUnit(sysEnergy.getMuid()); |
| | | item.setCoefficient(sysEnergy.getCoefficient().toString()); |
| | | |
| | | BigDecimal totalConsumption = BigDecimal.ZERO; |
| | | BigDecimal totalCount = BigDecimal.ZERO; |
| | | //åè®¡å¼ |
| | | for (ModelNodeIndexInfor valueItem:entry.getValue()){ |
| | | List<DataItem> dataItems = dataItemMap.get(valueItem.getIndexId()); |
| | | if (CollectionUtils.isNotEmpty(dataItems)) { |
| | | BigDecimal sum = BigDecimal.valueOf(dataItems.stream() |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP).multiply(sysEnergy.getCoefficient()); |
| | | totalConsumption = totalConsumption.add(sum); |
| | | totalCount = totalCount.add(BigDecimal.valueOf(dataItems.stream() |
| | | .mapToDouble(DataItem::getValue).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP)); |
| | | } |
| | | ; |
| | | } |
| | | |
| | | item.setTonCount(totalConsumption.doubleValue()); |
| | | item.setCount(totalCount.doubleValue()); |
| | | itemVo.add(item); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | FactoryEnergyConsumptionItemVo voData = new FactoryEnergyConsumptionItemVo(); |
| | | voData.setNodeId(key); |
| | | voData.setNodeName(nodeItem.getName()); |
| | | BigDecimal kgceCount=BigDecimal.ZERO; |
| | | BigDecimal kgceTonCount=BigDecimal.ZERO; |
| | | if (!itemVo.isEmpty()){ |
| | | kgceCount=BigDecimal.valueOf(itemVo.stream().mapToDouble(HomeEnergyStatisticsVO::getCount).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | kgceTonCount=BigDecimal.valueOf(itemVo.stream().mapToDouble(HomeEnergyStatisticsVO::getTonCount).sum()).setScale(CommonConst.DIGIT_2, RoundingMode.HALF_UP); |
| | | } |
| | | voData.setKgceCount(kgceCount); |
| | | voData.setKgceTonCount(kgceTonCount); |
| | | voData.setEnergyItemList(itemVo); |
| | | energyDataList.add(voData); |
| | | }); |
| | | return energyDataList; |
| | | } |
| | | |
| | | |
| | | private List<HomeEnergyStatisticsVO> getEnergyTotalByTime(String timeType, String modelCode, Date queryTime) { |
| | | List<HomeEnergyStatisticsVO> voList = new ArrayList<>(); |
| | | |
| | | Date beginTime; |
| | | Date endTime; |
| | | String shixuTimeType; |
| | | if (TimeType.DAY.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfDay(queryTime); |
| | | endTime = DateUtil.endOfDay(beginTime); |
| | | shixuTimeType = TimeType.HOUR.name(); |
| | | // æ |
| | | } else if (TimeType.MONTH.name().equals(timeType)) { |
| | | beginTime = DateUtil.beginOfMonth(queryTime); |
| | | endTime = DateUtil.endOfMonth(beginTime); |
| | | shixuTimeType = TimeType.DAY.name(); |
| | | // å¹´ |
| | | } else { |
| | | beginTime = DateUtil.beginOfYear(queryTime); |
| | | endTime = DateUtil.endOfYear(beginTime); |
| | | shixuTimeType = TimeType.MONTH.name(); |
| | | } |
| | | |
| | | // æ¥è¯¢ææè½æºç±»å |
| | | List<SysEnergy> sysEnergies = sysEnergyMapper.selectSysEnergyList(new SysEnergy()); |
| | | voList = sysEnergies.stream().map(dict -> { |
| | | HomeEnergyStatisticsVO vo = new HomeEnergyStatisticsVO(); |
| | | vo.setEnergyName(dict.getEnername()); |
| | | vo.setEnergyNo(dict.getEnersno()); |
| | | vo.setEnergyUnit(dict.getMuid()); |
| | | vo.setCount(0D); |
| | | vo.setTonCount(0D); |
| | | vo.setCoefficient(dict.getCoefficient().toString()); |
| | | return vo; |
| | | }).sorted(Comparator.comparing(HomeEnergyStatisticsVO::getEnergyName)).collect(Collectors.toList()); |
| | | // éè¿codeè·åmodelnode对åºindexä¿¡æ¯ |
| | | ModelNode modelNode = modelNodeService.getModelNodeByModelCodeByIndexCode(modelCode); |
| | | if (ObjectUtils.isEmpty(modelNode)) { |
| | | return voList; |
| | | } |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelNode.getNodeId()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | // éè¿indexIdsæ¾data_Itemæ°æ® |
| | | List<DataItem> itemList = dataItemService.getDataItemTimeRangeInforByIndexIds(beginTime, endTime, shixuTimeType, indexIds); |
| | | // æ¥è¯¢ç¹ä½è¯¦ç»ä¿¡æ¯ |
| | | List<EnergyIndex> energyIndexInforList = energyIndexService.getEnergyIndexByIds(indexIds); |
| | | // è·åç¹ä½è½æºç±»å |
| | | Map<String, List<String>> energyTypeMap = energyIndexInforList.stream() |
| | | .filter(l -> StringUtils.isNotEmpty(l.getEnergyId())).collect(Collectors.groupingBy( |
| | | EnergyIndex::getEnergyId, Collectors.mapping(EnergyIndex::getIndexId, Collectors.toList()) |
| | | )); |
| | | |
| | | for (HomeEnergyStatisticsVO ratioVO : voList) { |
| | | List<String> indexs = energyTypeMap.get(ratioVO.getEnergyNo()); |
| | | if (CollectionUtils.isEmpty(indexs)) { |
| | | ratioVO.setCount(0D); |
| | | }else { |
| | | // æ¾å°åè®¡å¼ |
| | | double doubleCount = itemList.stream().filter(li -> indexs.contains(li.getIndexId())).mapToDouble(DataItem::getValue).sum(); |
| | | ratioVO.setCount(format2Double(doubleCount)); |
| | | } |
| | | } |
| | | return voList; |
| | | } |
| | | |
| | | private double format2Double(double averageEnergy) { |
| | | // å建DecimalFormat对象ï¼è®¾ç½®ä¿ç两ä½å°æ° |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | |
| | | // æ ¼å¼åç»æ |
| | | String formattedResult = df.format(averageEnergy); |
| | | return Double.valueOf(formattedResult); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.vo; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class EnergyChainYoyVO { |
| | | |
| | | /** |
| | | * è½æºç±»åç¼å· |
| | | */ |
| | | private String energyNo; |
| | | /** |
| | | * è½æºç±»ååç§° |
| | | */ |
| | | private String energyName; |
| | | |
| | | /** |
| | | * è½æºåä½ |
| | | */ |
| | | private String energyUnit; |
| | | |
| | | /** |
| | | * åè®¡å¼ |
| | | */ |
| | | private BigDecimal samePeriodCount; |
| | | /** |
| | | * åè®¡å¼ |
| | | */ |
| | | private BigDecimal count; |
| | | |
| | | /** |
| | | * 忝 |
| | | */ |
| | | private BigDecimal tongbi; |
| | | |
| | | /** |
| | | * ç¯æ¯ |
| | | */ |
| | | private BigDecimal huanbi; |
| | | |
| | | /** çä»·ææ ç³»æ° */ |
| | | private String coefficient; |
| | | |
| | | /** |
| | | * 转æ¢ä¸ºå¨æ ç
¤ |
| | | */ |
| | | private BigDecimal tonCount; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.vo; |
| | | |
| | | import com.zhitan.home.domain.vo.HomeEnergyStatisticsVO; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FactoryEnergyConsumptionItemVo { |
| | | |
| | | /** |
| | | * ååºä¸»é® |
| | | */ |
| | | private String nodeId; |
| | | /** |
| | | * ååºåç§° |
| | | */ |
| | | private String nodeName; |
| | | |
| | | private BigDecimal kgceCount; |
| | | |
| | | private BigDecimal kgceTonCount; |
| | | |
| | | List<HomeEnergyStatisticsVO> energyItemList; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FactoryEnergyConsumptionVo { |
| | | /** |
| | | * æ¬æç»¼åè½è |
| | | */ |
| | | private BigDecimal monthConsumption; |
| | | /** |
| | | * è½èè´¹ç¨ |
| | | */ |
| | | private BigDecimal monthEnergyAmount; |
| | | |
| | | /** |
| | | * ç¢³ææ¾ |
| | | */ |
| | | private BigDecimal cEmission; |
| | | |
| | | /** |
| | | * ç¨è½å®æææ |
| | | */ |
| | | private BigDecimal useEnergyIndex; |
| | | |
| | | /** |
| | | * åååºæ°æ® |
| | | * |
| | | */ |
| | | private List<FactoryEnergyConsumptionItemVo> itemVoList; |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.energydata.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class PurchaseConsumptionVo { |
| | | |
| | | /** |
| | | * è½æºç±»åç¼å· |
| | | */ |
| | | private String energyNo; |
| | | /** |
| | | * è½æºç±»ååç§° |
| | | */ |
| | | private String energyName; |
| | | |
| | | /** |
| | | * è½æºåä½ |
| | | */ |
| | | private String energyUnit; |
| | | |
| | | /** |
| | | * è´å
¥ææ¬ |
| | | */ |
| | | private BigDecimal purchaseSum; |
| | | |
| | | /** |
| | | * æ¶èææ¬ |
| | | */ |
| | | private BigDecimal consumptionSum; |
| | | } |
| | |
| | | private String installLocation; |
| | | |
| | | /** ipå°å */ |
| | | @Excel(name = "ipå°å") |
| | | @Excel(name = "IPå°å") |
| | | private String ipAdd; |
| | | |
| | | /** è¿è¡ç¶æï¼æªç¥ã离线ãå¨çº¿ */ |
| | |
| | | |
| | | /** å¿è·³æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "å¿è·³æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | // @Excel(name = "å¿è·³æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date hbtTime; |
| | | |
| | | /** 计éå¨å
·æ°é */ |
| | |
| | | final List<ElectricityDataItem> electricityDataItems = electricityDataMap.get(vo.getTimeType()); |
| | | if(null != electricityDataItems) { |
| | | final double sum = electricityDataItems.stream().map(ElectricityDataItem::getElectricity).mapToDouble(BigDecimal::doubleValue).sum(); |
| | | vo.setCount(sum); |
| | | vo.setCount(format2Double(sum)); |
| | | if(totalElectric != 0) { |
| | | vo.setPercentage(format2Double(sum / totalElectric * 100)); |
| | | } |
| | |
| | | } |
| | | }); |
| | | List<String> indexIds = nodeIndexInforList.stream().filter(l -> StringUtils.isNotEmpty(l.getIndexId())).map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | // Date queryTime = new Date(); |
| | | Date queryTime = DateUtil.parseDateTime("2023-03-28 00:00:00"); |
| | | Date queryTime = new Date(); |
| | | // Date queryTime = DateUtil.parseDateTime("2023-03-28 00:00:00"); |
| | | Date beginTime; |
| | | Date endTime; |
| | | String shixuTimeType; |
| | |
| | | int insertNodeIndex(@Param("nodeId")String nodeId, @Param("indexId")String indexId); |
| | | |
| | | Page<EnergyIndex> selectEnergyIndexPage(@Param("page")Page<?> page, @Param("query") EnergyIndexQuery energyIndexQuery); |
| | | |
| | | List<EnergyIndex> getIndexByCode(@Param("code")String code, @Param("nodeId")String nodeId); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<EnergyIndex> getIndexByCode(String code, String nodeId) { |
| | | final List<MeterImplement> settingDevice = modelNodeMapper.getSettingDevice(nodeId); |
| | | if(CollectionUtils.isEmpty(settingDevice)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | final List<String> deviceIds = settingDevice.stream().map(MeterImplement::getId).collect(Collectors.toList()); |
| | | List<EnergyIndex> energyIndexList = energyIndexMapper.getIndexByCode(code,nodeId); |
| | | |
| | | LambdaQueryWrapper<EnergyIndex> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if(StringUtils.isNotEmpty(code)) { |
| | | queryWrapper.like(EnergyIndex::getCode, code).or().like(EnergyIndex::getName, code); |
| | | } |
| | | queryWrapper.in(EnergyIndex::getMeterId,deviceIds); |
| | | return energyIndexMapper.selectList(queryWrapper); |
| | | return energyIndexList; |
| | | } |
| | | } |
| | |
| | | @Excel(name = "æ¶æ®µç»ææ¶é´", width = 30, dateFormat = "HH:mm:ss") |
| | | @NotNull(message = "æ¶æ®µç»ææ¶é´ä¸è½ä¸ºç©º") |
| | | private Date stopTime; |
| | | // @Excel(name = "èå´ç±»ååå
¸å¼cost_range_type") |
| | | // private String rangeType; |
| | | |
| | | /** çµä»· */ |
| | | @Excel(name = "çµä»·") |
| | | @NotEmpty(message = "çµä»·ä¸è½ä¸ºç©º") |
| | | private BigDecimal effecticityPrice; |
| | | |
| | | |
| | | // public String getRangeType() { |
| | | // return rangeType; |
| | | // } |
| | | // |
| | | // public void setRangeType(String rangeType) { |
| | | // this.rangeType = rangeType; |
| | | // } |
| | | |
| | | public void setId(String id) |
| | | { |
| | | this.id = id; |
| | |
| | | @Excel(name = "ç»ææ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | // /** æ¯å¦é¶æ¢¯ä»·æ ¼0å¦1æ¯ */ |
| | | // @Excel(name = "æ¯å¦é¶æ¢¯ä»·æ ¼0å¦1æ¯") |
| | | // private String type; |
| | | // |
| | | // /** çç¥ç¼ç */ |
| | | // @Excel(name = "çç¥ç¼ç ") |
| | | // private String tacticsNumber; |
| | | // |
| | | // /** çç¥åç§° */ |
| | | // @Excel(name = "çç¥åç§°") |
| | | // private String tacticsName; |
| | | // |
| | | // /** è½æºåç§ */ |
| | | // @Excel(name = "è½æºåç§") |
| | | // private Integer energyType; |
| | | |
| | | // public void setType(String type) { |
| | | // this.type = type; |
| | | // } |
| | | // |
| | | // public void setTacticsNumber(String tacticsNumber) { |
| | | // this.tacticsNumber = tacticsNumber; |
| | | // } |
| | | // |
| | | // public void setTacticsName(String tacticsName) { |
| | | // this.tacticsName = tacticsName; |
| | | // } |
| | | // |
| | | // public void setEnergyType(Integer energyType) { |
| | | // this.energyType = energyType; |
| | | // } |
| | | // |
| | | // public String getType() { |
| | | // return type; |
| | | // } |
| | | // |
| | | // public String getTacticsNumber() { |
| | | // return tacticsNumber; |
| | | // } |
| | | // |
| | | // public String getTacticsName() { |
| | | // return tacticsName; |
| | | // } |
| | | // |
| | | // public Integer getEnergyType() { |
| | | // return energyType; |
| | | // } |
| | | |
| | | public void setId(String id) |
| | | { |
| | | this.id = id; |
| | |
| | | package com.zhitan.peakvalley.domain.vo.peakvalley; |
| | | |
| | | import com.zhitan.home.domain.vo.HomeEnergyConsumptionTrendVO; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | |
| | | List<PeakValleyLineChatVO> costList; |
| | | List<PeakValleyLineChatVO> powerConsumptionList; |
| | | PeakValleyDayTotalVO totalVO; |
| | | |
| | | HomeEnergyConsumptionTrendVO costNewList; |
| | | |
| | | HomeEnergyConsumptionTrendVO powerNewList; |
| | | } |
| | |
| | | package com.zhitan.peakvalley.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.costmanagement.domain.vo.ElectricityPriceDateVo; |
| | | import com.zhitan.peakvalley.domain.ElectricityPriceDate; |
| | | |
| | | import java.util.List; |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteElectricityPriceDateByIds(String[] ids); |
| | | |
| | | |
| | | /** |
| | | * åä»·çç¥å表æ¥è¯¢ï¼ä¸åé¡µï¼ |
| | | * |
| | | */ |
| | | List<ElectricityPriceDate> selectElectricityPriceDatePageTacticsAll(); |
| | | } |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteElectricityPriceByIds(String[] ids); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | List<ElectricityDataItem> getDataStatistics(@Param("indexIdSet") Set<String> indexIdSet, @Param("startTime") Date startTime, |
| | | @Param("endTime") Date endTime, @Param("timeType") String timeType); |
| | | |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·ç»è®¡æ°æ®(åå·®åæ) |
| | | * |
| | | * @param indexIdSet ç¹ä½idéå |
| | | * @param timeType æ¶é´ç±»å |
| | | * @return ç»æ |
| | | */ |
| | | List<ElectricityDataItem> getDataStatisticsDeviationAnalysis(@Param("indexIdSet") Set<String> indexIdSet, |
| | | @Param("timeType") String timeType); |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceTacticsVo; |
| | | import com.zhitan.costmanagement.domain.vo.ElectricityPriceDateVo; |
| | | import com.zhitan.peakvalley.domain.ElectricityPriceDate; |
| | | |
| | | import java.util.List; |
| | |
| | | public int deleteElectricityPriceDateById(String id); |
| | | |
| | | Page<ElectricityPriceDate> selectElectricityPriceDatePage(ElectricityPriceDate electricityPriceDate, Long pageNum, Long pageSize); |
| | | |
| | | |
| | | |
| | | // /** |
| | | // * åä»·çç¥å表æ¥è¯¢ |
| | | // * |
| | | // */ |
| | | // Page<ElectricityPriceDateVo> selectElectricityPriceDatePageTactics(ElectricityPriceDate electricityPriceDate, Long pageNum, Long pageSize); |
| | | |
| | | // /** |
| | | // * åä»·çç¥å表æ¥è¯¢ï¼ä¸åé¡µï¼ |
| | | // * |
| | | // */ |
| | | // List<ElectricityPriceDate> selectElectricityPriceDatePageTacticsAll(); |
| | | // |
| | | // /** |
| | | // * æ¥è¯¢ææ¬çç¥ |
| | | // * |
| | | // * @param id ææ¬çç¥ä¸»é® |
| | | // * @return ææ¬çç¥ |
| | | // */ |
| | | // public ElectricityPriceDateVo selectCostPriceTacticsById(String id); |
| | | // /** |
| | | // * æ°å¢ææ¬çç¥ |
| | | // * |
| | | // * @param electricityPriceDateVo ææ¬çç¥ |
| | | // * @return ç»æ |
| | | // */ |
| | | // public int insertCostPriceTactics(ElectricityPriceDateVo electricityPriceDateVo) throws Exception; |
| | | // |
| | | // /** |
| | | // * ä¿®æ¹ææ¬çç¥ |
| | | // * |
| | | // * @param electricityPriceDateVo ææ¬çç¥ |
| | | // * @return ç»æ |
| | | // */ |
| | | // public int updateCostPriceTactics(ElectricityPriceDateVo electricityPriceDateVo); |
| | | // |
| | | // /** |
| | | // * æ¹éå 餿æ¬çç¥ |
| | | // * |
| | | // * @param ids éè¦å é¤çææ¬çç¥ä¸»é®éå |
| | | // * @return ç»æ |
| | | // */ |
| | | // public int deleteCostPriceTacticsByIds(String[] ids); |
| | | // |
| | | // /** |
| | | // * å 餿æ¬çç¥ä¿¡æ¯ |
| | | // * |
| | | // * @param id ææ¬çç¥ä¸»é® |
| | | // * @return ç»æ |
| | | // */ |
| | | // public int deleteCostPriceTacticsById(String id); |
| | | |
| | | } |
| | |
| | | PeakValleyHourVO segmentAnalysisHour(PeakValleyDTO dto); |
| | | |
| | | List<PeakValleyHourDataVO> segmentAnalysisHourExport(PeakValleyDTO dto); |
| | | |
| | | PeakValleyDayVO segmentAnalysisDayCustomize(PeakValleyDTO dto); |
| | | } |
| | |
| | | package com.zhitan.peakvalley.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.uuid.UUID; |
| | | import com.zhitan.costmanagement.domain.CostPriceTactics; |
| | | import com.zhitan.costmanagement.domain.CostPriceTacticsItem; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceTacticsVo; |
| | | import com.zhitan.costmanagement.domain.vo.ElectricityPriceDateVo; |
| | | import com.zhitan.peakvalley.domain.ElectricityPrice; |
| | | import com.zhitan.peakvalley.domain.ElectricityPriceDate; |
| | | import com.zhitan.peakvalley.mapper.ElectricityPriceDateMapper; |
| | | import com.zhitan.peakvalley.mapper.ElectricityPriceMapper; |
| | | import com.zhitan.peakvalley.service.IElectricityPriceDateService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·çµä»·æ¶é´æ®µServiceä¸å¡å±å¤ç |
| | |
| | | public class ElectricityPriceDateServiceImpl extends ServiceImpl<ElectricityPriceDateMapper, ElectricityPriceDate> implements IElectricityPriceDateService { |
| | | @Autowired |
| | | private ElectricityPriceDateMapper electricityPriceDateMapper; |
| | | @Autowired |
| | | private ElectricityPriceMapper electricityPriceMapper; |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·çµä»·æ¶é´æ®µ |
| | |
| | | Page<ElectricityPriceDate> page = electricityPriceDateMapper.selectPage(new Page<ElectricityPriceDate>(pageNum, pageSize), wrapper); |
| | | return page; |
| | | } |
| | | |
| | | // @Override |
| | | // public Page<ElectricityPriceDateVo> selectElectricityPriceDatePageTactics(ElectricityPriceDate electricityPriceDate, Long pageNum, Long pageSize) { |
| | | // LambdaQueryWrapper<ElectricityPriceDate> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.like(StringUtils.isNotEmpty(electricityPriceDate.getTacticsName()),ElectricityPriceDate::getTacticsName,electricityPriceDate.getTacticsName()); |
| | | // queryWrapper.like(StringUtils.isNotEmpty(electricityPriceDate.getTacticsNumber()),ElectricityPriceDate::getTacticsNumber,electricityPriceDate.getTacticsNumber()); |
| | | // |
| | | // queryWrapper.eq(StringUtils.isNotEmpty(electricityPriceDate.getType()),ElectricityPriceDate::getType,electricityPriceDate.getType()); |
| | | // queryWrapper.orderByDesc(ElectricityPriceDate::getCreateTime); |
| | | // Page<ElectricityPriceDate> page = electricityPriceDateMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | // IPage aa = page.convert(s->{ |
| | | // ElectricityPriceDateVo v = new ElectricityPriceDateVo(); |
| | | // BeanUtil.copyProperties(s, v); |
| | | // LambdaQueryWrapper<ElectricityPrice> queryWrapperItem = new LambdaQueryWrapper<>(); |
| | | // queryWrapperItem.eq(ElectricityPrice::getParentId,s.getId()); |
| | | // List<ElectricityPrice> itemListOld = electricityPriceMapper.selectList(queryWrapperItem); |
| | | // v.setItemList(itemListOld); |
| | | // return v; |
| | | // }); |
| | | // |
| | | // return (Page<ElectricityPriceDateVo>) aa; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public List<ElectricityPriceDate> selectElectricityPriceDatePageTacticsAll() { |
| | | // return electricityPriceDateMapper.selectElectricityPriceDatePageTacticsAll(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public ElectricityPriceDateVo selectCostPriceTacticsById(String id) { |
| | | // ElectricityPriceDateVo result = new ElectricityPriceDateVo(); |
| | | // ElectricityPriceDate info = electricityPriceDateMapper.selectElectricityPriceDateById(id); |
| | | // BeanUtil.copyProperties(info,result); |
| | | // LambdaQueryWrapper<ElectricityPrice> queryWrapperItem = new LambdaQueryWrapper<>(); |
| | | // queryWrapperItem.eq(ElectricityPrice::getParentId,id); |
| | | // List<ElectricityPrice> itemListOld = electricityPriceMapper.selectList(queryWrapperItem); |
| | | // result.setItemList(itemListOld); |
| | | // return result ; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int insertCostPriceTactics(ElectricityPriceDateVo electricityPriceDateVo) throws Exception { |
| | | // ElectricityPriceDate search = electricityPriceDateMapper.selectOne(new QueryWrapper<ElectricityPriceDate>().eq("tactics_number",electricityPriceDateVo.getTacticsNumber())); |
| | | // if (search!=null){ |
| | | // throw new Exception("该çç¥ç¼ç å·²åå¨ï¼"); |
| | | // } |
| | | // electricityPriceDateVo.setCreateTime(DateUtils.getNowDate()); |
| | | // electricityPriceDateVo.setId(java.util.UUID.randomUUID().toString()); |
| | | // ElectricityPriceDate electricityPriceDate = new ElectricityPriceDate(); |
| | | // BeanUtil.copyProperties(electricityPriceDateVo,electricityPriceDate); |
| | | // int result = electricityPriceDateMapper.insert(electricityPriceDate); |
| | | // //æå
¥å表 |
| | | // List<ElectricityPrice> itemList = electricityPriceDateVo.getItemList(); |
| | | // itemList.stream().forEach(s->{ |
| | | // s.setId(java.util.UUID.randomUUID().toString()); |
| | | // s.setCreateTime(DateUtils.getNowDate()); |
| | | // s.setCreateBy(electricityPriceDateVo.getCreateBy()); |
| | | // s.setParentId(electricityPriceDateVo.getId()); |
| | | // electricityPriceMapper.insert(s); |
| | | // }); |
| | | // |
| | | // return result; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int updateCostPriceTactics(ElectricityPriceDateVo electricityPriceDateVo) { |
| | | // electricityPriceDateVo.setUpdateTime(DateUtils.getNowDate()); |
| | | // ElectricityPriceDate electricityPriceDate = new ElectricityPriceDate(); |
| | | // BeanUtil.copyProperties(electricityPriceDateVo,electricityPriceDate); |
| | | // int result = electricityPriceDateMapper.updateElectricityPriceDate(electricityPriceDate); |
| | | // //å é¤å表 |
| | | // LambdaQueryWrapper<ElectricityPrice> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(ElectricityPrice::getParentId,electricityPriceDate.getId()); |
| | | // List<ElectricityPrice> itemListOld = electricityPriceMapper.selectList(queryWrapper); |
| | | // List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | // String[] ids = idList.toArray(new String[idList.size()]); |
| | | // electricityPriceMapper.deleteElectricityPriceByIds(ids); |
| | | // //æå
¥å表 |
| | | // List<ElectricityPrice> itemList = electricityPriceDateVo.getItemList(); |
| | | // itemList.stream().forEach(s->{ |
| | | // s.setId(java.util.UUID.randomUUID().toString()); |
| | | // s.setCreateTime(DateUtils.getNowDate()); |
| | | // s.setCreateBy(electricityPriceDateVo.getCreateBy()); |
| | | // s.setParentId(electricityPriceDateVo.getId()); |
| | | // electricityPriceMapper.insert(s); |
| | | // }); |
| | | // return result; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int deleteCostPriceTacticsByIds(String[] ids) { |
| | | // //å é¤å表 |
| | | // List<String> list = Arrays.asList(ids); |
| | | // list.stream().forEach(item->{ |
| | | // LambdaQueryWrapper<ElectricityPrice> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(ElectricityPrice::getParentId,item); |
| | | // List<ElectricityPrice> itemListOld = electricityPriceMapper.selectList(queryWrapper); |
| | | // List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | // String[] itemIds = idList.toArray(new String[idList.size()]); |
| | | // electricityPriceMapper.deleteElectricityPriceByIds(itemIds); |
| | | // }); |
| | | // |
| | | // return electricityPriceDateMapper.deleteElectricityPriceDateByIds(ids); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public int deleteCostPriceTacticsById(String id) { |
| | | // LambdaQueryWrapper<ElectricityPrice> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.eq(ElectricityPrice::getParentId,id); |
| | | // List<ElectricityPrice> itemListOld = electricityPriceMapper.selectList(queryWrapper); |
| | | // List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | // String[] itemIds = idList.toArray(new String[idList.size()]); |
| | | // electricityPriceMapper.deleteElectricityPriceByIds(itemIds); |
| | | // return electricityPriceDateMapper.deleteElectricityPriceDateById(id); |
| | | // } |
| | | } |
| | |
| | | import com.zhitan.common.enums.ElectricityTypeEnum; |
| | | import com.zhitan.common.enums.TimeType; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.costmanagement.domain.vo.CostPriceRelevancyVo; |
| | | import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.mapper.ModelNodeMapper; |
| | | import com.zhitan.peakvalley.domain.ElectricityDataItem; |
| | |
| | | private ModelNodeMapper modelNodeMapper; |
| | | @Resource |
| | | private PeakValleyMapper electricityDataItemMapper; |
| | | |
| | | @Resource |
| | | CostPriceRelevancyMapper costPriceRelevancyMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç»è®¡æ°æ® |
| | |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | // CostPriceRelevancyVo voD = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.DEEP.name()); |
| | | // if(voV!=null){ |
| | | // DeepFee = voV.getPrice().multiply(valleyPower); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyDayDataVO peakAndValleyReportVO = new PeakValleyDayDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | |
| | | AtomicReference<BigDecimal> tipCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> troughCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | AtomicReference<BigDecimal> peakCount = new AtomicReference<>(BigDecimal.ZERO); |
| | | |
| | | |
| | | reportVOList.stream().forEach(r->{ |
| | | PeakValleyLineChatVO costVO = new PeakValleyLineChatVO(); |
| | | PeakValleyLineChatVO powerConsumptionVO = new PeakValleyLineChatVO(); |
| | | |
| | | |
| | | /** |
| | | * ç¨çµé |
| | | */ |
| | |
| | | peakFreeCount.set(peakFreeCount.get().add(r.getPeakFee())); |
| | | }); |
| | | |
| | | peakValleyDayTotalVO.setPeakPowerCost(peakFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setPeakPowerCost(peakFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setPeakPowerConsumption(peakCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerCost(flatFreeCount.get().doubleValue()); |
| | | peakValleyDayTotalVO.setFlatPowerConsumption(flatCount.get().doubleValue()); |
| | |
| | | peakValleyDayTotalVO.setTipPowerCostProportion(0); |
| | | peakValleyDayTotalVO.setTroughPowerCostProportion(0); |
| | | } |
| | | |
| | | peakValleyDayTotalVO.setTotalCost(powerTotal.doubleValue()); |
| | | peakValleyDayTotalVO.setTotalPowerConsumption(freeTotal.doubleValue()); |
| | | |
| | | // peakValleyDayTotalVO.setTotalCost(powerTotal.doubleValue()); |
| | | // peakValleyDayTotalVO.setTotalPowerConsumption(freeTotal.doubleValue()); |
| | | peakValleyDayTotalVO.setTotalCost(freeTotal.doubleValue()); |
| | | peakValleyDayTotalVO.setTotalPowerConsumption(powerTotal.doubleValue()); |
| | | peakValleyVO.setTotalVO(peakValleyDayTotalVO); |
| | | peakValleyVO.setCostList(costList); |
| | | peakValleyVO.setPowerConsumptionList(powerConsumptionList); |
| | | |
| | | |
| | | return peakValleyVO; |
| | | } |
| | | |
| | |
| | | String electricityType = electricityDataItem.getElectricityType(); |
| | | |
| | | if (ElectricityTypeEnum.SHARP.name().equals(electricityType)) { |
| | | sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | // sharpFee = sharpFee.add(electricityDataItem.getCost()); |
| | | sharpPower = sharpPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.PEAK.name().equals(electricityType)) { |
| | | peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | // peakFee = peakFee.add(electricityDataItem.getCost()); |
| | | peakPower = peakPower.add(electricityDataItem.getElectricity()); |
| | | } else if (ElectricityTypeEnum.FLAT.name().equals(electricityType)) { |
| | | flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | // flatFee = flatFee.add(electricityDataItem.getCost()); |
| | | flatPower = flatPower.add(electricityDataItem.getElectricity()); |
| | | } else { |
| | | valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | // valleyFee = valleyFee.add(electricityDataItem.getCost()); |
| | | valleyPower = valleyPower.add(electricityDataItem.getElectricity()); |
| | | } |
| | | } |
| | | //2024-11-12æ°å¢ |
| | | CostPriceRelevancyVo voS = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.SHARP.name()); |
| | | if(voS!=null){ |
| | | sharpFee = voS.getPrice().multiply(sharpPower); |
| | | } |
| | | CostPriceRelevancyVo voP = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.PEAK.name()); |
| | | if(voP!=null){ |
| | | peakFee = voP.getPrice().multiply(peakPower); |
| | | } |
| | | CostPriceRelevancyVo voF = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(),ElectricityTypeEnum.FLAT.name()); |
| | | if(voF!=null){ |
| | | flatFee = voF.getPrice().multiply(flatPower); |
| | | } |
| | | CostPriceRelevancyVo voV = costPriceRelevancyMapper.selectCostPriceRelevancyByNodeId(dto.getNodeId(), ElectricityTypeEnum.VALLEY.name()); |
| | | if(voV!=null){ |
| | | valleyFee = voV.getPrice().multiply(valleyPower); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | PeakValleyHourDataVO peakAndValleyReportVO = new PeakValleyHourDataVO(startTime, sharpFee, sharpPower, |
| | | peakFee, peakPower, flatFee, flatPower, valleyFee, valleyPower); |
| | |
| | | |
| | | return reportVOList; |
| | | } |
| | | |
| | | @Override |
| | | public PeakValleyDayVO segmentAnalysisDayCustomize(PeakValleyDTO dto) { |
| | | return null; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.powerDistribution.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * é
çµå®¤å®ä½ç±» |
| | | */ |
| | | @Data |
| | | @TableName("power_distribution") |
| | | public class PowerDistribution extends BaseEntity { |
| | | |
| | | @TableId |
| | | private String id; |
| | | |
| | | /** |
| | | * åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * ç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * è´è´£äºº |
| | | */ |
| | | private String principals; |
| | | |
| | | /** |
| | | * è´è´£äººçµè¯ |
| | | */ |
| | | private String principalsTel; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.powerDistribution.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.powerDistribution.domain.PowerDistribution; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PowerDistributionMapper extends BaseMapper<PowerDistribution> { |
| | | |
| | | int deletePowerDistributionByIds(@Param("ids") List<String> ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.powerDistribution.services; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zhitan.powerDistribution.domain.PowerDistribution; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IPowerDistributionService extends IService<PowerDistribution> { |
| | | List<PowerDistribution> selectPowerDistributionList(PowerDistribution powerDistribution); |
| | | |
| | | IPage<PowerDistribution> pageList(PowerDistribution powerDistribution, Page<PowerDistribution> page); |
| | | |
| | | int deleteByIds(List<String> ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.powerDistribution.services.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zhitan.basicdata.domain.MeterImplement; |
| | | import com.zhitan.basicdata.mapper.MeterImplementMapper; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.powerDistribution.domain.PowerDistribution; |
| | | import com.zhitan.powerDistribution.mapper.PowerDistributionMapper; |
| | | import com.zhitan.powerDistribution.services.IPowerDistributionService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class PowerDistributionServiceImpl extends ServiceImpl<PowerDistributionMapper, PowerDistribution> implements IPowerDistributionService { |
| | | |
| | | @Resource |
| | | private MeterImplementMapper meterImplementMapper; |
| | | |
| | | @Override |
| | | public List<PowerDistribution> selectPowerDistributionList(PowerDistribution powerDistribution) { |
| | | LambdaQueryWrapper<PowerDistribution> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if(StringUtils.isNotEmpty(powerDistribution.getCode())){ |
| | | queryWrapper.like(PowerDistribution::getCode, powerDistribution.getCode()); |
| | | } |
| | | if (StringUtils.isNotEmpty(powerDistribution.getName())){ |
| | | queryWrapper.like(PowerDistribution::getName, powerDistribution.getName()); |
| | | } |
| | | if (StringUtils.isNotEmpty(powerDistribution.getPrincipals())){ |
| | | queryWrapper.like(PowerDistribution::getPrincipals, powerDistribution.getPrincipals()); |
| | | } |
| | | if (StringUtils.isNotEmpty(powerDistribution.getPrincipalsTel())){ |
| | | queryWrapper.like(PowerDistribution::getPrincipalsTel, powerDistribution.getPrincipalsTel()); |
| | | } |
| | | return list(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Page<PowerDistribution> pageList(PowerDistribution powerDistribution, Page<PowerDistribution> page) { |
| | | LambdaQueryWrapper<PowerDistribution> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if(StringUtils.isNotEmpty(powerDistribution.getCode())){ |
| | | queryWrapper.like(PowerDistribution::getCode, powerDistribution.getCode()); |
| | | } |
| | | if (StringUtils.isNotEmpty(powerDistribution.getName())){ |
| | | queryWrapper.like(PowerDistribution::getName, powerDistribution.getName()); |
| | | } |
| | | if (StringUtils.isNotEmpty(powerDistribution.getPrincipals())){ |
| | | queryWrapper.like(PowerDistribution::getPrincipals, powerDistribution.getPrincipals()); |
| | | } |
| | | if (StringUtils.isNotEmpty(powerDistribution.getPrincipalsTel())){ |
| | | queryWrapper.like(PowerDistribution::getPrincipalsTel, powerDistribution.getPrincipalsTel()); |
| | | } |
| | | return page(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteByIds(List<String> idList) { |
| | | return baseMapper.deletePowerDistributionByIds(idList); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.singlelogin.service; |
| | | |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | |
| | | /** |
| | | * description todu |
| | | * |
| | | * @author hmj |
| | | * @date 2024-11-15 17:08 |
| | | */ |
| | | public interface ISingleLoginService { |
| | | SysUser singleLogin(String token); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.singlelogin.service.impl; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.google.common.collect.Lists; |
| | | import com.zhitan.common.core.domain.entity.SysRole; |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | import com.zhitan.common.utils.SecurityUtils; |
| | | import com.zhitan.singlelogin.service.ISingleLoginService; |
| | | import com.zhitan.system.domain.SysUserRole; |
| | | import com.zhitan.system.mapper.SysUserRoleMapper; |
| | | import com.zhitan.system.service.ISysRoleService; |
| | | import com.zhitan.system.service.ISysUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * description todu |
| | | * |
| | | * @author hmj |
| | | * @date 2024-11-15 17:10 |
| | | */ |
| | | @Component |
| | | public class SingleLoginServiceImpl implements ISingleLoginService { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(SingleLoginServiceImpl.class); |
| | | |
| | | @Value("${singleLoginUrl}") |
| | | private String singleLoginUrl; |
| | | |
| | | @Resource |
| | | private ISysUserService userService; |
| | | |
| | | @Resource |
| | | private ISysRoleService roleService; |
| | | |
| | | @Resource |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Override |
| | | public SysUser singleLogin(String token) { |
| | | JSONObject jsonObject = checkToken(token); |
| | | log.info("请æ±ç»¼åæ²»ç" + jsonObject.toString()); |
| | | if(jsonObject.containsKey("code") && jsonObject.getInt("code") == 200) { |
| | | |
| | | final SysUser user = JSONUtil.toBean(jsonObject.getJSONObject("user"), SysUser.class); |
| | | |
| | | user.setSingleUser(String.valueOf(user.getUserId())); |
| | | user.setUserId(null); |
| | | //æ£æµä¸ä¸ç¨æ·åå¨ä¸åå¨ |
| | | Long count = userService.checkThirdUserExist(user); |
| | | if (count > 0 ) { |
| | | return user; |
| | | } else { |
| | | //ç¨æ·ä¸å卿¶ï¼å°ç¨æ·æ·»å å°æ°æ®åºä¸ |
| | | //å¯ç ç»ä¸é½æ¯hrd123456 |
| | | user.setPassword(SecurityUtils.encryptPassword("hrd123456")); |
| | | //å建è
ï¼æ è¯Jå¹³å°è¿æ¥çç¨æ· |
| | | user.setCreateBy("thirdPartGetAuth"); |
| | | //åå»ºæ¥æ |
| | | user.setCreateTime(new Date()); |
| | | |
| | | int rows = userService.insertUser(user); |
| | | if (rows > 0) { |
| | | SysRole queryRole = new SysRole(); |
| | | queryRole.setRoleKey("zonghezhili"); |
| | | SysRole sysRoles = roleService.getRoleByKey(queryRole); |
| | | if(null != sysRoles){ |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setUserId(user.getUserId()); |
| | | sysUserRole.setRoleId(sysRoles.getRoleId()); |
| | | userRoleMapper.batchUserRole(Lists.newArrayList(sysUserRole)); |
| | | } |
| | | } |
| | | return user; |
| | | } |
| | | }else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * éè¿ç¬¬ä¸æ¹å¹³å°æ¥å£ï¼é´å®tokenåæ³æ§ï¼å¹¶è¿åuserNameçç»å½ä¿¡æ¯ |
| | | * è¿ä¸ªæ¹æ³éè¦æ ¹æ®å®é
éè¦è¿è¡ä¿®æ¹ |
| | | * @param token |
| | | * @return |
| | | */ |
| | | public JSONObject checkToken(String token) { |
| | | |
| | | String result = HttpRequest.get(singleLoginUrl) |
| | | .header("Authorization","Bearer " + token) |
| | | .execute() |
| | | .body(); |
| | | JSONObject parseObj = JSONUtil.parseObj(result); |
| | | return parseObj; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ã对象 spikes_and_valleys_item |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | @TableName("spikes_and_valleys_item") |
| | | @Data |
| | | public class SpikesAndValleysItem extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | private String id; |
| | | |
| | | /** æ¶æ®µ:å°å³°å¹³è°·åå
¸å¼1å°2å³°3å¹³4è°· */ |
| | | @Excel(name = "æ¶æ®µ:å°å³°å¹³è°·åå
¸å¼1å°2å³°3å¹³4è°·") |
| | | private String time; |
| | | |
| | | /** çµè´¹ */ |
| | | @Excel(name = "çµè´¹") |
| | | private BigDecimal electrovalency; |
| | | |
| | | /** å¼å§æ¶é´ */ |
| | | @Excel(name = "å¼å§æ¶é´") |
| | | private String startTime; |
| | | |
| | | /** ç»ææ¶é´ */ |
| | | @Excel(name = "ç»ææ¶é´") |
| | | private String endTime; |
| | | |
| | | /** $column.columnComment */ |
| | | @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
| | | private String schemeId; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.domain; |
| | | |
| | | import java.util.Date; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ¶é´æ®µæç»å¯¹è±¡ spikes_and_valleys_scheme |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | @TableName("spikes_and_valleys_scheme") |
| | | public class SpikesAndValleysScheme extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** $column.columnComment */ |
| | | private String id; |
| | | |
| | | /** æ¹æ¡åç§° */ |
| | | @Excel(name = "æ¹æ¡åç§°") |
| | | private String schemeName; |
| | | |
| | | /** æ§è¡æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @Excel(name = "æ§è¡æ¶é´", width = 30, dateFormat = "yyyy-MM-dd") |
| | | private Date executeTime; |
| | | |
| | | /** æ¹æ¡ç±»å1é»è®¤2åå¤3å¤é¨ */ |
| | | @Excel(name = "æ¹æ¡ç±»å1é»è®¤2åå¤3å¤é¨") |
| | | private String type; |
| | | |
| | | |
| | | public void setId(String id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setSchemeName(String schemeName) |
| | | { |
| | | this.schemeName = schemeName; |
| | | } |
| | | |
| | | public String getSchemeName() |
| | | { |
| | | return schemeName; |
| | | } |
| | | |
| | | public void setExecuteTime(Date executeTime) |
| | | { |
| | | this.executeTime = executeTime; |
| | | } |
| | | |
| | | public Date getExecuteTime() |
| | | { |
| | | return executeTime; |
| | | } |
| | | |
| | | public void setType(String type) |
| | | { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getType() |
| | | { |
| | | return type; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("remark", getRemark()) |
| | | .append("schemeName", getSchemeName()) |
| | | .append("executeTime", getExecuteTime()) |
| | | .append("type", getType()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.domain.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysItem; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ¶é´æ®µæç»å¯¹è±¡ spikes_and_valleys_scheme |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | @Data |
| | | public class SpikesAndValleysSchemeVo extends SpikesAndValleysScheme { |
| | | List<SpikesAndValleysItem> itemList; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysItem; |
| | | |
| | | |
| | | /** |
| | | * ã请填ååè½åç§°ãMapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | public interface SpikesAndValleysItemMapper extends BaseMapper<SpikesAndValleysItem> { |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ã请填ååè½åç§°ã |
| | | */ |
| | | public SpikesAndValleysItem selectSpikesAndValleysItemById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢ã请填ååè½åç§°ãå表 |
| | | * |
| | | * @param spikesAndValleysItem ã请填ååè½åç§°ã |
| | | * @return ã请填ååè½åç§°ãéå |
| | | */ |
| | | public List<SpikesAndValleysItem> selectSpikesAndValleysItemList(SpikesAndValleysItem spikesAndValleysItem); |
| | | |
| | | /** |
| | | * æ°å¢ã请填ååè½åç§°ã |
| | | * |
| | | * @param spikesAndValleysItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSpikesAndValleysItem(SpikesAndValleysItem spikesAndValleysItem); |
| | | |
| | | /** |
| | | * ä¿®æ¹ã请填ååè½åç§°ã |
| | | * |
| | | * @param spikesAndValleysItem ã请填ååè½åç§°ã |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSpikesAndValleysItem(SpikesAndValleysItem spikesAndValleysItem); |
| | | |
| | | /** |
| | | * å é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param id ã请填ååè½åç§°ãä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSpikesAndValleysItemById(String id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ã请填ååè½åç§°ã |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSpikesAndValleysItemByIds(String[] ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.mapper; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ¶é´æ®µæç»Mapperæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | public interface SpikesAndValleysSchemeMapper extends BaseMapper<SpikesAndValleysScheme> { |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param id å°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | public SpikesAndValleysScheme selectSpikesAndValleysSchemeById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç»å表 |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return å°å³°å¹³è°·æ¶é´æ®µæç»éå |
| | | */ |
| | | public List<SpikesAndValleysScheme> selectSpikesAndValleysSchemeList(SpikesAndValleysScheme spikesAndValleysScheme); |
| | | |
| | | /** |
| | | * æ°å¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSpikesAndValleysScheme(SpikesAndValleysScheme spikesAndValleysScheme); |
| | | |
| | | /** |
| | | * ä¿®æ¹å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSpikesAndValleysScheme(SpikesAndValleysScheme spikesAndValleysScheme); |
| | | |
| | | /** |
| | | * å é¤å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param id å°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSpikesAndValleysSchemeById(String id); |
| | | |
| | | /** |
| | | * æ¹éå é¤å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSpikesAndValleysSchemeByIds(String[] ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zhitan.alarm.domain.LimitType; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | import com.zhitan.spikesandvalleys.domain.vo.SpikesAndValleysSchemeVo; |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ¶é´æ®µæç»Serviceæ¥å£ |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | public interface ISpikesAndValleysSchemeService extends IService<SpikesAndValleysScheme> { |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param id å°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | public SpikesAndValleysSchemeVo selectSpikesAndValleysSchemeById(String id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç»å表 |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return å°å³°å¹³è°·æ¶é´æ®µæç»éå |
| | | */ |
| | | public Page<SpikesAndValleysSchemeVo> selectSpikesAndValleysSchemeList(SpikesAndValleysScheme spikesAndValleysScheme, Long pageNum, Long pageSize); |
| | | |
| | | /** |
| | | * æ°å¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return ç»æ |
| | | */ |
| | | public int insertSpikesAndValleysScheme(SpikesAndValleysSchemeVo spikesAndValleysScheme); |
| | | |
| | | /** |
| | | * ä¿®æ¹å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return ç»æ |
| | | */ |
| | | public int updateSpikesAndValleysScheme(SpikesAndValleysSchemeVo spikesAndValleysScheme); |
| | | |
| | | /** |
| | | * æ¹éå é¤å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param ids éè¦å é¤çå°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSpikesAndValleysSchemeByIds(String[] ids); |
| | | |
| | | /** |
| | | * å é¤å°å³°å¹³è°·æ¶é´æ®µæç»ä¿¡æ¯ |
| | | * |
| | | * @param id å°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteSpikesAndValleysSchemeById(String id); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.zhitan.spikesandvalleys.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.zhitan.alarm.domain.LimitType; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysItem; |
| | | import com.zhitan.spikesandvalleys.domain.SpikesAndValleysScheme; |
| | | import com.zhitan.spikesandvalleys.domain.vo.SpikesAndValleysSchemeVo; |
| | | import com.zhitan.spikesandvalleys.mapper.SpikesAndValleysItemMapper; |
| | | import com.zhitan.spikesandvalleys.mapper.SpikesAndValleysSchemeMapper; |
| | | import com.zhitan.spikesandvalleys.service.ISpikesAndValleysSchemeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | |
| | | /** |
| | | * å°å³°å¹³è°·æ¶é´æ®µæç»Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author ZhiTan |
| | | * @date 2024-10-29 |
| | | */ |
| | | @Service |
| | | public class SpikesAndValleysSchemeServiceImpl extends ServiceImpl<SpikesAndValleysSchemeMapper, SpikesAndValleysScheme> implements ISpikesAndValleysSchemeService { |
| | | @Autowired |
| | | private SpikesAndValleysSchemeMapper spikesAndValleysSchemeMapper; |
| | | @Autowired |
| | | private SpikesAndValleysItemMapper spikesAndValleysItemMapper; |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param id å°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | @Override |
| | | public SpikesAndValleysSchemeVo selectSpikesAndValleysSchemeById(String id) { |
| | | SpikesAndValleysSchemeVo result = new SpikesAndValleysSchemeVo(); |
| | | SpikesAndValleysScheme info = spikesAndValleysSchemeMapper.selectSpikesAndValleysSchemeById(id); |
| | | BeanUtil.copyProperties(info,result); |
| | | LambdaQueryWrapper<SpikesAndValleysItem> queryWrapperItem = new LambdaQueryWrapper<>(); |
| | | queryWrapperItem.eq(SpikesAndValleysItem::getSchemeId,id); |
| | | List<SpikesAndValleysItem> itemListOld = spikesAndValleysItemMapper.selectList(queryWrapperItem); |
| | | result.setItemList(itemListOld); |
| | | return result ; |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å°å³°å¹³è°·æ¶é´æ®µæç»å表 |
| | | * |
| | | * @param spikesAndValleysScheme å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | */ |
| | | @Override |
| | | public Page<SpikesAndValleysSchemeVo> selectSpikesAndValleysSchemeList(SpikesAndValleysScheme spikesAndValleysScheme,Long pageNum, Long pageSize) { |
| | | |
| | | LambdaQueryWrapper<SpikesAndValleysScheme> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(spikesAndValleysScheme.getSchemeName()),SpikesAndValleysScheme::getSchemeName,spikesAndValleysScheme.getSchemeName()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(spikesAndValleysScheme.getType()),SpikesAndValleysScheme::getType,spikesAndValleysScheme.getType()); |
| | | queryWrapper.orderByDesc(SpikesAndValleysScheme::getCreateTime); |
| | | Page<SpikesAndValleysScheme> page = spikesAndValleysSchemeMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | IPage aa = page.convert(s->{ |
| | | SpikesAndValleysSchemeVo v = new SpikesAndValleysSchemeVo(); |
| | | BeanUtil.copyProperties(s, v); |
| | | LambdaQueryWrapper<SpikesAndValleysItem> queryWrapperItem = new LambdaQueryWrapper<>(); |
| | | queryWrapperItem.eq(SpikesAndValleysItem::getSchemeId,s.getId()); |
| | | List<SpikesAndValleysItem> itemListOld = spikesAndValleysItemMapper.selectList(queryWrapperItem); |
| | | v.setItemList(itemListOld); |
| | | return v; |
| | | }); |
| | | |
| | | return (Page<SpikesAndValleysSchemeVo>) aa; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param spikesAndValleysSchemeVo å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int insertSpikesAndValleysScheme(SpikesAndValleysSchemeVo spikesAndValleysSchemeVo) { |
| | | spikesAndValleysSchemeVo.setCreateTime(DateUtils.getNowDate()); |
| | | spikesAndValleysSchemeVo.setId(UUID.randomUUID().toString()); |
| | | SpikesAndValleysScheme spikesAndValleysScheme = new SpikesAndValleysScheme(); |
| | | BeanUtil.copyProperties(spikesAndValleysSchemeVo,spikesAndValleysScheme); |
| | | int result = spikesAndValleysSchemeMapper.insert(spikesAndValleysScheme); |
| | | //æå
¥å表 |
| | | List<SpikesAndValleysItem> itemList = spikesAndValleysSchemeVo.getItemList(); |
| | | itemList.stream().forEach(s->{ |
| | | s.setId(UUID.randomUUID().toString()); |
| | | s.setCreateTime(DateUtils.getNowDate()); |
| | | s.setCreateBy(spikesAndValleysSchemeVo.getCreateBy()); |
| | | s.setSchemeId(spikesAndValleysScheme.getId()); |
| | | spikesAndValleysItemMapper.insert(s); |
| | | }); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param spikesAndValleysSchemeVo å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateSpikesAndValleysScheme(SpikesAndValleysSchemeVo spikesAndValleysSchemeVo) { |
| | | spikesAndValleysSchemeVo.setUpdateTime(DateUtils.getNowDate()); |
| | | SpikesAndValleysScheme spikesAndValleysScheme = new SpikesAndValleysScheme(); |
| | | BeanUtil.copyProperties(spikesAndValleysSchemeVo,spikesAndValleysScheme); |
| | | int result = spikesAndValleysSchemeMapper.updateSpikesAndValleysScheme(spikesAndValleysScheme); |
| | | //å é¤å表 |
| | | LambdaQueryWrapper<SpikesAndValleysItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SpikesAndValleysItem::getSchemeId,spikesAndValleysScheme.getId()); |
| | | List<SpikesAndValleysItem> itemListOld = spikesAndValleysItemMapper.selectList(queryWrapper); |
| | | List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | String[] ids = idList.toArray(new String[idList.size()]); |
| | | spikesAndValleysItemMapper.deleteSpikesAndValleysItemByIds(ids); |
| | | //æå
¥å表 |
| | | List<SpikesAndValleysItem> itemList = spikesAndValleysSchemeVo.getItemList(); |
| | | itemList.stream().forEach(s->{ |
| | | s.setId(UUID.randomUUID().toString()); |
| | | s.setCreateTime(DateUtils.getNowDate()); |
| | | s.setCreateBy(spikesAndValleysSchemeVo.getCreateBy()); |
| | | s.setSchemeId(spikesAndValleysScheme.getId()); |
| | | spikesAndValleysItemMapper.insert(s); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤å°å³°å¹³è°·æ¶é´æ®µæç» |
| | | * |
| | | * @param ids éè¦å é¤çå°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSpikesAndValleysSchemeByIds(String[] ids) { |
| | | //å é¤å表 |
| | | List<String> list = Arrays.asList(ids); |
| | | list.stream().forEach(item->{ |
| | | LambdaQueryWrapper<SpikesAndValleysItem> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SpikesAndValleysItem::getSchemeId,item); |
| | | List<SpikesAndValleysItem> itemListOld = spikesAndValleysItemMapper.selectList(queryWrapper); |
| | | List<String>idList = itemListOld.stream().map(s->s.getId()).collect(Collectors.toList()); |
| | | String[] itemIds = idList.toArray(new String[idList.size()]); |
| | | spikesAndValleysItemMapper.deleteSpikesAndValleysItemByIds(itemIds); |
| | | }); |
| | | |
| | | return spikesAndValleysSchemeMapper.deleteSpikesAndValleysSchemeByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å°å³°å¹³è°·æ¶é´æ®µæç»ä¿¡æ¯ |
| | | * |
| | | * @param id å°å³°å¹³è°·æ¶é´æ®µæç»ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteSpikesAndValleysSchemeById(String id) { |
| | | return spikesAndValleysSchemeMapper.deleteSpikesAndValleysSchemeById(id); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.system.domain; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.annotation.Excel.ColumnType; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æä½æ¥å¿è®°å½è¡¨ oper_log |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public class SysOperLog extends BaseEntity |
| | |
| | | private Integer businessType; |
| | | |
| | | /** ä¸å¡ç±»åæ°ç» */ |
| | | @TableField(exist = false) |
| | | private Integer[] businessTypes; |
| | | |
| | | /** è¯·æ±æ¹æ³ */ |
| | |
| | | package com.zhitan.system.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.annotation.Excel.ColumnType; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.zhitan.common.annotation.Excel; |
| | | import com.zhitan.common.annotation.Excel.ColumnType; |
| | | import com.zhitan.common.core.domain.BaseEntity; |
| | | |
| | | /** |
| | | * å²ä½è¡¨ sys_post |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public class SysPost extends BaseEntity |
| | |
| | | private String status; |
| | | |
| | | /** ç¨æ·æ¯å¦å卿¤å²ä½æ è¯ é»è®¤ä¸åå¨ */ |
| | | @TableField(exist = false) |
| | | private boolean flag = false; |
| | | |
| | | public Long getPostId() |
| | |
| | | { |
| | | this.flag = flag; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.core.domain.entity.SysDictData; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åå
¸ ä¸å¡å± |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysDictDataService |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢åå
¸æ°æ® |
| | | * |
| | | * |
| | | * @param dictData åå
¸æ°æ®ä¿¡æ¯ |
| | | * @return åå
¸æ°æ®éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸é®å¼æ¥è¯¢åå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @param dictValue åå
¸é®å¼ |
| | | * @return åå
¸æ ç¾ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸æ°æ®IDæ¥è¯¢ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictCode åå
¸æ°æ®ID |
| | | * @return åå
¸æ°æ® |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤åå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictCodes éè¦å é¤çåå
¸æ°æ®ID |
| | | */ |
| | | void deleteDictDataByIds(Long[] dictCodes); |
| | | |
| | | /** |
| | | * æ°å¢ä¿ååå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictData åå
¸æ°æ®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictData åå
¸æ°æ®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | * @return åå
¸æ°æ®éåä¿¡æ¯ |
| | | */ |
| | | List<SysDictData> selectDictDataByType(String dictType); |
| | | |
| | | Page<SysDictData> selectDictDataPage(SysDictData dictData, Long pageNum, Long pageSize); |
| | | } |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.system.domain.SysLoginInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®æ¥å¿æ
åµä¿¡æ¯ æå¡å± |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysLoginInfoService |
| | | { |
| | | /** |
| | | * æ°å¢ç³»ç»ç»å½æ¥å¿ |
| | | * |
| | | * |
| | | * @param loginInfo è®¿é®æ¥å¿å¯¹è±¡ |
| | | */ |
| | | void insertLoginInfo(SysLoginInfo loginInfo); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç»å½æ¥å¿éå |
| | | * |
| | | * |
| | | * @param loginInfo è®¿é®æ¥å¿å¯¹è±¡ |
| | | * @return ç»å½è®°å½éå |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»ç»å½æ¥å¿ |
| | | * |
| | | * |
| | | * @param infoIds éè¦å é¤çç»å½æ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | * æ¸
空系ç»ç»å½æ¥å¿ |
| | | */ |
| | | void cleanLoginInfo(); |
| | | |
| | | Page<SysLoginInfo> selectLogininforPage(SysLoginInfo logininfor, Long pageNum, Long pageSize); |
| | | } |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.system.domain.SysOperLog; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ æå¡å± |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysOperLogService |
| | | { |
| | | /** |
| | | * æ°å¢æä½æ¥å¿ |
| | | * |
| | | * |
| | | * @param operLog æä½æ¥å¿å¯¹è±¡ |
| | | */ |
| | | void insertOperlog(SysOperLog operLog); |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»æä½æ¥å¿éå |
| | | * |
| | | * |
| | | * @param operLog æä½æ¥å¿å¯¹è±¡ |
| | | * @return æä½æ¥å¿éå |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»æä½æ¥å¿ |
| | | * |
| | | * |
| | | * @param operIds éè¦å é¤çæä½æ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢æä½æ¥å¿è¯¦ç» |
| | | * |
| | | * |
| | | * @param operId æä½ID |
| | | * @return æä½æ¥å¿å¯¹è±¡ |
| | | */ |
| | |
| | | * æ¸
空æä½æ¥å¿ |
| | | */ |
| | | void cleanOperLog(); |
| | | |
| | | Page<SysOperLog> selectOperLogPage(SysOperLog operLog, Long pageNum, Long pageSize); |
| | | } |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.system.domain.SysPost; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯ æå¡å± |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysPostService |
| | | { |
| | | /** |
| | | * æ¥è¯¢å²ä½ä¿¡æ¯éå |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return å²ä½å表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææå²ä½ |
| | | * |
| | | * |
| | | * @return å²ä½å表 |
| | | */ |
| | | List<SysPost> selectPostAll(); |
| | | |
| | | /** |
| | | * éè¿å²ä½IDæ¥è¯¢å²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param postId å²ä½ID |
| | | * @return è§è²å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDè·åå²ä½éæ©æ¡å表 |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return éä¸å²ä½IDå表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªå²ä½åç§° |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªå²ä½ç¼ç |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿å²ä½IDæ¥è¯¢å²ä½ä½¿ç¨æ°é |
| | | * |
| | | * |
| | | * @param postId å²ä½ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * å é¤å²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param postId å²ä½ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤å²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param postIds éè¦å é¤çå²ä½ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ°å¢ä¿åå²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åå²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | | int updatePost(SysPost post); |
| | | |
| | | Page<SysPost> selectPostPage(SysPost post, Long pageNum, Long pageSize); |
| | | } |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.core.domain.entity.SysRole; |
| | | import com.zhitan.system.domain.SysUserRole; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * è§è²ä¸å¡å± |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysRoleService |
| | | { |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢è§è²æ°æ® |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return è§è²æ°æ®éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢è§è²å表 |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return è§è²å表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢è§è²æé |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return æéå表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè§è² |
| | | * |
| | | * |
| | | * @return è§è²å表 |
| | | */ |
| | | List<SysRole> selectRoleAll(); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDè·åè§è²éæ©æ¡å表 |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return éä¸è§è²IDå表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return è§è²å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²æéæ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²æ¯å¦å
许æä½ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | */ |
| | | void checkRoleAllowed(SysRole role); |
| | | |
| | | /** |
| | | * æ ¡éªè§è²æ¯å¦ææ°æ®æé |
| | | * |
| | | * |
| | | * @param roleId è§è²id |
| | | */ |
| | | void checkRoleDataScope(Long roleId); |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢è§è²ä½¿ç¨æ°é |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ°å¢ä¿åè§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åè§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹è§è²ç¶æ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹æ°æ®æéä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿è§è²IDå é¤è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤è§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param roleIds éè¦å é¤çè§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * åæ¶ææç¨æ·è§è² |
| | | * |
| | | * |
| | | * @param userRole ç¨æ·åè§è²å
³èä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éåæ¶ææç¨æ·è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @param userIds éè¦åæ¶ææçç¨æ·æ°æ®ID |
| | | * @return ç»æ |
| | |
| | | |
| | | /** |
| | | * æ¹ééæ©ææç¨æ·è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @param userIds éè¦å é¤çç¨æ·æ°æ®ID |
| | | * @return ç»æ |
| | | */ |
| | | int insertAuthUsers(Long roleId, Long[] userIds); |
| | | |
| | | Page<SysRole> selectRolePage(SysRole role, Long pageNum, Long pageSize); |
| | | |
| | | SysRole getRoleByKey(SysRole queryRole); |
| | | } |
| | |
| | | package com.zhitan.system.service; |
| | | |
| | | import java.util.List; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ· ä¸å¡å± |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | public interface ISysUserService |
| | | { |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢ç¨æ·å表 |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢å·²åé
ç¨æ·è§è²å表 |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢æªåé
ç¨æ·è§è²å表 |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·åæ¥è¯¢ç¨æ· |
| | | * |
| | | * |
| | | * @param userName ç¨æ·å |
| | | * @return ç¨æ·å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·IDæ¥è¯¢ç¨æ· |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return ç¨æ·å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢ç¨æ·æå±è§è²ç» |
| | | * |
| | | * |
| | | * @param userName ç¨æ·å |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢ç¨æ·æå±å²ä½ç» |
| | | * |
| | | * |
| | | * @param userName ç¨æ·å |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªç¨æ·åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªç¨æ·æ¯å¦å
许æä½ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | */ |
| | | void checkUserAllowed(SysUser user); |
| | | |
| | | /** |
| | | * æ ¡éªç¨æ·æ¯å¦ææ°æ®æé |
| | | * |
| | | * |
| | | * @param userId ç¨æ·id |
| | | */ |
| | | void checkUserDataScope(Long userId); |
| | | |
| | | /** |
| | | * æ°å¢ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 注åç¨æ·ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ç¨æ·ææè§è² |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @param roleIds è§è²ç» |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ·ç¶æ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ·åºæ¬ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ·å¤´å |
| | | * |
| | | * |
| | | * @param userName ç¨æ·å |
| | | * @param avatar 头åå°å |
| | | * @return ç»æ |
| | |
| | | |
| | | /** |
| | | * éç½®ç¨æ·å¯ç |
| | | * |
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éç½®ç¨æ·å¯ç |
| | | * |
| | | * |
| | | * @param userName ç¨æ·å |
| | | * @param password å¯ç |
| | | * @return ç»æ |
| | |
| | | |
| | | /** |
| | | * éè¿ç¨æ·IDå é¤ç¨æ· |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param userIds éè¦å é¤çç¨æ·ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 导å
¥ç¨æ·æ°æ® |
| | | * |
| | | * |
| | | * @param userList ç¨æ·æ°æ®å表 |
| | | * @param isUpdateSupport æ¯å¦æ´æ°æ¯æï¼å¦æå·²åå¨ï¼åè¿è¡æ´æ°æ°æ® |
| | | * @param operName æä½ç¨æ· |
| | | * @return ç»æ |
| | | */ |
| | | String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName); |
| | | |
| | | Page<SysUser> selectUserPage(SysUser user, Long pageNum, Long pageSize); |
| | | |
| | | Long checkThirdUserExist(SysUser user); |
| | | } |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.common.core.domain.entity.SysDictData; |
| | | import com.zhitan.common.utils.DictUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.system.mapper.SysDictDataMapper; |
| | | import com.zhitan.system.service.ISysDictDataService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åå
¸ ä¸å¡å±å¤ç |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢åå
¸æ°æ® |
| | | * |
| | | * |
| | | * @param dictData åå
¸æ°æ®ä¿¡æ¯ |
| | | * @return åå
¸æ°æ®éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸é®å¼æ¥è¯¢åå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictType åå
¸ç±»å |
| | | * @param dictValue åå
¸é®å¼ |
| | | * @return åå
¸æ ç¾ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸æ°æ®IDæ¥è¯¢ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictCode åå
¸æ°æ®ID |
| | | * @return åå
¸æ°æ® |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤åå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param dictCodes éè¦å é¤çåå
¸æ°æ®ID |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * æ°å¢ä¿ååå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param data åå
¸æ°æ®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿ååå
¸æ°æ®ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param data åå
¸æ°æ®ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | public List<SysDictData> selectDictDataByType(String dictType) { |
| | | return dictDataMapper.selectDictDataByType(dictType); |
| | | } |
| | | @Override |
| | | public Page<SysDictData> selectDictDataPage(SysDictData dictData, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<SysDictData> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(dictData.getDictLabel()),SysDictData::getDictLabel,dictData.getDictLabel()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(dictData.getDictType()),SysDictData::getDictType,dictData.getDictType()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(dictData.getStatus()),SysDictData::getStatus,dictData.getStatus()); |
| | | return dictDataMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.system.domain.SysLoginInfo; |
| | | import com.zhitan.system.mapper.SysLoginInfoMapper; |
| | | import com.zhitan.system.service.ISysLoginInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®æ¥å¿æ
åµä¿¡æ¯ æå¡å±å¤ç |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * æ°å¢ç³»ç»ç»å½æ¥å¿ |
| | | * |
| | | * |
| | | * @param loginInfo è®¿é®æ¥å¿å¯¹è±¡ |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»ç»å½æ¥å¿éå |
| | | * |
| | | * |
| | | * @param loginInfo è®¿é®æ¥å¿å¯¹è±¡ |
| | | * @return ç»å½è®°å½éå |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»ç»å½æ¥å¿ |
| | | * |
| | | * |
| | | * @param infoIds éè¦å é¤çç»å½æ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | { |
| | | loginInfoMapper.cleanLoginInfo(); |
| | | } |
| | | @Override |
| | | public Page<SysLoginInfo> selectLogininforPage(SysLoginInfo logininfor, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<SysLoginInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(logininfor.getUserName()),SysLoginInfo::getUserName,logininfor.getUserName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(logininfor.getIpaddr()),SysLoginInfo::getIpaddr,logininfor.getIpaddr()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(logininfor.getStatus()),SysLoginInfo::getStatus,logininfor.getStatus()); |
| | | if(logininfor.getParams().containsKey("beginTime")) { |
| | | queryWrapper.between(SysLoginInfo::getCreateTime, |
| | | DateUtils.parseDate(logininfor.getParams().get("beginTime")), |
| | | DateUtils.parseDate(logininfor.getParams().get("endTime"))); |
| | | } |
| | | return loginInfoMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.system.domain.SysOperLog; |
| | | import com.zhitan.system.mapper.SysOperLogMapper; |
| | | import com.zhitan.system.service.ISysOperLogService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ æå¡å±å¤ç |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * æ°å¢æä½æ¥å¿ |
| | | * |
| | | * |
| | | * @param operLog æä½æ¥å¿å¯¹è±¡ |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ç³»ç»æä½æ¥å¿éå |
| | | * |
| | | * |
| | | * @param operLog æä½æ¥å¿å¯¹è±¡ |
| | | * @return æä½æ¥å¿éå |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤ç³»ç»æä½æ¥å¿ |
| | | * |
| | | * |
| | | * @param operIds éè¦å é¤çæä½æ¥å¿ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢æä½æ¥å¿è¯¦ç» |
| | | * |
| | | * |
| | | * @param operId æä½ID |
| | | * @return æä½æ¥å¿å¯¹è±¡ |
| | | */ |
| | |
| | | { |
| | | operLogMapper.cleanOperLog(); |
| | | } |
| | | |
| | | @Override |
| | | public Page<SysOperLog> selectOperLogPage(SysOperLog operLog, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<SysOperLog> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(operLog.getOperIp()), SysOperLog::getOperIp,operLog.getOperIp()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(operLog.getTitle()),SysOperLog::getTitle,operLog.getTitle()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(operLog.getOperName()),SysOperLog::getOperName,operLog.getOperName()); |
| | | queryWrapper.eq(null != operLog.getBusinessType(),SysOperLog::getBusinessType,operLog.getBusinessType()); |
| | | queryWrapper.eq(null != operLog.getStatus(), SysOperLog::getStatus,operLog.getStatus()); |
| | | if(operLog.getParams().containsKey("beginTime")) { |
| | | queryWrapper.between(SysOperLog::getCreateTime, |
| | | DateUtils.parseDate(operLog.getParams().get("beginTime")), |
| | | DateUtils.parseDate(operLog.getParams().get("endTime"))); |
| | | } |
| | | return operLogMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zhitan.common.constant.UserConstants; |
| | | import com.zhitan.common.exception.ServiceException; |
| | | import com.zhitan.common.utils.StringUtils; |
| | |
| | | import com.zhitan.system.mapper.SysPostMapper; |
| | | import com.zhitan.system.mapper.SysUserPostMapper; |
| | | import com.zhitan.system.service.ISysPostService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯ æå¡å±å¤ç |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢å²ä½ä¿¡æ¯éå |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return å²ä½ä¿¡æ¯éå |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææå²ä½ |
| | | * |
| | | * |
| | | * @return å²ä½å表 |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * éè¿å²ä½IDæ¥è¯¢å²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param postId å²ä½ID |
| | | * @return è§è²å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDè·åå²ä½éæ©æ¡å表 |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return éä¸å²ä½IDå表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªå²ä½åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªå²ä½ç¼ç æ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿å²ä½IDæ¥è¯¢å²ä½ä½¿ç¨æ°é |
| | | * |
| | | * |
| | | * @param postId å²ä½ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * å é¤å²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param postId å²ä½ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤å²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param postIds éè¦å é¤çå²ä½ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ°å¢ä¿åå²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åå²ä½ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param post å²ä½ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | { |
| | | return postMapper.updatePost(post); |
| | | } |
| | | @Override |
| | | public Page<SysPost> selectPostPage(SysPost post, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<SysPost> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(post.getPostName()),SysPost::getPostName,post.getPostName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(post.getPostCode()),SysPost::getPostCode,post.getPostCode()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(post.getStatus()),SysPost::getStatus,post.getStatus()); |
| | | |
| | | |
| | | return postMapper.selectPage(new Page<>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.zhitan.common.annotation.DataScope; |
| | | import com.zhitan.common.constant.UserConstants; |
| | | import com.zhitan.common.core.domain.entity.SysRole; |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | import com.zhitan.common.exception.ServiceException; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.SecurityUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.spring.SpringUtils; |
| | |
| | | import com.zhitan.system.mapper.SysRoleMenuMapper; |
| | | import com.zhitan.system.mapper.SysUserRoleMapper; |
| | | import com.zhitan.system.service.ISysRoleService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * è§è² ä¸å¡å±å¤ç |
| | | * |
| | | * |
| | | * @author zhitan |
| | | */ |
| | | @Service |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢è§è²æ°æ® |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return è§è²æ°æ®éåä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢è§è² |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return è§è²å表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢æé |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return æéå表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢ææè§è² |
| | | * |
| | | * |
| | | * @return è§è²å表 |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·IDè·åè§è²éæ©æ¡å表 |
| | | * |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @return éä¸è§è²IDå表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return è§è²å¯¹è±¡ä¿¡æ¯ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²åç§°æ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²æéæ¯å¦å¯ä¸ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²æ¯å¦å
许æä½ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * æ ¡éªè§è²æ¯å¦ææ°æ®æé |
| | | * |
| | | * |
| | | * @param roleId è§è²id |
| | | */ |
| | | @Override |
| | |
| | | |
| | | /** |
| | | * éè¿è§è²IDæ¥è¯¢è§è²ä½¿ç¨æ°é |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ°å¢ä¿åè§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¿åè§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹è§è²ç¶æ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹æ°æ®æéä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²ä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ°å¢è§è²èåä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param role è§è²å¯¹è±¡ |
| | | */ |
| | | public int insertRoleMenu(SysRole role) |
| | |
| | | |
| | | /** |
| | | * éè¿è§è²IDå é¤è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤è§è²ä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param roleIds éè¦å é¤çè§è²ID |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * åæ¶ææç¨æ·è§è² |
| | | * |
| | | * |
| | | * @param userRole ç¨æ·åè§è²å
³èä¿¡æ¯ |
| | | * @return ç»æ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * æ¹éåæ¶ææç¨æ·è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @param userIds éè¦åæ¶ææçç¨æ·æ°æ®ID |
| | | * @return ç»æ |
| | |
| | | |
| | | /** |
| | | * æ¹ééæ©ææç¨æ·è§è² |
| | | * |
| | | * |
| | | * @param roleId è§è²ID |
| | | * @param userIds éè¦ææçç¨æ·æ°æ®ID |
| | | * @return ç»æ |
| | |
| | | } |
| | | return userRoleMapper.batchUserRole(list); |
| | | } |
| | | @Override |
| | | public Page<SysRole> selectRolePage(SysRole role, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(role.getRoleName()),SysRole::getRoleName,role.getRoleName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(role.getRoleKey()),SysRole::getRoleKey,role.getRoleKey()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(role.getStatus()),SysRole::getStatus,role.getStatus()); |
| | | if(role.getParams().containsKey("beginTime")) { |
| | | queryWrapper.between(SysRole::getCreateTime, |
| | | DateUtils.parseDate(role.getParams().get("beginTime")), |
| | | DateUtils.parseDate(role.getParams().get("endTime"))); |
| | | } |
| | | return roleMapper.selectPage(new Page<SysRole>(pageNum,pageSize),queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public SysRole getRoleByKey(SysRole queryRole) { |
| | | LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SysRole::getRoleKey,queryRole.getRoleKey()); |
| | | return roleMapper.selectOne(queryWrapper); |
| | | } |
| | | } |
| | |
| | | package com.zhitan.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.validation.Validator; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import com.zhitan.common.annotation.DataScope; |
| | | import com.zhitan.common.constant.UserConstants; |
| | | import com.zhitan.common.core.domain.entity.SysRole; |
| | | import com.zhitan.common.core.domain.entity.SysUser; |
| | | import com.zhitan.common.exception.ServiceException; |
| | | import com.zhitan.common.utils.DateUtils; |
| | | import com.zhitan.common.utils.SecurityUtils; |
| | | import com.zhitan.common.utils.StringUtils; |
| | | import com.zhitan.common.utils.bean.BeanValidators; |
| | |
| | | import com.zhitan.system.domain.SysPost; |
| | | import com.zhitan.system.domain.SysUserPost; |
| | | import com.zhitan.system.domain.SysUserRole; |
| | | import com.zhitan.system.mapper.SysPostMapper; |
| | | import com.zhitan.system.mapper.SysRoleMapper; |
| | | import com.zhitan.system.mapper.SysUserMapper; |
| | | import com.zhitan.system.mapper.SysUserPostMapper; |
| | | import com.zhitan.system.mapper.SysUserRoleMapper; |
| | | import com.zhitan.system.mapper.*; |
| | | import com.zhitan.system.service.ISysConfigService; |
| | | import com.zhitan.system.service.ISysUserService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Validator; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç¨æ· ä¸å¡å±å¤ç |
| | |
| | | } |
| | | return successMsg.toString(); |
| | | } |
| | | @Override |
| | | public Page<SysUser> selectUserPage(SysUser user, Long pageNum, Long pageSize) { |
| | | LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StringUtils.isNotEmpty(user.getUserName()),SysUser::getUserName,user.getUserName()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(user.getPhoneNumber()),SysUser::getPhoneNumber,user.getPhoneNumber()); |
| | | queryWrapper.eq(StringUtils.isNotEmpty(user.getStatus()),SysUser::getStatus,user.getStatus()); |
| | | if(user.getParams().containsKey("beginTime")) { |
| | | queryWrapper.between(SysUser::getCreateTime, |
| | | DateUtils.parseDate(user.getParams().get("beginTime")), |
| | | DateUtils.parseDate(user.getParams().get("endTime"))); |
| | | } |
| | | final Page<SysUser> page = userMapper.selectPage(new Page<SysUser>(pageNum, pageSize),queryWrapper); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | | public Long checkThirdUserExist(SysUser user) { |
| | | LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(SysUser::getUserName,user.getUserName()); |
| | | return userMapper.selectCount(queryWrapper); |
| | | } |
| | | } |
| | |
| | | JOIN node_index ni ON ni.node_id = nd.node_id |
| | | where ni.node_id= #{nodeId} and index_id= #{indexId} |
| | | </select> |
| | | <select id="listMeterImplByInstallLocation" resultType="com.zhitan.basicdata.domain.MeterImplement"> |
| | | <include refid="selectMeterImplementVo"/> |
| | | <where> |
| | | installaction_location = #{installactionLocation} |
| | | </where> |
| | | </select> |
| | | |
| | | <insert id="insertMeterImplement" parameterType="MeterImplement"> |
| | | insert into meter_implement |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.zhitan.benchmarkmanage.mapper.EnergyBenchmarkManageMapper"> |
| | | |
| | | <resultMap type="com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage" id="EnergyBenchmarkManageResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="code" column="code" /> |
| | | <result property="type" column="type" /> |
| | | <result property="grade" column="grade" /> |
| | | <result property="value" column="value" /> |
| | | <result property="nationalNum" column="national_num" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectEnergyBenchmarkManageVo"> |
| | | select id, code, type, grade, value, national_num, create_by, create_time, update_by, update_time, remark from energy_benchmark_manage |
| | | </sql> |
| | | |
| | | <select id="selectEnergyBenchmarkManageList" parameterType="com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage" resultMap="EnergyBenchmarkManageResult"> |
| | | <include refid="selectEnergyBenchmarkManageVo"/> |
| | | <where> |
| | | <if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="grade != null and grade != ''"> and grade = #{grade}</if> |
| | | <if test="value != null and value != ''"> and value = #{value}</if> |
| | | <if test="nationalNum != null and nationalNum != ''"> and national_num like concat('%', #{nationalNum}, '%')</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectEnergyBenchmarkManageById" parameterType="String" resultMap="EnergyBenchmarkManageResult"> |
| | | <include refid="selectEnergyBenchmarkManageVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertEnergyBenchmarkManage" parameterType="com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage"> |
| | | insert into energy_benchmark_manage |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="code != null">code,</if> |
| | | <if test="type != null">type,</if> |
| | | <if test="grade != null">grade,</if> |
| | | <if test="value != null">value,</if> |
| | | <if test="nationalNum != null">national_num,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="remark != null">remark,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="code != null">#{code},</if> |
| | | <if test="type != null">#{type},</if> |
| | | <if test="grade != null">#{grade},</if> |
| | | <if test="value != null">#{value},</if> |
| | | <if test="nationalNum != null">#{nationalNum},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateEnergyBenchmarkManage" parameterType="com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage"> |
| | | update energy_benchmark_manage |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="code != null">code = #{code},</if> |
| | | <if test="type != null">type = #{type},</if> |
| | | <if test="grade != null">grade = #{grade},</if> |
| | | <if test="value != null">value = #{value},</if> |
| | | <if test="nationalNum != null">national_num = #{nationalNum},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteEnergyBenchmarkManageById" parameterType="String"> |
| | | delete from energy_benchmark_manage where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteEnergyBenchmarkManageByIds" parameterType="String"> |
| | | delete from energy_benchmark_manage where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="getList" parameterType="com.zhitan.benchmarkmanage.domain.EnergyBenchmarkManage" resultMap="EnergyBenchmarkManageResult"> |
| | | <include refid="selectEnergyBenchmarkManageVo"/> |
| | | <where> |
| | | <if test="id != null and id != ''"> and id != #{id}</if> |
| | | <if test="code != null and code != ''"> and code = #{code}</if> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="grade != null and grade != ''"> and grade = #{grade}</if> |
| | | </where> |
| | | </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.zhitan.costmanagement.mapper.CostElectricityInputMapper"> |
| | | |
| | | <resultMap type="CostElectricityInput" id="CostElectricityInputResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="type" column="type" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="electricityNum" column="electricity_num" /> |
| | | <result property="time" column="time" /> |
| | | <result property="electricityFee" column="electricity_fee" /> |
| | | <result property="powerFactor" column="power_factor" /> |
| | | <result property="sharpElectricity" column="sharp_electricity" /> |
| | | <result property="peakElectricity" column="peak_electricity" /> |
| | | <result property="flatElectricity" column="flat_electricity" /> |
| | | <result property="valleyElectricity" column="valley_electricity" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCostElectricityInputVo"> |
| | | select id, type, create_time, create_by, update_time, update_by, remark, electricity_num, time, |
| | | electricity_fee, power_factor, sharp_electricity, peak_electricity, flat_electricity, valley_electricity |
| | | from cost_electricity_input |
| | | </sql> |
| | | |
| | | <select id="selectCostElectricityInputList" parameterType="CostElectricityInput" resultMap="CostElectricityInputResult"> |
| | | <include refid="selectCostElectricityInputVo"/> |
| | | <where> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="electricityNum != null and electricityNum != ''"> and electricity_num = #{electricityNum}</if> |
| | | <if test="time != null and time != ''"> and time = #{time}</if> |
| | | <if test="electricityFee != null and electricityFee != ''"> and electricity_fee = #{electricityFee}</if> |
| | | <if test="powerFactor != null and powerFactor != ''"> and power_factor = #{powerFactor}</if> |
| | | <if test="sharpElectricity != null and sharpElectricity != ''"> and sharp_electricity = #{sharpElectricity}</if> |
| | | <if test="peakElectricity != null and peakElectricity != ''"> and peak_electricity = #{peakElectricity}</if> |
| | | <if test="flatElectricity != null and flatElectricity != ''"> and flat_electricity = #{flatElectricity}</if> |
| | | <if test="valleyElectricity != null and valleyElectricity != ''"> and valley_electricity = #{valleyElectricity}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectCostElectricityInputById" parameterType="String" resultMap="CostElectricityInputResult"> |
| | | <include refid="selectCostElectricityInputVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCostElectricityInput" parameterType="CostElectricityInput"> |
| | | insert into cost_electricity_input |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="type != null">type,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="electricityNum != null">electricity_num,</if> |
| | | <if test="time != null">time,</if> |
| | | <if test="electricityFee != null">electricity_fee,</if> |
| | | <if test="powerFactor != null">power_factor,</if> |
| | | <if test="sharpElectricity != null">sharp_electricity,</if> |
| | | <if test="peakElectricity != null">peak_electricity,</if> |
| | | <if test="flatElectricity != null">flat_electricity,</if> |
| | | <if test="valleyElectricity != null">valley_electricity,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="type != null">#{type},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="electricityNum != null">#{electricityNum},</if> |
| | | <if test="time != null">#{time},</if> |
| | | <if test="electricityFee != null">#{electricityFee},</if> |
| | | <if test="powerFactor != null">#{powerFactor},</if> |
| | | <if test="sharpElectricity != null">#{sharpElectricity},</if> |
| | | <if test="peakElectricity != null">#{peakElectricity},</if> |
| | | <if test="flatElectricity != null">#{flatElectricity},</if> |
| | | <if test="valleyElectricity != null">#{valleyElectricity},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCostElectricityInput" parameterType="CostElectricityInput"> |
| | | update cost_electricity_input |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="type != null">type = #{type},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="electricityNum != null">electricity_num = #{electricityNum},</if> |
| | | <if test="time != null">time = #{time},</if> |
| | | <if test="electricityFee != null">electricity_fee = #{electricityFee},</if> |
| | | <if test="powerFactor != null">power_factor = #{powerFactor},</if> |
| | | <if test="sharpElectricity != null">sharp_electricity = #{sharpElectricity},</if> |
| | | <if test="peakElectricity != null">peak_electricity = #{peakElectricity},</if> |
| | | <if test="flatElectricity != null">flat_electricity = #{flatElectricity},</if> |
| | | <if test="valleyElectricity != null">valley_electricity = #{valleyElectricity},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCostElectricityInputById" parameterType="String"> |
| | | delete from cost_electricity_input where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCostElectricityInputByIds" parameterType="String"> |
| | | delete from cost_electricity_input where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </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.zhitan.costmanagement.mapper.CostPriceRelevancyMapper"> |
| | | |
| | | <resultMap type="CostPriceRelevancy" id="CostPriceRelevancyResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="nodeId" column="node_id" /> |
| | | <result property="tacticsId" column="tactics_id" /> |
| | | <result property="energyType" column="energy_type" /> |
| | | <result property="effectiveBeginTime" column="effective_begin_time" /> |
| | | <result property="effectiveEndTime" column="effective_end_time" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCostPriceRelevancyVo"> |
| | | select id, create_time, create_by, update_time, update_by, remark, node_id, tactics_id, |
| | | energy_type, effective_begin_time, effective_end_time from cost_price_relevancy |
| | | </sql> |
| | | |
| | | <select id="selectCostPriceRelevancyList" parameterType="CostPriceRelevancy" resultMap="CostPriceRelevancyResult"> |
| | | <include refid="selectCostPriceRelevancyVo"/> |
| | | <where> |
| | | <if test="nodeId != null and nodeId != ''"> and node_id = #{nodeId}</if> |
| | | <if test="tacticsId != null and tacticsId != ''"> and tactics_id = #{tacticsId}</if> |
| | | <if test="energyType != null and energyType != ''"> and energy_type = #{energyType}</if> |
| | | <if test="effectiveBeginTime != null "> and effective_begin_time = #{effectiveBeginTime}</if> |
| | | <if test="effectiveEndTime != null "> and effective_end_time = #{effectiveEndTime}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectCostPriceRelevancyById" parameterType="String" resultMap="CostPriceRelevancyResult"> |
| | | <include refid="selectCostPriceRelevancyVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCostPriceRelevancy" parameterType="CostPriceRelevancy"> |
| | | insert into cost_price_relevancy |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="nodeId != null">node_id,</if> |
| | | <if test="tacticsId != null">tactics_id,</if> |
| | | <if test="energyType != null">energy_type,</if> |
| | | <if test="effectiveBeginTime != null">effective_begin_time,</if> |
| | | <if test="effectiveEndTime != null">effective_end_time,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="nodeId != null">#{nodeId},</if> |
| | | <if test="tacticsId != null">#{tacticsId},</if> |
| | | <if test="energyType != null">#{energyType},</if> |
| | | <if test="effectiveBeginTime != null">#{effectiveBeginTime},</if> |
| | | <if test="effectiveEndTime != null">#{effectiveEndTime},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCostPriceRelevancy" parameterType="CostPriceRelevancy"> |
| | | update cost_price_relevancy |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="nodeId != null">node_id = #{nodeId},</if> |
| | | <if test="tacticsId != null">tactics_id = #{tacticsId},</if> |
| | | <if test="energyType != null">energy_type = #{energyType},</if> |
| | | <if test="effectiveBeginTime != null">effective_begin_time = #{effectiveBeginTime},</if> |
| | | <if test="effectiveEndTime != null">effective_end_time = #{effectiveEndTime},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCostPriceRelevancyById" parameterType="String"> |
| | | delete from cost_price_relevancy where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCostPriceRelevancyByIds" parameterType="String"> |
| | | delete from cost_price_relevancy where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectCostPriceRelevancyByNodeId" parameterType="String" resultType="com.zhitan.costmanagement.domain.vo.CostPriceRelevancyVo"> |
| | | SELECT |
| | | item.electricity_type AS electricityType, |
| | | item.price |
| | | FROM |
| | | cost_price_relevancy re |
| | | INNER JOIN cost_price_tactics ta ON re.tactics_id = ta.ID |
| | | INNER JOIN cost_price_tactics_item item ON item.tactics_id = ta.ID |
| | | WHERE |
| | | re.node_id = #{nodeId} |
| | | and item.electricity_type=#{elType} |
| | | |
| | | </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.zhitan.costmanagement.mapper.CostPriceTacticsItemMapper"> |
| | | |
| | | <resultMap type="CostPriceTacticsItem" id="CostPriceTacticsItemResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="rangeType" column="range_type" /> |
| | | <result property="tacticsNumber" column="tactics_number" /> |
| | | <result property="tacticsId" column="tactics_id" /> |
| | | <result property="electricityType" column="electricity_type" /> |
| | | <result property="slotsMin" column="slots_min" /> |
| | | <result property="slotsMax" column="slots_max" /> |
| | | <result property="price" column="price" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCostPriceTacticsItemVo"> |
| | | select id, create_time, create_by, update_time, update_by, remark, range_type, tactics_number, tactics_id, electricity_type, slots_min, slots_max, price from cost_price_tactics_item |
| | | </sql> |
| | | |
| | | <select id="selectCostPriceTacticsItemList" parameterType="CostPriceTacticsItem" resultMap="CostPriceTacticsItemResult"> |
| | | <include refid="selectCostPriceTacticsItemVo"/> |
| | | <where> |
| | | <if test="rangeType != null and rangeType != ''"> and range_type = #{rangeType}</if> |
| | | <if test="tacticsNumber != null and tacticsNumber != ''"> and tactics_number = #{tacticsNumber}</if> |
| | | <if test="tacticsId != null and tacticsId != ''"> and tactics_id = #{tacticsId}</if> |
| | | <if test="electricityType != null and electricityType != ''"> and electricity_type = #{electricityType}</if> |
| | | <if test="slotsMin != null and slotsMin != ''"> and slots_min = #{slotsMin}</if> |
| | | <if test="slotsMax != null and slotsMax != ''"> and slots_max = #{slotsMax}</if> |
| | | <if test="price != null and price != ''"> and price = #{price}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectCostPriceTacticsItemById" parameterType="String" resultMap="CostPriceTacticsItemResult"> |
| | | <include refid="selectCostPriceTacticsItemVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCostPriceTacticsItem" parameterType="CostPriceTacticsItem"> |
| | | insert into cost_price_tactics_item |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="rangeType != null">range_type,</if> |
| | | <if test="tacticsNumber != null">tactics_number,</if> |
| | | <if test="tacticsId != null">tactics_id,</if> |
| | | <if test="electricityType != null">electricity_type,</if> |
| | | <if test="slotsMin != null">slots_min,</if> |
| | | <if test="slotsMax != null">slots_max,</if> |
| | | <if test="price != null">price,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="rangeType != null">#{rangeType},</if> |
| | | <if test="tacticsNumber != null">#{tacticsNumber},</if> |
| | | <if test="tacticsId != null">#{tacticsId},</if> |
| | | <if test="electricityType != null">#{electricityType},</if> |
| | | <if test="slotsMin != null">#{slotsMin},</if> |
| | | <if test="slotsMax != null">#{slotsMax},</if> |
| | | <if test="price != null">#{price},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCostPriceTacticsItem" parameterType="CostPriceTacticsItem"> |
| | | update cost_price_tactics_item |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="rangeType != null">range_type = #{rangeType},</if> |
| | | <if test="tacticsNumber != null">tactics_number = #{tacticsNumber},</if> |
| | | <if test="tacticsId != null">tactics_id = #{tacticsId},</if> |
| | | <if test="electricityType != null">electricity_type = #{electricityType},</if> |
| | | <if test="slotsMin != null">slots_min = #{slotsMin},</if> |
| | | <if test="slotsMax != null">slots_max = #{slotsMax},</if> |
| | | <if test="price != null">price = #{price},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCostPriceTacticsItemById" parameterType="String"> |
| | | delete from cost_price_tactics_item where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCostPriceTacticsItemByIds" parameterType="String"> |
| | | delete from cost_price_tactics_item where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </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.zhitan.costmanagement.mapper.CostPriceTacticsMapper"> |
| | | |
| | | <resultMap type="CostPriceTactics" id="CostPriceTacticsResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="type" column="type" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="tacticsNumber" column="tactics_number" /> |
| | | <result property="tacticsName" column="tactics_name" /> |
| | | <result property="energyType" column="energy_type" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCostPriceTacticsVo"> |
| | | select id, type, create_time, create_by, update_time, update_by, remark, tactics_number, tactics_name, energy_type from cost_price_tactics |
| | | </sql> |
| | | |
| | | <select id="selectCostPriceTacticsList" parameterType="CostPriceTactics" resultMap="CostPriceTacticsResult"> |
| | | <include refid="selectCostPriceTacticsVo"/> |
| | | <where> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="tacticsNumber != null and tacticsNumber != ''"> and tactics_number = #{tacticsNumber}</if> |
| | | <if test="tacticsName != null and tacticsName != ''"> and tactics_name like concat('%', #{tacticsName}, '%')</if> |
| | | <if test="energyType != null and energyType != ''"> and energy_type = #{energyType}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectCostPriceTacticsById" parameterType="String" resultMap="CostPriceTacticsResult"> |
| | | <include refid="selectCostPriceTacticsVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCostPriceTactics" parameterType="CostPriceTactics"> |
| | | insert into cost_price_tactics |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="type != null">type,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="tacticsNumber != null">tactics_number,</if> |
| | | <if test="tacticsName != null">tactics_name,</if> |
| | | <if test="energyType != null">energy_type,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="type != null">#{type},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="tacticsNumber != null">#{tacticsNumber},</if> |
| | | <if test="tacticsName != null">#{tacticsName},</if> |
| | | <if test="energyType != null">#{energyType},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCostPriceTactics" parameterType="CostPriceTactics"> |
| | | update cost_price_tactics |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="type != null">type = #{type},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="tacticsNumber != null">tactics_number = #{tacticsNumber},</if> |
| | | <if test="tacticsName != null">tactics_name = #{tacticsName},</if> |
| | | <if test="energyType != null">energy_type = #{energyType},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCostPriceTacticsById" parameterType="String"> |
| | | delete from cost_price_tactics where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCostPriceTacticsByIds" parameterType="String"> |
| | | delete from cost_price_tactics where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectCostPriceTacticsListAll" resultMap="CostPriceTacticsResult"> |
| | | <include refid="selectCostPriceTacticsVo"/> |
| | | <where> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | <if test="tacticsNumber != null and tacticsNumber != ''"> and tactics_number = #{tacticsNumber}</if> |
| | | <if test="tacticsName != null and tacticsName != ''"> and tactics_name like concat('%', #{tacticsName}, '%')</if> |
| | | <if test="energyType != null and energyType != ''"> and energy_type = #{energyType}</if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | </foreach> |
| | | AND time_code = #{timeCode} |
| | | </select> |
| | | <select id="getUpCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission"> |
| | | SELECT |
| | | di.index_id, |
| | | di.data_time, |
| | | di.value, |
| | | ei.energy_id |
| | | FROM |
| | | data_item di |
| | | JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | ei.energy_id != '' and |
| | | di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{indexId}) |
| | | AND di.data_time BETWEEN #{beginTime} AND #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | <select id="getMiddleCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission"> |
| | | SELECT |
| | | di.index_id, |
| | | di.data_time, |
| | | CASE |
| | | WHEN di.time_type = 'MONTH' THEN |
| | | TO_CHAR( di.create_time, 'MM' ) |
| | | WHEN di.time_type = 'DAY' THEN |
| | | TO_CHAR( di.create_time, 'DD' ) |
| | | WHEN di.time_type = 'HOUR' THEN |
| | | TO_CHAR( di.data_time, 'HH' ) |
| | | ELSE TO_CHAR( di.data_time, 'YYMMDD' ) |
| | | END AS dataTimeStr, |
| | | di.value, |
| | | ei.energy_id, |
| | | di.time_type |
| | | FROM |
| | | data_item di |
| | | JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{indexId}) |
| | | <if test="emissionType !='' and emissionType !=null and emissionType =='allType'"> |
| | | AND ei.energy_id != '' |
| | | </if> |
| | | <if test="emissionType !='' and emissionType !=null and emissionType !='allType'"> |
| | | AND ei.energy_id = #{emissionType} |
| | | </if> |
| | | AND di.data_time BETWEEN #{beginTime} AND #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | </select> |
| | | <select id="getDownCarbonEmission" resultType="com.zhitan.carbonemission.domain.CarbonEmission"> |
| | | SELECT |
| | | di.index_id, |
| | | di.data_time, |
| | | di.value, |
| | | ei.energy_id, |
| | | mn.name as nodeName |
| | | FROM |
| | | model_node mn |
| | | LEFT JOIN node_index ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN data_item di ON di.index_id = ni.index_id |
| | | LEFT JOIN energy_index ei ON di.index_id = ei.index_id |
| | | WHERE |
| | | ei.energy_id != '' |
| | | AND mn.parent_id = #{indexId} |
| | | AND di.data_time BETWEEN #{beginTime} AND #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | </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.zhitan.energydata.mapper.EnergyDataStatisticMapper"> |
| | | |
| | | <select id="getModelNodeIndexIdByFixedNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | | ni.index_id indexId, |
| | | ei.energy_id |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | left join energy_index ei on ni.index_id = ei.index_id |
| | | WHERE mn.model_code = #{modelCode} and ei.index_type = 'STATISTIC' |
| | | and mn.node_id in |
| | | <foreach collection="fixedNodeIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </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.zhitan.model.mapper.EnergyDataStatisticMapper"> |
| | | |
| | | <resultMap type="com.zhitan.model.domain.CalcFunction" id="CalcFunctionResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="info" column="info"/> |
| | | <result property="funcName" column="func_name"/> |
| | | <result property="funcText" column="func_text"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectCalcFunctionVo"> |
| | | select id, func_name, func_text, info |
| | | from calc_function |
| | | </sql> |
| | | |
| | | <select id="selectCalcFunctionList" parameterType="com.zhitan.model.domain.CalcFunction" resultMap="CalcFunctionResult"> |
| | | <include refid="selectCalcFunctionVo"/> |
| | | <where> |
| | | <if test="funcName != null and funcName != ''">and func_name like concat('%', #{funcName}, '%')</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectCalcFunctionById" parameterType="String" resultMap="CalcFunctionResult"> |
| | | <include refid="selectCalcFunctionVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertCalcFunction" parameterType="com.zhitan.model.domain.CalcFunction"> |
| | | insert into calc_function |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="funcName != null and funcName != ''">func_name,</if> |
| | | <if test="funcText != null and funcText != ''">func_text,</if> |
| | | <if test="info != null and info != ''">info,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="funcName != null and funcName != ''">#{funcName},</if> |
| | | <if test="funcText != null and funcText != ''">#{funcText},</if> |
| | | <if test="info != null and info != ''">#{info},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateCalcFunction" parameterType="com.zhitan.model.domain.CalcFunction"> |
| | | update calc_function |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="info != null and info != ''">info = #{info},</if> |
| | | <if test="funcName != null and funcName != ''">func_name = #{funcName},</if> |
| | | <if test="funcText != null and funcText != ''">func_text = #{funcText},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteCalcFunctionById" parameterType="String"> |
| | | delete |
| | | from calc_function |
| | | where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteCalcFunctionByIds" parameterType="String"> |
| | | delete from calc_function where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | <if test="energyId != null">#{energyId}, |
| | | </if> |
| | | </trim> |
| | | |
| | | |
| | | </insert> |
| | | <insert id="insertNodeIndex"> |
| | | insert into node_index (node_id, index_id) values (#{nodeId}, #{indexId}); |
| | |
| | | and ei.meter_id = me.id |
| | | order by ei.order_num |
| | | </select> |
| | | |
| | | |
| | | <select id="selectEnergyIndexPage" resultMap="EnergyIndexResult"> |
| | | select ni.index_id, name, code, index_type, remark, unit_id, index_category |
| | | from energy_index ei left join node_index ni on ei.index_id = ni.index_id |
| | |
| | | </if> |
| | | </where> |
| | | order by ei.order_num |
| | | |
| | | |
| | | </select> |
| | | <select id="listIndexByMeterIds" resultType="com.zhitan.model.domain.EnergyIndex"> |
| | | select ei.index_id, |
| | |
| | | from energy_index ei |
| | | left join node_index ni on ei.index_id = ni.index_id |
| | | <where> |
| | | |
| | | |
| | | <if test="nodeId != null and nodeId != ''">and ni.node_id = #{nodeId}</if> |
| | | <if test="meterIds != null"> |
| | | and ei.meter_id in |
| | |
| | | <include refid="selectEnergyIndexVo"/> |
| | | where code = #{cdoe} |
| | | </select> |
| | | <select id="getIndexByCode" resultType="com.zhitan.model.domain.EnergyIndex"> |
| | | SELECT ei.code,mi.meter_name||'_'||ei.name as name from energy_index ei |
| | | LEFT JOIN node_device nd on ei.meter_id = nd.device_id |
| | | LEFT JOIN meter_implement mi on mi."id" = nd.device_id |
| | | <where> |
| | | <if test="nodeId != null and nodeId != ''">and nd.node_id = #{nodeId}</if> |
| | | <if test="code != null and code != ''"> |
| | | and (mi.meter_name like concat('%', #{code}, '%') |
| | | or ei.code like concat('%', #{code}, '%') |
| | | or ei.name like concat('%', #{code}, '%') |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | values (#{nodeId}, #{indexId}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | |
| | | <select id="getModelNodeIndexIdByNodeId" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | | mn."name" "name", |
| | |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | LEFT JOIN energy_index ei on ni.index_id = ei.index_id |
| | | WHERE ni.node_id = #{nodeId} |
| | | WHERE ni.node_id = #{nodeId} |
| | | <if test="energyType!=null and energyType!=''"> |
| | | and ei.energy_id = #{energyType} |
| | | </if> |
| | |
| | | <select id="getFirstModeNodeInfo" resultType="com.zhitan.model.domain.ModelNode"> |
| | | <include refid="selectModelNodeVo"/> |
| | | where model_code = #{modelCode} AND parent_id is null |
| | | order by order_num |
| | | order by order_num |
| | | </select> |
| | | <select id="selectIndexByNodeIds" resultType="com.zhitan.model.domain.vo.ModelNodeIndexInfor"> |
| | | SELECT mn.node_id nodeId, |
| | |
| | | FROM "model_node" mn |
| | | LEFT JOIN "node_index" ni ON mn.node_id = ni.node_id |
| | | left join energy_index ei on ni.index_id = ei.index_id |
| | | WHERE mn.model_code = #{modelCode} |
| | | <where> |
| | | mn.model_code = #{modelCode} |
| | | AND mn.node_id in |
| | | <foreach collection="nodeIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | <if test="modelCode!=null and modelCode!='' and nodeIds.size>0"> |
| | | and ei.index_type='STATISTIC' |
| | | </if> |
| | | |
| | | </where> |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | AND (data_time BETWEEN #{startTime} AND #{endTime}) |
| | | AND time_type = #{timeType} |
| | | </select> |
| | | <select id="getDataStatisticsDeviationAnalysis" |
| | | resultType="com.zhitan.peakvalley.domain.ElectricityDataItem"> |
| | | SELECT |
| | | index_code indexCode, |
| | | time_code timeCode, |
| | | electricity_type electricityType, |
| | | data_time dataTime, |
| | | electricity, |
| | | "cost", |
| | | time_type timeType, |
| | | price, |
| | | remark |
| | | FROM |
| | | "electricity_data_item" |
| | | WHERE |
| | | index_id IN |
| | | <foreach collection="indexIdSet" item="indexId" open="(" separator="," close=")"> |
| | | #{indexId} |
| | | </foreach> |
| | | |
| | | AND time_type = #{timeType} |
| | | </select> |
| | | </mapper> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="selectElectricityPriceDatePageTacticsAll" resultMap="ElectricityPriceDateResult"> |
| | | <include refid="selectElectricityPriceDateVo"/> |
| | | WHERE begin_date < CURRENT_TIMESTAMP |
| | | AND end_date > CURRENT_TIMESTAMP |
| | | </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.zhitan.powerDistribution.mapper.PowerDistributionMapper"> |
| | | <delete id="deletePowerDistributionByIds" parameterType="String"> |
| | | delete from power_distribution |
| | | <where> |
| | | id in |
| | | <foreach collection="ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </where> |
| | | </delete> |
| | | </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.zhitan.spikesandvalleys.mapper.SpikesAndValleysItemMapper"> |
| | | |
| | | <resultMap type="SpikesAndValleysItem" id="SpikesAndValleysItemResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="time" column="time" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="electrovalency" column="electrovalency" /> |
| | | <result property="startTime" column="start_time" /> |
| | | <result property="endTime" column="end_time" /> |
| | | <result property="schemeId" column="scheme_id" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSpikesAndValleysItemVo"> |
| | | select id, time, create_time, create_by, update_time, update_by, remark, electrovalency, start_time, end_time, scheme_id from spikes_and_valleys_item |
| | | </sql> |
| | | |
| | | <select id="selectSpikesAndValleysItemList" parameterType="SpikesAndValleysItem" resultMap="SpikesAndValleysItemResult"> |
| | | <include refid="selectSpikesAndValleysItemVo"/> |
| | | <where> |
| | | <if test="time != null and time != ''"> and time = #{time}</if> |
| | | <if test="electrovalency != null and electrovalency != ''"> and electrovalency = #{electrovalency}</if> |
| | | <if test="startTime != null and startTime != ''"> and start_time = #{startTime}</if> |
| | | <if test="endTime != null and endTime != ''"> and end_time = #{endTime}</if> |
| | | <if test="schemeId != null and schemeId != ''"> and scheme_id = #{schemeId}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectSpikesAndValleysItemById" parameterType="String" resultMap="SpikesAndValleysItemResult"> |
| | | <include refid="selectSpikesAndValleysItemVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertSpikesAndValleysItem" parameterType="SpikesAndValleysItem"> |
| | | insert into spikes_and_valleys_item |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="time != null">time,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="electrovalency != null">electrovalency,</if> |
| | | <if test="startTime != null">start_time,</if> |
| | | <if test="endTime != null">end_time,</if> |
| | | <if test="schemeId != null">scheme_id,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="time != null">#{time},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="electrovalency != null">#{electrovalency},</if> |
| | | <if test="startTime != null">#{startTime},</if> |
| | | <if test="endTime != null">#{endTime},</if> |
| | | <if test="schemeId != null">#{schemeId},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateSpikesAndValleysItem" parameterType="SpikesAndValleysItem"> |
| | | update spikes_and_valleys_item |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="time != null">time = #{time},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="electrovalency != null">electrovalency = #{electrovalency},</if> |
| | | <if test="startTime != null">start_time = #{startTime},</if> |
| | | <if test="endTime != null">end_time = #{endTime},</if> |
| | | <if test="schemeId != null">scheme_id = #{schemeId},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteSpikesAndValleysItemById" parameterType="String"> |
| | | delete from spikes_and_valleys_item where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteSpikesAndValleysItemByIds" parameterType="String"> |
| | | delete from spikes_and_valleys_item where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </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.zhitan.spikesandvalleys.mapper.SpikesAndValleysSchemeMapper"> |
| | | |
| | | <resultMap type="SpikesAndValleysScheme" id="SpikesAndValleysSchemeResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="schemeName" column="scheme_name" /> |
| | | <result property="executeTime" column="execute_time" /> |
| | | <result property="type" column="type" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectSpikesAndValleysSchemeVo"> |
| | | select id, create_time, create_by, update_time, update_by, remark, scheme_name, execute_time, type from spikes_and_valleys_scheme |
| | | </sql> |
| | | |
| | | <select id="selectSpikesAndValleysSchemeList" parameterType="SpikesAndValleysScheme" resultMap="SpikesAndValleysSchemeResult"> |
| | | <include refid="selectSpikesAndValleysSchemeVo"/> |
| | | <where> |
| | | <if test="schemeName != null and schemeName != ''"> and scheme_name like concat('%', #{schemeName}, '%')</if> |
| | | <if test="executeTime != null "> and execute_time = #{executeTime}</if> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectSpikesAndValleysSchemeById" parameterType="String" resultMap="SpikesAndValleysSchemeResult"> |
| | | <include refid="selectSpikesAndValleysSchemeVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertSpikesAndValleysScheme" parameterType="SpikesAndValleysScheme"> |
| | | insert into spikes_and_valleys_scheme |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">id,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="schemeName != null">scheme_name,</if> |
| | | <if test="executeTime != null">execute_time,</if> |
| | | <if test="type != null">type,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="schemeName != null">#{schemeName},</if> |
| | | <if test="executeTime != null">#{executeTime},</if> |
| | | <if test="type != null">#{type},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateSpikesAndValleysScheme" parameterType="SpikesAndValleysScheme"> |
| | | update spikes_and_valleys_scheme |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="schemeName != null">scheme_name = #{schemeName},</if> |
| | | <if test="executeTime != null">execute_time = #{executeTime},</if> |
| | | <if test="type != null">type = #{type},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteSpikesAndValleysSchemeById" parameterType="String"> |
| | | delete from spikes_and_valleys_scheme where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteSpikesAndValleysSchemeByIds" parameterType="String"> |
| | | delete from spikes_and_valleys_scheme where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | |
| | | <result property="updateBy" column="update_by"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="remark" column="remark"/> |
| | | <result property="singleUser" column="single_user"/> |
| | | <association property="dept" javaType="SysDept" resultMap="deptResult" /> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> |
| | | </resultMap> |
| | |
| | | u.create_by, |
| | | u.create_time, |
| | | u.remark, |
| | | u.single_user, |
| | | d.dept_id, |
| | | d.parent_id, |
| | | d.ancestors, |
| | |
| | | |
| | | <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phone_number, u.password, u.sex, |
| | | u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from |
| | | u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.single_user, d.dept_name, d.leader from |
| | | sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | where u.del_flag = '0' |
| | |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="singleUser != null and singleUser != ''">single_user,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="singleUser != null and singleUser != ''">#{singleUser},</if> |
| | | now() |
| | | ) |
| | | </insert> |
| | |
| | | <if test="loginDate != null">login_date = #{loginDate},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="singleUser != null and singleUser != ''">single_user = #{singleUser},</if> |
| | | update_time = now() |
| | | </set> |
| | | where user_id = #{userId} |
| | |
| | | </foreach> |
| | | </delete> |
| | | |
| | | </mapper> |
| | | </mapper> |