李宇
2021-01-18 21db6e4c4c11099eb053c837a0a207a537bb6453
添加危废全年统计接口
已修改6个文件
90 ■■■■ 文件已修改
src/main/java/com/nanometer/smartlab/api/ApiAction.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/service/HazardousWasteService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/service/HazardousWasteServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
智慧实验室接口.docx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/nanometer/smartlab/api/ApiAction.java
@@ -1576,7 +1576,7 @@
     */
    @ResponseBody
    @RequestMapping("hazardousWaste/getWasteInfo")
    public Object getLabAndUser(@RequestParam(required=true) int adminFlag,@RequestParam(required=true) String name,@RequestParam(required=false) String status
    public Object getWasteInfo(@RequestParam(required=true) int adminFlag,@RequestParam(required=true) String name,@RequestParam(required=false) String status
    ,@RequestParam(required=false) String starttime,@RequestParam(required=false) String endtime){
        try {
            if (StringUtils.isBlank(name)){
@@ -1601,7 +1601,7 @@
     */
    @ResponseBody
    @RequestMapping("hazardousWaste/changeStatus")
    public Object getLabAndUser(@RequestParam(required=true) String tid,@RequestParam(required=true) String status,
    public Object changeStatus(@RequestParam(required=true) String tid,@RequestParam(required=true) String status,
                                @RequestParam(required=true) String updator){
        try {
            if (StringUtils.isBlank(tid) || StringUtils.isBlank(status)){
@@ -1688,4 +1688,33 @@
    }
    /**
     * 根据用户名获取危废全年统计列表
     *
     */
    @ResponseBody
    @RequestMapping("hazardousWaste/getWasteStatistics")
    public Object getWasteStatistics(@RequestParam(required=true) int adminFlag,@RequestParam(required=true) String name){
        try {
            if (StringUtils.isBlank(name)){
                return  ResponseModel.getErrInstance("姓名不能为空");
            }
            Calendar calendar = Calendar.getInstance();
            int year = calendar.get(Calendar.YEAR);
            String status = "已确认";
            String starttime = year+"-01-01 00:00:00";
            String endtime = year+"-12-31 23:59:59";
            List<HazardousWaste> hazardousWasters = new ArrayList<>();
            if (adminFlag == 2){
                hazardousWasters = hazardousWasteService.setAllWasterCount(starttime,endtime,status,null);
            }else if (adminFlag == 1) {
                hazardousWasters = hazardousWasteService.setAllWasterCount(starttime,endtime,status,name);
            }
            return ResponseModel.getOkInstence(hazardousWasters);
        }catch (Exception e){
            e.printStackTrace();
            logger.info(e);
            return ResponseModel.getErrInstance("系统出错");
        }
    }
}
src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.java
@@ -33,4 +33,6 @@
    List<HazardousWaste> setAllWasters(@Param("starttime") String starttime,@Param("endtime") String endtime,@Param("status") String status,@Param("applyPerson") String applyPerson);
    HazardousWaste selectByTid(@Param("tid") String tid);
    List<HazardousWaste> setAllWasterCount(@Param("starttime") String starttime,@Param("endtime") String endtime,@Param("status") String status,@Param("applyPerson") String applyPerson);
}
src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml
@@ -226,6 +226,26 @@
      updatetime = #{updatetime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="setAllWasterCount" resultType="com.nanometer.smartlab.entity.HazardousWaste">
    select
    sum(acid) as acid,sum(alkali) as alkali, sum(organic) as organic,sum(solid) as solid,sum(medical) as medical
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="starttime != null and starttime != ''">
        and create_time &gt;= #{starttime}
      </if>
      <if test="endtime != null and endtime != ''">
        and create_time &lt;= #{endtime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
    </where>
  </select>
  <select id="setAllWasters" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
@@ -233,10 +253,10 @@
    <where>
      1 = 1
      <if test="starttime != null and starttime != ''">
        and create_time &gt; #{starttime}
        and create_time &gt;= #{starttime}
      </if>
      <if test="endtime != null and endtime != ''">
        and create_time &lt; #{endtime}
        and create_time &lt;= #{endtime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
@@ -255,10 +275,10 @@
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
        and create_time &gt;= #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
        and create_time &lt;= #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
@@ -289,10 +309,10 @@
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
        and create_time &gt;= #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
        and create_time &lt;= #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
@@ -319,10 +339,10 @@
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
        and create_time &gt;= #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
        and create_time &lt;= #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
@@ -348,10 +368,10 @@
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
        and create_time &gt;= #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
        and create_time &lt;= #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
@@ -376,10 +396,10 @@
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
        and create_time &gt;= #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
        and create_time &lt;= #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
@@ -408,10 +428,10 @@
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
        and create_time &gt;= #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
        and create_time &lt;= #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
src/main/java/com/nanometer/smartlab/service/HazardousWasteService.java
@@ -31,4 +31,6 @@
    HazardousWaste selectByTid(String tid);
    void updateWaste(HazardousWaste hazardousWaste);
    List<HazardousWaste> setAllWasterCount(String starttime, String endtime, String status, String applyPerson);
}
src/main/java/com/nanometer/smartlab/service/HazardousWasteServiceImpl.java
@@ -162,4 +162,9 @@
        hazardousWasteMapper.updateByPrimaryKeySelective(hazardousWaste);
    }
    @Override
    public List<HazardousWaste> setAllWasterCount(String starttime, String endtime, String status, String applyPerson) {
        return hazardousWasteMapper.setAllWasterCount(starttime, endtime, status, applyPerson);
    }
}
智慧实验室接口.docx
Binary files differ