Преглед на файлове

修改查询报表接口

zhonghui преди 3 години
родител
ревизия
e6326bdb01

+ 21 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/dto/ImportFileDto.java

@@ -6,6 +6,7 @@ public class ImportFileDto {
     private String uid;
     private String absolutePath;
     private String originalName;
+    private String url;
 
     public String getName() {
         return name;
@@ -46,4 +47,24 @@ public class ImportFileDto {
     public void setOriginalName(String originalName) {
         this.originalName = originalName;
     }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    @Override
+    public String toString() {
+        return "{" +
+                "name='" + name + '\'' +
+                ", status='" + status + '\'' +
+                ", uid='" + uid + '\'' +
+                ", absolutePath='" + absolutePath + '\'' +
+                ", originalName='" + originalName + '\'' +
+                ", url='" + url + '\'' +
+                '}';
+    }
 }

+ 10 - 0
boman-report/src/main/java/com/boman/report/controller/StatisticReportController.java

@@ -57,4 +57,14 @@ public class StatisticReportController extends BaseController {
     {
         return statisticReportService.getReportInfo(id);
     }
+
+    /**
+     * 获取报表详情
+     * @param id
+     * @return
+     */
+    @GetMapping(value = "/detail/{id}")
+    public AjaxResult getDetailById(@PathVariable Long id) {
+        return AjaxResult.success(statisticReportService.getDetailById(id));
+    }
 }

+ 3 - 0
boman-report/src/main/java/com/boman/report/mapper/StatisticReportMapper.java

@@ -23,6 +23,7 @@ public interface StatisticReportMapper {
     int insert(StatisticReport report);
 
     int update(StatisticReport report);
+
     /**
      * 获取表报详情
      * @param id
@@ -30,4 +31,6 @@ public interface StatisticReportMapper {
      */
     StatisticReportVo getReportInfo(Long id);
 
+    StatisticReport getDetailById(Long id);
+
 }

+ 2 - 0
boman-report/src/main/java/com/boman/report/service/StatisticReportService.java

@@ -32,6 +32,8 @@ public interface StatisticReportService {
      * @return
      */
     AjaxResult getReportInfo (Long id);
+
+    public StatisticReport getDetailById(Long id);
    
 }
 

+ 12 - 4
boman-report/src/main/java/com/boman/report/service/impl/ImportServiceImpl.java

@@ -69,12 +69,20 @@ public class ImportServiceImpl implements IImportServcie {
         ImportExcelDto dto = new ImportExcelDto();
         dto.setDataList(list);
         dto.setTableName(tableName);
-        remoteObjService.importCommonData(dto);
+
+        try {
+            remoteObjService.importCommonData(dto);
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+
         // 上传成功后需要修改上报人的状态
         StatisticReportPersonnel personnel = new StatisticReportPersonnel();
         personnel.setId(personnelId);
         personnel.setStatus("2");
-        personnel.setUploadFile(fileDto.toString());
+
+        JSONObject json = (JSONObject) JSONObject.toJSON(fileDto);
+        personnel.setUploadFile(json.toJSONString());
         personnelService.updateStatus(personnel);
         return AjaxResult.success();
     }
@@ -183,8 +191,8 @@ public class ImportServiceImpl implements IImportServcie {
         columns.add(columnMap.get(UPDATE_TIME));
     }
 
-    private String getFileRealPath(ImportFileDto fileJson) {
-        return "";
+    private String getFileRealPath(ImportFileDto dto) {
+        return dto.getAbsolutePath();
     }
 
     public static void main(String[] args) {

+ 5 - 0
boman-report/src/main/java/com/boman/report/service/impl/StatisticReportServiceImpl.java

@@ -137,6 +137,11 @@ public class StatisticReportServiceImpl implements StatisticReportService {
         return statisticReportMapper.selectList(report);
     }
 
+    @Override
+    public StatisticReport getDetailById(Long id) {
+        return statisticReportMapper.getDetailById(id);
+    }
+
     @Override
     @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
     public AjaxResult saveOrUpdate(StatisticReport report) {

+ 15 - 0
boman-report/src/main/resources/mapper/StatisticReportMapper.xml

@@ -20,6 +20,15 @@
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
         <result property="isDel" column="is_del"/>
+        <collection  property="personnels"   javaType="java.util.List" resultMap="StatisticReportPersonnelResult" />
+    </resultMap>
+
+    <resultMap type="com.boman.domain.entity.StatisticReportPersonnel" id="StatisticReportPersonnelResult">
+        <id property="id" column="psersonnel_id"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
     </resultMap>
 
     <resultMap type="com.boman.domain.entity.vo.StatisticReportVo" id="StatisticReportVoResult">
@@ -60,6 +69,12 @@
         select * from statistic_report
     </sql>
 
+    <select id="getDetailById" parameterType="Long" resultMap="StatisticReportResult">
+        select t.*, p.id as psersonnel_id, p.dept_id, p.dept_name, p.user_id, p.user_name
+        from statistic_report t left join statistic_report_personnel p on t.id = p.statistic_id
+        where t.id = #{id}
+    </select>
+
     <select id="selectList" parameterType="com.boman.domain.entity.StatisticReport" resultMap="StatisticReportResult">
         <include refid="selectReportVo"/>
         <where>