huangjn 3 vuotta sitten
vanhempi
commit
69c103f787

+ 34 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/FirstInformationDTO.java

@@ -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.business.dto;
+
+import org.springblade.business.entity.FirstInformation;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 首件信息记录表数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FirstInformationDTO extends FirstInformation {
+	private static final long serialVersionUID = 1L;
+
+}

+ 101 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/FirstInformation.java

@@ -0,0 +1,101 @@
+/*
+ *      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.business.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 首件信息记录表实体类
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+@Data
+@TableName("u_first_information")
+@EqualsAndHashCode(callSuper = true)
+public class FirstInformation extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 节点ID
+     */
+    @ApiModelProperty("节点ID")
+    private Long wbsNodeId;
+
+    /**
+     * 文件名称
+     */
+    @ApiModelProperty("文件名称")
+    private String fileName;
+
+    /**
+     * 填报时间
+     */
+    @ApiModelProperty("填报时间")
+    private String reportTime;
+
+    /**
+     * 数据ID,通过这个字段去寻找相关联的数据
+     */
+    private Long dataId;
+
+    /**
+     * 流程批次
+     */
+    @ApiModelProperty("流程批次")
+    private Integer reportNumber;
+
+    /**
+     * 创建人姓名
+     */
+    @ApiModelProperty("创建人姓名")
+    private String createUserName;
+
+    /**
+     * 流程ID
+     */
+    @ApiModelProperty("流程ID")
+    private String taskId;
+
+    /**
+     * 1施工2质检
+     */
+    @ApiModelProperty("1施工2质检")
+    private Integer classify;
+
+    public FirstInformation(String fileName, Long wbsNodeId, Integer reportNumber, Integer status, Long userId, String userName, Long deptId){
+        this.fileName = fileName;
+        this.wbsNodeId = wbsNodeId;
+        this.reportNumber = reportNumber;
+        this.setStatus(status);
+        this.setCreateUser(userId);
+        this.createUserName = userName;
+        this.setDataId(deptId);
+        this.setCreateTime(new Date());
+    }
+
+    public FirstInformation(){}
+
+}

+ 70 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/FirstInformationVO.java

@@ -0,0 +1,70 @@
+/*
+ *      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.business.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.springblade.business.entity.FirstInformation;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 首件信息记录表视图实体类
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class FirstInformationVO extends FirstInformation {
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 输入框通用查询
+	 */
+	@ApiModelProperty("输入框通用查询")
+	private String queryValue;
+
+	/**
+	 * 时间查询
+	 */
+	@ApiModelProperty("时间查询,间隔用~")
+	private String betweenTime;
+
+	private String startTime;
+
+	private String endTime;
+
+	/**
+	 * 当前页
+	 */
+	@ApiModelProperty("当前页")
+	private Integer current;
+
+	/**
+	 * 当前页显示条数
+	 */
+	@ApiModelProperty("当前页显示条数")
+	private Integer size;
+
+	@ApiModelProperty("节点查询")
+	private String wbsNodeIds;
+
+	private List<String> wbsNodeArray;
+
+}

+ 47 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/FirstInformationController.java

@@ -0,0 +1,47 @@
+package org.springblade.business.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.*;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.business.vo.FirstInformationVO;
+import org.springblade.business.service.IFirstInformationService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 首件信息记录表 控制器
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/firstInformation")
+@Api(value = "首件信息记录表", tags = "首件信息记录表接口")
+public class FirstInformationController extends BladeController {
+
+	private final IFirstInformationService firstInformationService;
+
+	/**
+	 * 自定义分页 首件信息记录表
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "分页")
+	public R<IPage<FirstInformationVO>> page(FirstInformationVO vo) {
+		//创建分页信息
+		Query query = new Query();
+		query.setCurrent(vo.getCurrent());
+		query.setSize(vo.getSize());
+
+		return R.data(firstInformationService.selectFirstInformationPage(Condition.getPage(query), vo));
+	}
+
+	
+}

+ 41 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/FirstInformationMapper.java

@@ -0,0 +1,41 @@
+/*
+ *      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.business.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.business.entity.FirstInformation;
+import org.springblade.business.vo.FirstInformationVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 首件信息记录表 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+public interface FirstInformationMapper extends BaseMapper<FirstInformation> {
+
+	Integer countFirstInformation(@Param("vo")FirstInformationVO vo);
+
+	/**
+	 * 自定义分页
+	 */
+	List<FirstInformationVO> selectFirstInformationPage(@Param("current")Long current, @Param("size")Long size, @Param("vo")FirstInformationVO vo);
+
+}

+ 86 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/FirstInformationMapper.xml

@@ -0,0 +1,86 @@
+<?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.business.mapper.FirstInformationMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="firstInformationResultMap" type="org.springblade.business.entity.FirstInformation">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_user_name" property="createUserName"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="wbs_node_id" property="wbsNodeId"/>
+        <result column="file_name" property="fileName"/>
+        <result column="data_id" property="dataId"/>
+        <result column="report_number" property="reportNumber"/>
+        <result column="report_time" property="reportTime"/>
+        <result column="task_id" property="taskId"/>
+        <result column="classify" property="classify"/>
+    </resultMap>
+
+    <select id="countFirstInformation" resultType="java.lang.Integer">
+        select count(id) from u_first_information
+        where
+          is_deleted = 0
+        <if test="vo.betweenTime != null and vo.betweenTime != ''">
+            and report_time between #{vo.startTime} and #{vo.endTime}
+        </if>
+        <if test="vo.status != null">
+            and status = #{vo.status}
+        </if>
+        <if test="vo.reportNumber != null">
+            and report_number = #{vo.reportNumber}
+        </if>
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+            and file_name like concat('%',#{vo.queryValue},'%')
+        </if>
+        <if test="vo.wbsNodeArray != null and vo.wbsNodeArray.size > 0">
+            and wbs_node_id in
+            <foreach collection="vo.wbsNodeArray" item="wbsNodeIds" open="(" separator="," close=")">
+                #{wbsNodeIds}
+            </foreach>
+        </if>
+    </select>
+
+    <select id="selectFirstInformationPage" resultMap="firstInformationResultMap">
+        select
+          id,
+          file_name,
+          create_user_name,
+          report_number,
+          report_time,
+          wbs_node_id,
+          status,
+          data_id,
+          task_id,
+          classify
+        from u_first_information
+        where
+          is_deleted = 0
+        <if test="vo.betweenTime != null and vo.betweenTime != ''">
+            and report_time between #{vo.startTime} and #{vo.endTime}
+        </if>
+        <if test="vo.status != null">
+            and status = #{vo.status}
+        </if>
+        <if test="vo.reportNumber != null">
+            and report_number = #{vo.reportNumber}
+        </if>
+        <if test="vo.queryValue != null and vo.queryValue != ''">
+            and file_name like concat('%',#{vo.queryValue},'%')
+        </if>
+        <if test="vo.wbsNodeArray != null and vo.wbsNodeArray.size > 0">
+            and wbs_node_id in
+            <foreach collection="vo.wbsNodeArray" item="wbsNodeIds" open="(" separator="," close=")">
+                #{wbsNodeIds}
+            </foreach>
+        </if>
+        order by wbs_node_id, report_time DESC
+        limit ${current}, ${size}
+    </select>
+
+</mapper>

+ 56 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IFirstInformationService.java

@@ -0,0 +1,56 @@
+/*
+ *      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.business.service;
+
+import org.springblade.business.entity.FirstInformation;
+import org.springblade.business.vo.FirstInformationVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 首件信息记录表 服务类
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+public interface IFirstInformationService extends BaseService<FirstInformation> {
+
+	/**
+	 * 修改首件记录表信息
+	 * @param id 主键
+	 * @param fileName 文件名称
+	 * @param reportNumber 上报批次
+	 * @param status 流程状态
+	 * @return 修改结果
+	 */
+	Boolean updateFirstInformation(Long id, String fileName, Integer reportNumber, Integer status);
+
+	/**
+	 * 保存首件记录表信息
+	 * @param wbsNodeId 当前资料所在节点ID
+	 * @param fileName 文件名称
+	 * @param dataId 数据ID
+	 * @return 保存后数据的ID
+	 */
+	Long saveFirstInformation(Long wbsNodeId, String fileName, Long dataId);
+
+	/**
+	 * 自定义分页
+	 */
+	IPage<FirstInformationVO> selectFirstInformationPage(IPage<FirstInformationVO> page, FirstInformationVO vo);
+
+}

+ 0 - 5
blade-service/blade-business/src/main/java/org/springblade/business/service/WeatherInfoService.java

@@ -13,9 +13,4 @@ public interface WeatherInfoService extends IService<WeatherInfo> {
      */
     List<Map<String, List<Map<String,Object>>>> queryWeatherAllByYear(String year, String contractId);
 
-    /**
-     * 自动同步当天天气
-     */
-    void syncWeatherInfo();
-
 }

+ 101 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/FirstInformationServiceImpl.java

@@ -0,0 +1,101 @@
+/*
+ *      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.business.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.business.entity.FirstInformation;
+import org.springblade.business.vo.FirstInformationVO;
+import org.springblade.business.mapper.FirstInformationMapper;
+import org.springblade.business.service.IFirstInformationService;
+import org.springblade.common.utils.SnowFlakeUtil;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 首件信息记录表 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-06-20
+ */
+@Service
+public class FirstInformationServiceImpl extends BaseServiceImpl<FirstInformationMapper, FirstInformation> implements IFirstInformationService {
+
+	@Override
+	public Boolean updateFirstInformation(Long id, String fileName, Integer reportNumber, Integer status) {
+		if(StringUtils.isEmpty(fileName) && reportNumber == null && status == null){
+			return null;
+		} else {
+			FirstInformation update = new FirstInformation();
+			update.setId(id);
+			if(StringUtils.isNotEmpty(fileName)){
+				update.setFileName(fileName);
+			}
+			if(reportNumber != null){
+				update.setReportNumber(reportNumber);
+			}
+			if(status != null){
+				update.setStatus(status);
+			}
+			return this.updateById(update);
+		}
+	}
+
+	@Override
+	public Long saveFirstInformation(Long wbsNodeId, String fileName, Long dataId) {
+		BladeUser bladeUser = AuthUtil.getUser();
+		FirstInformation newData = new FirstInformation(fileName, wbsNodeId, null, 0, bladeUser.getUserId(), bladeUser.getUserName(), bladeUser.getDeptId().contains(",") ? Long.parseLong(bladeUser.getDeptId().split(",")[0]) : Long.parseLong(bladeUser.getDeptId()));
+		newData.setId(SnowFlakeUtil.getId());
+		//将主键返回,保存失败返回null
+		return this.save(newData) ? newData.getId() : null;
+	}
+
+	@Override
+	public IPage<FirstInformationVO> selectFirstInformationPage(IPage<FirstInformationVO> page, FirstInformationVO vo) {
+		//处理分页相关
+		Long current = (page.getCurrent() - 1L) * page.getSize();
+		if(StringUtils.isNotEmpty(vo.getWbsNodeIds()) && !",".equals(vo.getWbsNodeIds())){
+			List<String> wbsNodeArray = JSONArray.parseArray(JSONObject.toJSONString(vo.getWbsNodeIds().split(",")), String.class);
+			wbsNodeArray.removeIf(StringUtils::isEmpty);
+			vo.setWbsNodeArray(wbsNodeArray);
+		}
+		if(StringUtils.isNotEmpty(vo.getBetweenTime())){
+			if(vo.getBetweenTime().contains("~")){
+				String[] between = vo.getBetweenTime().split("~");
+				vo.setStartTime(between[0].trim());
+				vo.setEndTime(between[1].trim());
+			} else {
+				vo.setStartTime(vo.getBetweenTime().trim());
+				vo.setEndTime(DateUtil.format(new Date(), "yyyy-MM-dd"));
+			}
+		}
+		//获取列表总数
+		int countValue = this.baseMapper.countFirstInformation(vo);
+		//设置总数
+		page.setTotal(countValue);
+		return page.setRecords(this.baseMapper.selectFirstInformationPage(current, page.getSize(), vo));
+	}
+
+}