洪城义警-正式版后台
tangzy
2021-08-02 ffeb38a6d9d6288f9e6a2c303a6b063f7b60b638
1.能量树
1 files modified
16 files added
934 ■■■■■ changed files
src/main/java/org/springblade/common/config/BladeConfiguration.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/controller/EnergyController.java 213 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/controller/EnergyTreeController.java 125 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/entity/Energy.java 53 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/entity/EnergyTree.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.java 40 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.xml 37 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.xml 23 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/service/IEnergyService.java 40 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/service/IEnergyTreeService.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/service/impl/EnergyServiceImpl.java 69 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/service/impl/EnergyTreeServiceImpl.java 49 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/vo/EnergyTreeVO.java 37 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/vo/EnergyVO.java 37 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/wrapper/EnergyTreeWrapper.java 46 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/energy/wrapper/EnergyWrapper.java 46 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -95,6 +95,7 @@
        secureRegistry.excludePathPatterns("/wj/wj/**");
        secureRegistry.excludePathPatterns("/xlfeedback/xlfeedback/**");
        secureRegistry.excludePathPatterns("/zc/**");
        secureRegistry.excludePathPatterns("/energy/**");
        return secureRegistry;
    }
src/main/java/org/springblade/modules/energy/controller/EnergyController.java
New file
@@ -0,0 +1,213 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.dj.entity.Dj;
import org.springblade.modules.dj.service.IDjService;
import org.springblade.modules.dj.vo.DjVO;
import org.springblade.modules.dj.wrapper.DjWrapper;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
import org.springblade.modules.energy.service.IEnergyService;
import org.springblade.modules.energy.service.IEnergyTreeService;
import org.springblade.modules.energy.vo.EnergyVO;
import org.springblade.modules.energy.wrapper.EnergyWrapper;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 *  控制器
 *
 * @author BladeX
 * @since 2020-07-19
 */
@RestController
@AllArgsConstructor
@RequestMapping("/energy")
@Api(value = "", tags = "接口")
public class EnergyController extends BladeController {
    private final IEnergyService energyService;
    private final IEnergyTreeService energyTreeService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入dj")
    public R<EnergyVO> detail(Energy energy) {
        Energy detail = energyService.getOne(Condition.getQueryWrapper(energy));
        return R.data(EnergyWrapper.build().entityVO(detail));
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入dj")
    public R<IPage<EnergyVO>> list(Energy energy, Query query) {
        IPage<Energy> pages = energyService.page(Condition.getPage(query), Condition.getQueryWrapper(energy));
        return R.data(EnergyWrapper.build().pageVO(pages));
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入dj")
    public R save(@Valid @RequestBody Energy energy) {
        List<String> list = energyService.selectEnergyTree(energy.getIdentification());
        if (list==null){
            EnergyTree energyTree= new EnergyTree();
            energyTree.setIdentification(energy.getIdentification());
            energyTreeService.save(energyTree);
        }
        return R.status(energyService.save(energy));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入dj")
    public R update(@Valid @RequestBody Energy energy) {
        return R.status(energyService.updateById(energy));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入dj")
    public R submit(@Valid @RequestBody Energy energy) {
        return R.status(energyService.saveOrUpdate(energy));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(energyService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 能量统计
     * @return
     */
    @PostMapping("/selectTreeNum")
    public R selectTreeNum() {
        Date date=new Date();
        DateFormat format=new SimpleDateFormat("yyyy-MM-dd");
        String time=format.format(date);
        List<String> list = energyService.selectTreeNum(time);
        List<List<String>> lists = splitList(list, 3);
        return R.data(lists);
    }
    /**
     * 拾取能量
     * @param id
     * @return
     */
    @PostMapping("/updateEnergyId")
    public R updateEnergyId(String id,String identification) {
        String[] strArray = id.split(",");
        for (int i = 0; i < strArray.length; i++) {
            energyService.updateEnergyId(strArray[i]);
        }
        //能量树
        String nums = energyTreeService.selectNum(identification);
        Integer a=Integer.valueOf(nums);
        int length = strArray.length;
        int i = a + length;
        String num=String.valueOf(i);
        energyTreeService.updateEnergyTreeId(num,identification);
        return R.success("拾取成功");
    }
    private List<List<String>> splitList(List<String> list , int groupSize){
        int length = list.size();
        // 计算可以分成多少组
        int num = ( length + groupSize - 1 )/groupSize ; // TODO
        List<List<String>> newList = new ArrayList<>(num);
        for (int i = 0; i < num; i++) {
            // 开始位置
            int fromIndex = i * groupSize;
            // 结束位置
            int toIndex = (i+1) * groupSize < length ? ( i+1 ) * groupSize : length ;
            newList.add(list.subList(fromIndex,toIndex)) ;
        }
        return  newList ;
    }
    /**
     * 每天23点自动拾取能量
     *
     */
    @PostMapping("/pickup")
    public void pickup(String ids,String time,String identification) {
        String[] split = ids.split(",");
        String strArrays = "";
        for (int i = 0; i < split.length; i++) {
            strArrays += "'" + split[i] + "',";
        }
        String code = strArrays.substring(0, strArrays.length() - 1);
        energyService.updateEnergyType(code,time);
        //能量树
        String nums = energyTreeService.selectNum(identification);
        Integer a=Integer.valueOf(nums);
        int length = split.length;
        int i = a + length;
        String num=String.valueOf(i);
        energyTreeService.updateEnergyTreeId(num,identification);
    }
}
src/main/java/org/springblade/modules/energy/controller/EnergyTreeController.java
New file
@@ -0,0 +1,125 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
import org.springblade.modules.energy.service.IEnergyService;
import org.springblade.modules.energy.service.IEnergyTreeService;
import org.springblade.modules.energy.vo.EnergyTreeVO;
import org.springblade.modules.energy.vo.EnergyVO;
import org.springblade.modules.energy.wrapper.EnergyTreeWrapper;
import org.springblade.modules.energy.wrapper.EnergyWrapper;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 *  控制器
 *
 * @author BladeX
 * @since 2020-07-19
 */
@RestController
@AllArgsConstructor
@RequestMapping("/energyTree")
@Api(value = "", tags = "接口")
public class EnergyTreeController extends BladeController {
    private final IEnergyTreeService energyTreeService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入dj")
    public R<EnergyTreeVO> detail(EnergyTree energyTree) {
        EnergyTree detail = energyTreeService.getOne(Condition.getQueryWrapper(energyTree));
        return R.data(EnergyTreeWrapper.build().entityVO(detail));
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入dj")
    public R<IPage<EnergyTreeVO>> list(EnergyTree energyTree, Query query) {
        IPage<EnergyTree> pages = energyTreeService.page(Condition.getPage(query), Condition.getQueryWrapper(energyTree));
        return R.data(EnergyTreeWrapper.build().pageVO(pages));
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入dj")
    public R save(@Valid @RequestBody EnergyTree energyTree) {
        return R.status(energyTreeService.save(energyTree));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入dj")
    public R update(@Valid @RequestBody EnergyTree energyTree) {
        return R.status(energyTreeService.updateById(energyTree));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入dj")
    public R submit(@Valid @RequestBody EnergyTree energyTree) {
        return R.status(energyTreeService.saveOrUpdate(energyTree));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(energyTreeService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/energy/entity/Energy.java
New file
@@ -0,0 +1,53 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 实体类
 *
 * @author BladeX
 * @since 2020-07-19
 */
@Data
@TableName("sys_energy")
@ApiModel(value = "Dj对象", description = "Dj对象")
public class Energy implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String identification;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date time;
    private String type;
}
src/main/java/org/springblade/modules/energy/entity/EnergyTree.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 实体类
 *
 * @author BladeX
 * @since 2020-07-19
 */
@Data
@TableName("sys_energy")
@ApiModel(value = "Dj对象", description = "Dj对象")
public class EnergyTree implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String identification;
    private String num;
}
src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.java
New file
@@ -0,0 +1,40 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.dj.entity.Dj;
import org.springblade.modules.dj.vo.DjVO;
import org.springblade.modules.energy.entity.Energy;
import java.util.List;
import java.util.Map;
/**
 *  Mapper 接口
 *
 * @author BladeX
 * @since 2020-07-19
 */
public interface EnergyMapper extends BaseMapper<Energy> {
    List<String> selectTreeNum(String time);
    List<String> selectEnergyTree(String identification);
    void  updateEnergyId(String id);
    void  updateEnergyType(String code,String time);
    String selectType(String time);
}
src/main/java/org/springblade/modules/energy/mapper/EnergyMapper.xml
New file
@@ -0,0 +1,37 @@
<?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="org.springblade.modules.energy.mapper.EnergyMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="EnergyResultMap" type="org.springblade.modules.energy.entity.Energy">
        <id column="id" property="id"/>
        <result column="identification" property="identification"/>
        <result column="time" property="time"/>
        <result column="type" property="type"/>
    </resultMap>
    <select id="selectTreeNum" resultType="java.util.HashMap">
        SELECT *  FROM `sys_energy` WHERE time=#{time} and type=1
    </select>
    <update id="updateEnergyId">
        UPDATE sys_energy SET
            type = 0 WHERE id = #{id}
    </update>
    <select id="selectType" resultType="java.lang.String">
        select GROUP_CONCAT(id) as ids from sys_energy WHERE type=1 and time=#{time};
    </select>
    <update id="updateEnergyType">
        UPDATE sys_energy SET
            type = 0 WHERE id in(${code}) and time=#{time}
    </update>
    <select id="selectEnergyTree" resultType="java.util.HashMap">
        SELECT *  FROM `sys_energytree` where identification=#{identification}
    </select>
</mapper>
src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author BladeX
 * @since 2020-07-19
 */
public interface EnergyTreeMapper extends BaseMapper<EnergyTree> {
    String selectNum(String identification);
    void updateEnergyTreeId(String num,String identification);
}
src/main/java/org/springblade/modules/energy/mapper/EnergyTreeMapper.xml
New file
@@ -0,0 +1,23 @@
<?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="org.springblade.modules.energy.mapper.EnergyTreeMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="EnergyTreeResultMap" type="org.springblade.modules.energy.entity.EnergyTree">
        <id column="id" property="id"/>
        <result column="identification" property="identification"/>
        <result column="num" property="num"/>
    </resultMap>
    <select id="selectNum" resultType="java.lang.String">
        SELECT num FROM sys_energytree where  identification=#{identification}
    </select>
    <update id="updateEnergyTreeId">
        UPDATE sys_energytree SET
            num =#{num} WHERE identification = #{identification}
    </update>
</mapper>
src/main/java/org/springblade/modules/energy/service/IEnergyService.java
New file
@@ -0,0 +1,40 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.dj.entity.Dj;
import org.springblade.modules.dj.vo.DjVO;
import org.springblade.modules.energy.entity.Energy;
import java.util.List;
import java.util.Map;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2020-07-19
 */
public interface IEnergyService extends IService<Energy> {
    List<String> selectTreeNum(String time);
    void  updateEnergyId(String id);
    void  updateEnergyType(String code,String time);
    String selectType(String time);
    List<String> selectEnergyTree(String identification);
}
src/main/java/org/springblade/modules/energy/service/IEnergyTreeService.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
import java.util.List;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2020-07-19
 */
public interface IEnergyTreeService extends IService<EnergyTree> {
    String selectNum(String identification);
    void updateEnergyTreeId(String num,String identification);
}
src/main/java/org/springblade/modules/energy/service/impl/EnergyServiceImpl.java
New file
@@ -0,0 +1,69 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.dj.entity.Dj;
import org.springblade.modules.dj.mapper.DjMapper;
import org.springblade.modules.dj.service.IDjService;
import org.springblade.modules.dj.vo.DjVO;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.mapper.EnergyMapper;
import org.springblade.modules.energy.service.IEnergyService;
import org.springblade.modules.energy.vo.EnergyVO;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2020-07-19
 */
@Service
public class EnergyServiceImpl extends ServiceImpl<EnergyMapper, Energy> implements IEnergyService {
    @Override
    public List<String> selectTreeNum(String time) {
        return baseMapper.selectTreeNum(time);
    }
    @Override
    public void updateEnergyId(String id) {
        baseMapper.updateEnergyId(id);
    }
    @Override
    public void updateEnergyType(String code,String time) {
        baseMapper.updateEnergyType(code,time);
    }
    @Override
    public String selectType(String time) {
        return baseMapper.selectType(time);
    }
    @Override
    public List<String> selectEnergyTree(String identification) {
        return baseMapper.selectEnergyTree(identification);
    }
}
src/main/java/org/springblade/modules/energy/service/impl/EnergyTreeServiceImpl.java
New file
@@ -0,0 +1,49 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
import org.springblade.modules.energy.mapper.EnergyMapper;
import org.springblade.modules.energy.mapper.EnergyTreeMapper;
import org.springblade.modules.energy.service.IEnergyService;
import org.springblade.modules.energy.service.IEnergyTreeService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2020-07-19
 */
@Service
public class EnergyTreeServiceImpl extends ServiceImpl<EnergyTreeMapper, EnergyTree> implements IEnergyTreeService {
    @Override
    public String selectNum(String identification) {
        return baseMapper.selectNum(identification);
    }
    @Override
    public void updateEnergyTreeId(String num, String identification) {
        baseMapper.updateEnergyTreeId(num, identification);
    }
}
src/main/java/org/springblade/modules/energy/vo/EnergyTreeVO.java
New file
@@ -0,0 +1,37 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2020-07-19
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "EnergyTree对象", description = "EnergyTree对象")
public class EnergyTreeVO extends EnergyTree {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/energy/vo/EnergyVO.java
New file
@@ -0,0 +1,37 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.modules.dj.entity.Dj;
import org.springblade.modules.energy.entity.Energy;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2020-07-19
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Energy对象", description = "Energy对象")
public class EnergyVO extends Energy {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/energy/wrapper/EnergyTreeWrapper.java
New file
@@ -0,0 +1,46 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.entity.EnergyTree;
import org.springblade.modules.energy.vo.EnergyTreeVO;
import org.springblade.modules.energy.vo.EnergyVO;
import java.util.Objects;
/**
 * 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2020-07-19
 */
public class EnergyTreeWrapper extends BaseEntityWrapper<EnergyTree, EnergyTreeVO> {
    public static EnergyTreeWrapper build() {
        return new EnergyTreeWrapper();
     }
    @Override
    public EnergyTreeVO entityVO(EnergyTree energyTree) {
        EnergyTreeVO energyTreeVO = Objects.requireNonNull(BeanUtil.copy(energyTree, EnergyTreeVO.class));
        return energyTreeVO;
    }
}
src/main/java/org/springblade/modules/energy/wrapper/EnergyWrapper.java
New file
@@ -0,0 +1,46 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.energy.wrapper;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.dj.entity.Dj;
import org.springblade.modules.dj.vo.DjVO;
import org.springblade.modules.energy.entity.Energy;
import org.springblade.modules.energy.vo.EnergyVO;
import java.util.Objects;
/**
 * 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2020-07-19
 */
public class EnergyWrapper extends BaseEntityWrapper<Energy, EnergyVO> {
    public static EnergyWrapper build() {
        return new EnergyWrapper();
     }
    @Override
    public EnergyVO entityVO(Energy energy) {
        EnergyVO energyVO = Objects.requireNonNull(BeanUtil.copy(energy, EnergyVO.class));
        return energyVO;
    }
}