| | |
| | | import org.springframework.web.cors.UrlBasedCorsConfigurationSource |
| | | import org.springframework.web.filter.CorsFilter |
| | | |
| | | @Configuration |
| | | //@Configuration |
| | | class CorsConfig { |
| | | |
| | | private fun buildConfig(): CorsConfiguration { |
| | |
| | | } |
| | | } |
| | | |
| | | @Bean |
| | | // @Bean |
| | | fun corsFilter(): CorsFilter { |
| | | val source = UrlBasedCorsConfigurationSource().apply { |
| | | registerCorsConfiguration("/**", buildConfig()) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.grid.domain.ds1.entity; |
| | | |
| | | import java.util.Date; |
| | | import javax.persistence.*; |
| | | |
| | | @Table(name = "g_t_clue_internal") |
| | | public class ClueInternal { |
| | | @Id |
| | | @Column(name = "C_Id") |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | private Integer cId; |
| | | |
| | | /** |
| | | * 线索åç§° |
| | | */ |
| | | @Column(name = "C_Clue_Name") |
| | | private String cClueName; |
| | | |
| | | /** |
| | | * 线索ç»è®º |
| | | */ |
| | | @Column(name = "C_Conclusion") |
| | | private String cConclusion; |
| | | |
| | | /** |
| | | * æ¥è¦æ¶é´ |
| | | */ |
| | | @Column(name = "C_Alarm_Time") |
| | | private Date cAlarmTime; |
| | | |
| | | /** |
| | | * æ¥è¦ç«ç¹åç§° |
| | | */ |
| | | @Column(name = "C_Site_Name") |
| | | private String cSiteName; |
| | | |
| | | /** |
| | | * æ¥è¦å åï¼åå åï¼ |
| | | */ |
| | | @Column(name = "C_Factor") |
| | | private String cFactor; |
| | | |
| | | /** |
| | | * ä¸åæ¶é´ |
| | | */ |
| | | @Column(name = "C_Release_Time") |
| | | private Date cReleaseTime; |
| | | |
| | | @Column(name = "C_Air_Checked_Options") |
| | | private String cAirCheckedOptions; |
| | | |
| | | @Column(name = "C_Pollution_Checked_Options") |
| | | private String cPollutionCheckedOptions; |
| | | |
| | | @Column(name = "C_Create_Time") |
| | | private Date cCreateTime; |
| | | |
| | | @Column(name = "C_Center") |
| | | private String cCenter; |
| | | |
| | | @Column(name = "C_Zoom") |
| | | private String cZoom; |
| | | |
| | | @Column(name = "C_Longitude") |
| | | private Double cLongitude; |
| | | |
| | | @Column(name = "C_Latitude") |
| | | private Double cLatitude; |
| | | |
| | | @Column(name = "C_Site_Type") |
| | | private String cSiteType; |
| | | |
| | | /** |
| | | * çº¿ç´¢ä¸æ¥æ¶é´ |
| | | */ |
| | | @Column(name = "C_Report_Time") |
| | | private Date cReportTime; |
| | | |
| | | @Column(name = "C_Upload_Time") |
| | | private Date cUploadTime; |
| | | |
| | | @Column(name = "C_Uploaded") |
| | | private Boolean cUploaded; |
| | | |
| | | @Column(name = "C_Address") |
| | | private String cAddress; |
| | | |
| | | /** |
| | | * @return C_Id |
| | | */ |
| | | public Integer getCId() { |
| | | return cId; |
| | | } |
| | | |
| | | /** |
| | | * @param cId |
| | | */ |
| | | public void setCId(Integer cId) { |
| | | this.cId = cId; |
| | | } |
| | | |
| | | /** |
| | | * è·å线索åç§° |
| | | * |
| | | * @return C_Clue_Name - 线索åç§° |
| | | */ |
| | | public String getCClueName() { |
| | | return cClueName; |
| | | } |
| | | |
| | | /** |
| | | * 设置线索åç§° |
| | | * |
| | | * @param cClueName 线索åç§° |
| | | */ |
| | | public void setCClueName(String cClueName) { |
| | | this.cClueName = cClueName == null ? null : cClueName.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·å线索ç»è®º |
| | | * |
| | | * @return C_Conclusion - 线索ç»è®º |
| | | */ |
| | | public String getCConclusion() { |
| | | return cConclusion; |
| | | } |
| | | |
| | | /** |
| | | * 设置线索ç»è®º |
| | | * |
| | | * @param cConclusion 线索ç»è®º |
| | | */ |
| | | public void setCConclusion(String cConclusion) { |
| | | this.cConclusion = cConclusion == null ? null : cConclusion.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¦æ¶é´ |
| | | * |
| | | * @return C_Alarm_Time - æ¥è¦æ¶é´ |
| | | */ |
| | | public Date getCAlarmTime() { |
| | | return cAlarmTime; |
| | | } |
| | | |
| | | /** |
| | | * 设置æ¥è¦æ¶é´ |
| | | * |
| | | * @param cAlarmTime æ¥è¦æ¶é´ |
| | | */ |
| | | public void setCAlarmTime(Date cAlarmTime) { |
| | | this.cAlarmTime = cAlarmTime; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¦ç«ç¹åç§° |
| | | * |
| | | * @return C_Site_Name - æ¥è¦ç«ç¹åç§° |
| | | */ |
| | | public String getCSiteName() { |
| | | return cSiteName; |
| | | } |
| | | |
| | | /** |
| | | * 设置æ¥è¦ç«ç¹åç§° |
| | | * |
| | | * @param cSiteName æ¥è¦ç«ç¹åç§° |
| | | */ |
| | | public void setCSiteName(String cSiteName) { |
| | | this.cSiteName = cSiteName == null ? null : cSiteName.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥è¦å åï¼åå åï¼ |
| | | * |
| | | * @return C_Factor - æ¥è¦å åï¼åå åï¼ |
| | | */ |
| | | public String getCFactor() { |
| | | return cFactor; |
| | | } |
| | | |
| | | /** |
| | | * 设置æ¥è¦å åï¼åå åï¼ |
| | | * |
| | | * @param cFactor æ¥è¦å åï¼åå åï¼ |
| | | */ |
| | | public void setCFactor(String cFactor) { |
| | | this.cFactor = cFactor == null ? null : cFactor.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åä¸åæ¶é´ |
| | | * |
| | | * @return C_Release_Time - ä¸åæ¶é´ |
| | | */ |
| | | public Date getCReleaseTime() { |
| | | return cReleaseTime; |
| | | } |
| | | |
| | | /** |
| | | * 设置ä¸åæ¶é´ |
| | | * |
| | | * @param cReleaseTime ä¸åæ¶é´ |
| | | */ |
| | | public void setCReleaseTime(Date cReleaseTime) { |
| | | this.cReleaseTime = cReleaseTime; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Air_Checked_Options |
| | | */ |
| | | public String getCAirCheckedOptions() { |
| | | return cAirCheckedOptions; |
| | | } |
| | | |
| | | /** |
| | | * @param cAirCheckedOptions |
| | | */ |
| | | public void setCAirCheckedOptions(String cAirCheckedOptions) { |
| | | this.cAirCheckedOptions = cAirCheckedOptions == null ? null : cAirCheckedOptions.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @return C_Pollution_Checked_Options |
| | | */ |
| | | public String getCPollutionCheckedOptions() { |
| | | return cPollutionCheckedOptions; |
| | | } |
| | | |
| | | /** |
| | | * @param cPollutionCheckedOptions |
| | | */ |
| | | public void setCPollutionCheckedOptions(String cPollutionCheckedOptions) { |
| | | this.cPollutionCheckedOptions = cPollutionCheckedOptions == null ? null : cPollutionCheckedOptions.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @return C_Create_Time |
| | | */ |
| | | public Date getCCreateTime() { |
| | | return cCreateTime; |
| | | } |
| | | |
| | | /** |
| | | * @param cCreateTime |
| | | */ |
| | | public void setCCreateTime(Date cCreateTime) { |
| | | this.cCreateTime = cCreateTime; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Center |
| | | */ |
| | | public String getCCenter() { |
| | | return cCenter; |
| | | } |
| | | |
| | | /** |
| | | * @param cCenter |
| | | */ |
| | | public void setCCenter(String cCenter) { |
| | | this.cCenter = cCenter == null ? null : cCenter.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @return C_Zoom |
| | | */ |
| | | public String getCZoom() { |
| | | return cZoom; |
| | | } |
| | | |
| | | /** |
| | | * @param cZoom |
| | | */ |
| | | public void setCZoom(String cZoom) { |
| | | this.cZoom = cZoom == null ? null : cZoom.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @return C_Longitude |
| | | */ |
| | | public Double getCLongitude() { |
| | | return cLongitude; |
| | | } |
| | | |
| | | /** |
| | | * @param cLongitude |
| | | */ |
| | | public void setCLongitude(Double cLongitude) { |
| | | this.cLongitude = cLongitude; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Latitude |
| | | */ |
| | | public Double getCLatitude() { |
| | | return cLatitude; |
| | | } |
| | | |
| | | /** |
| | | * @param cLatitude |
| | | */ |
| | | public void setCLatitude(Double cLatitude) { |
| | | this.cLatitude = cLatitude; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Site_Type |
| | | */ |
| | | public String getCSiteType() { |
| | | return cSiteType; |
| | | } |
| | | |
| | | /** |
| | | * @param cSiteType |
| | | */ |
| | | public void setCSiteType(String cSiteType) { |
| | | this.cSiteType = cSiteType == null ? null : cSiteType.trim(); |
| | | } |
| | | |
| | | /** |
| | | * è·åçº¿ç´¢ä¸æ¥æ¶é´ |
| | | * |
| | | * @return C_Report_Time - çº¿ç´¢ä¸æ¥æ¶é´ |
| | | */ |
| | | public Date getCReportTime() { |
| | | return cReportTime; |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®çº¿ç´¢ä¸æ¥æ¶é´ |
| | | * |
| | | * @param cReportTime çº¿ç´¢ä¸æ¥æ¶é´ |
| | | */ |
| | | public void setCReportTime(Date cReportTime) { |
| | | this.cReportTime = cReportTime; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Upload_Time |
| | | */ |
| | | public Date getCUploadTime() { |
| | | return cUploadTime; |
| | | } |
| | | |
| | | /** |
| | | * @param cUploadTime |
| | | */ |
| | | public void setCUploadTime(Date cUploadTime) { |
| | | this.cUploadTime = cUploadTime; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Uploaded |
| | | */ |
| | | public Boolean getCUploaded() { |
| | | return cUploaded; |
| | | } |
| | | |
| | | /** |
| | | * @param cUploaded |
| | | */ |
| | | public void setCUploaded(Boolean cUploaded) { |
| | | this.cUploaded = cUploaded; |
| | | } |
| | | |
| | | /** |
| | | * @return C_Address |
| | | */ |
| | | public String getCAddress() { |
| | | return cAddress; |
| | | } |
| | | |
| | | /** |
| | | * @param cAddress |
| | | */ |
| | | public void setCAddress(String cAddress) { |
| | | this.cAddress = cAddress == null ? null : cAddress.trim(); |
| | | } |
| | | } |
| | |
| | | @Column(name = "internal_task") |
| | | private Boolean internalTask; |
| | | |
| | | private Boolean finished; |
| | | |
| | | /** |
| | | * @return guid |
| | | */ |
| | |
| | | public void setInternalTask(Boolean internalTask) { |
| | | this.internalTask = internalTask; |
| | | } |
| | | |
| | | /** |
| | | * @return finished |
| | | */ |
| | | public Boolean getFinished() { |
| | | return finished; |
| | | } |
| | | |
| | | /** |
| | | * @param finished |
| | | */ |
| | | public void setFinished(Boolean finished) { |
| | | this.finished = finished; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.grid.domain.ds1.mapper |
| | | |
| | | import com.flightfeather.grid.domain.ds1.entity.ClueInternal |
| | | import com.flightfeather.grid.domain.util.MyMapper |
| | | import com.flightfeather.grid.vo.ClueVo |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface ClueInternalMapper : MyMapper<ClueInternal?> { |
| | | |
| | | fun getClue(sTime: String?, eTime: String?): List<ClueInternal?> |
| | | |
| | | fun getClueById(clueId: Int?): ClueInternal? |
| | | } |
| | |
| | | |
| | | import com.flightfeather.grid.domain.ds1.entity.ClueTask |
| | | import com.flightfeather.grid.domain.util.MyMapper |
| | | import com.flightfeather.grid.vo.ClueTaskOptions |
| | | import com.flightfeather.grid.vo.ClueTaskSummaryVo |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface ClueTaskMapper : MyMapper<ClueTask?> |
| | | interface ClueTaskMapper : MyMapper<ClueTask?> { |
| | | |
| | | // æ¥è¯¢ä»»å¡æ°éãå®ææ°æ®ãå
é¨ä»»å¡æ°é |
| | | fun selectSummaryCount(options: ClueTaskOptions): ClueTaskSummaryVo |
| | | } |
| | |
| | | private const val TAG = "ClueHttpService" |
| | | private const val TOKEN = "e6dc8bb9e1ff0ce973fb92b4af2e4c3f" |
| | | } |
| | | private val httpMethod: HttpMethod = HttpMethod("101.230.224.80", 8082) |
| | | // åå§IPå°å |
| | | // private val httpMethod: HttpMethod = HttpMethod("101.230.224.80", 8082) |
| | | // 2025.9.22 æ ¹æ®éå®åºç¬¬ä¸æ¹æ¥å£ææ¡£ï¼ä¿®æ¹IPå°å |
| | | private val httpMethod: HttpMethod = HttpMethod("fmepi.jingan.gov.cn", 8088, true) |
| | | |
| | | @Value("\${imgPath}") |
| | | lateinit var imgPath: String |
| | |
| | | val time = updateTime.replace(" ", "%20") |
| | | // val time = updateTime |
| | | try { |
| | | val res = httpMethod.get("/feedback/queryYxfListNew", listOf(Pair("updateTime", time)), headTimeStamp()) |
| | | val res = httpMethod.get("/govProxy/feedback/queryYxfListNew", listOf(Pair("updateTime", time)), |
| | | headTimeStamp()) |
| | | val data = resCheck(res).asJsonArray |
| | | return GsonUtils.parserJsonToArrayBeans(data.toString(), ClueDto::class.java) |
| | | } catch (e: Exception) { |
| | |
| | | |
| | | fun getClueFile(clueId: String): HttpMethod.MyResponse { |
| | | try { |
| | | return httpMethod.get("/feedback/getPDFNew", listOf(Pair("id", clueId)), headTimeStamp()) |
| | | return httpMethod.get("/govProxy/feedback/getPDFNew", listOf(Pair("id", clueId)), headTimeStamp()) |
| | | } catch (e: Exception) { |
| | | throw BizException(e.message, e.cause) |
| | | } |
| | |
| | | val vo = ClueConclusionDto(clueConclusion) |
| | | val dataJson = Gson().toJson(vo) |
| | | try { |
| | | val res = httpMethod.post("/feedback/thirdReportNew", dataJson, headTimeStamp()) |
| | | val res = httpMethod.post("/govProxy/feedback/thirdReportNew", dataJson, headTimeStamp()) |
| | | resCheck(res) |
| | | clueConclusion.ccUploaded = true |
| | | clueConclusion.ccUploadTime = Date() |
| | |
| | | |
| | | val entity = builder.build() |
| | | try { |
| | | val res = httpMethod.post("/feedback/questionReportNew", entity, headTimeStamp()) |
| | | val res = httpMethod.post("/govProxy/feedback/questionReportNew", entity, headTimeStamp()) |
| | | resCheck(res) |
| | | clueQuestion.cqUploaded = true |
| | | clueQuestion.cqUploadTime = Date() |
| | |
| | | * @param deleteImg å é¤çå¾çè·¯å¾æ°ç» |
| | | * @param files å¾ç |
| | | */ |
| | | fun updateQuestionAndImage(question: String, deleteImg: String, files: Array<MultipartFile>): Boolean |
| | | fun updateQuestionAndImage(question: String, deleteImg: String?, files: Array<MultipartFile>?): Boolean |
| | | |
| | | /** |
| | | * å é¤çº¿ç´¢é®é¢åå¾ç |
| | |
| | | |
| | | import com.flightfeather.grid.domain.ds1.entity.ClueTask |
| | | import com.flightfeather.grid.vo.ClueInternalTaskVo |
| | | import com.flightfeather.grid.vo.ClueTaskOptions |
| | | import com.flightfeather.grid.vo.ClueTaskSummaryVo |
| | | import com.flightfeather.grid.vo.DataHead |
| | | |
| | | /** |
| | | * 线索任å¡ç¸å
³æå¡ |
| | |
| | | |
| | | fun getClueTask(clueTask: ClueTask): List<ClueTask?> |
| | | |
| | | fun searchClueTask(options: ClueTaskOptions, page: Int?, perPage: Int?): Pair<DataHead, List<ClueTask?>> |
| | | |
| | | fun deleteClueTask(clueTask: ClueTask): Int |
| | | |
| | | fun getClueTaskSummary(options: ClueTaskOptions): ClueTaskSummaryVo |
| | | |
| | | fun finishClueTask(clueTaskId: String): Int |
| | | |
| | | } |
| | |
| | | clueConclusion.ccUploaded = false |
| | | clueConclusion.ccCreateTime = Date() |
| | | if (clueConclusion.ccInternal == null) clueConclusion.ccInternal = false |
| | | val conclusion: ClueConclusion? |
| | | try { |
| | | val conclusion = clueConclusionMapper.selectOne(ClueConclusion().apply { cId = clueConclusion.cId }) |
| | | conclusion = clueConclusionMapper.selectOne(ClueConclusion().apply { |
| | | cId = clueConclusion.cId |
| | | ccInternal = clueConclusion.ccInternal |
| | | }) |
| | | } catch (e: Exception) { |
| | | throw BizException("æ¯æ¡çº¿ç´¢æå¤è½æä¸æ¡ç»è®ºï¼è¯¥çº¿ç´¢ç»è®ºåå¨å¤æ¡ï¼è¯·æ£æ¥ç³»ç»é»è¾") |
| | | } |
| | | // æ´æ° |
| | | return if (conclusion != null) { |
| | | if (conclusion.ccUploaded) throw BizException("线索ç»è®ºå·²æ¨éï¼æ æ³ä¿®æ¹") |
| | |
| | | val res = clueConclusionMapper.insert(clueConclusion) |
| | | res == 1 |
| | | } |
| | | } catch (e: Exception) { |
| | | throw BizException("æ¯æ¡çº¿ç´¢æå¤è½æä¸æ¡ç»è®ºï¼è¯¥çº¿ç´¢ç»è®ºåå¨å¤æ¡ï¼è¯·æ£æ¥ç³»ç»é»è¾") |
| | | } |
| | | |
| | | } |
| | | |
| | | override fun getClueConclusion(clueId: String, internal: Boolean?): ClueConclusion? { |
| | |
| | | return res == 1 |
| | | } |
| | | |
| | | override fun updateQuestionAndImage(question: String, deleteImg: String, files: Array<MultipartFile>): Boolean { |
| | | override fun updateQuestionAndImage(question: String, deleteImg: String?, files: Array<MultipartFile>?): Boolean { |
| | | val questionVo = Gson().fromJson(question, ClueQuestion::class.java) |
| | | val oldOne = clueQuestionMapper.selectByPrimaryKey(questionVo.cqId) ?: throw BizException("é®é¢ä¸åå¨") |
| | | if (oldOne.cqUploaded) throw BizException("é®é¢å·²ä¸ä¼ ï¼æ æ³ä¿®æ¹") |
| | | deleteImageFile(questionVo, deleteImg) |
| | | if (deleteImg != null) deleteImageFile(questionVo, deleteImg) |
| | | if (files != null) { |
| | | val picPath = saveImageFile(questionVo, files) |
| | | if (questionVo.cqFilePath.isEmpty()) { |
| | | questionVo.cqFilePath = picPath |
| | | } else { |
| | | questionVo.cqFilePath += ";${picPath}" |
| | | } |
| | | } |
| | | questionVo.cqCreateTime = Date() |
| | | val res = clueQuestionMapper.updateByPrimaryKeySelective(questionVo) |
| | |
| | | val oldOne = clueQuestionMapper.selectByPrimaryKey(questionId) ?: throw BizException("é®é¢ä¸åå¨") |
| | | if (oldOne.cqUploaded) throw BizException("é®é¢å·²ä¸ä¼ ï¼æ æ³å é¤") |
| | | deleteImageDirectory(oldOne) |
| | | |
| | | PageHelper.startPage<ClueQuestion>(1, 1) |
| | | clueQuestionMapper.selectByExample(Example(ClueQuestion::class.java).apply { |
| | | createCriteria().andEqualTo("cId", oldOne.cId) |
| | | orderBy("cqUid").desc() |
| | | })?.takeIf { it.isNotEmpty() }?.let { |
| | | val q = it[0] |
| | | if (q?.cqUid != oldOne.cqUid) { |
| | | q?.cqUid = oldOne.cqUid |
| | | clueQuestionMapper.updateByPrimaryKeySelective(q) |
| | | } |
| | | } |
| | | |
| | | // clueQuestionMapper.select |
| | | val res = clueQuestionMapper.deleteByPrimaryKey(questionId) |
| | | return res == 1 |
| | | } |
| | |
| | | ) |
| | | } |
| | | } |
| | | orderBy("cqId") |
| | | orderBy("cqUid") |
| | | }) |
| | | return res |
| | | } |
| | |
| | | package com.flightfeather.grid.service.impl |
| | | |
| | | import com.flightfeather.grid.config.exception.BizException |
| | | import com.flightfeather.grid.constant.ConstantHttp |
| | | import com.flightfeather.grid.domain.ds1.entity.ClueTask |
| | | import com.flightfeather.grid.domain.ds1.mapper.ClueInternalMapper |
| | | import com.flightfeather.grid.domain.ds1.mapper.ClueTaskMapper |
| | | import com.flightfeather.grid.service.ClueTaskService |
| | | import com.flightfeather.grid.vo.ClueInternalTaskVo |
| | | import com.flightfeather.grid.vo.ClueTaskOptions |
| | | import com.flightfeather.grid.vo.ClueTaskSummaryVo |
| | | import com.flightfeather.grid.vo.DataHead |
| | | import com.flightfeather.grid.web.responsePack |
| | | import com.github.pagehelper.PageHelper |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.transaction.annotation.Transactional |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.util.* |
| | | |
| | | /** |
| | |
| | | clueInternalTaskVo.clueTask?.createTime = Date() |
| | | clueInternalTaskVo.clueTask?.updateTime = Date() |
| | | clueInternalTaskVo.clueTask?.internalTask = true |
| | | clueInternalTaskVo.clueTask?.finished = false |
| | | return clueTaskMapper.insert(clueInternalTaskVo.clueTask) |
| | | } |
| | | |
| | |
| | | clueTask.createTime = Date() |
| | | clueTask.updateTime = Date() |
| | | clueTask.internalTask = false |
| | | clueTask.finished = false |
| | | return clueTaskMapper.insert(clueTask) |
| | | } |
| | | |
| | |
| | | return clueTaskMapper.select(clueTask) |
| | | } |
| | | |
| | | override fun searchClueTask(options: ClueTaskOptions, page: Int?, perPage: Int?): Pair<DataHead, List<ClueTask?>> { |
| | | val p = PageHelper.startPage<ClueTask>( |
| | | page ?: ConstantHttp.DEFAULT_PAGE_NUM, |
| | | perPage ?: ConstantHttp.DEFAULT_PAGE_SIZE |
| | | ) |
| | | clueTaskMapper.selectByExample(Example(ClueTask::class.java).apply { |
| | | createCriteria().apply { |
| | | andEqualTo("internalTask", options.internal) |
| | | andGreaterThanOrEqualTo("taskTime", options.startTime) |
| | | andLessThanOrEqualTo("taskTime", options.endTime) |
| | | andEqualTo("provinceCode", options.provinceCode) |
| | | andEqualTo("provinceName", options.provinceName) |
| | | andEqualTo("cityCode", options.cityCode) |
| | | andEqualTo("cityName", options.cityName) |
| | | andEqualTo("districtCode", options.districtCode) |
| | | andEqualTo("districtName", options.districtName) |
| | | andEqualTo("townCode", options.townCode) |
| | | andEqualTo("townName", options.townName) |
| | | andEqualTo("finished", options.finished) |
| | | } |
| | | orderBy(options.sortBy ?: "taskTime").apply { if (options.sort == "desc") desc() else asc() } |
| | | }) |
| | | |
| | | return responsePack(p) |
| | | } |
| | | |
| | | override fun deleteClueTask(clueTask: ClueTask): Int { |
| | | clueTask.guid ?: throw BizException("å é¤çº¿ç´¢ä»»å¡å¤±è´¥ï¼ç¼ºå°ä»»å¡ä¸»é®guid") |
| | | return clueTaskMapper.delete(clueTask) |
| | | } |
| | | |
| | | override fun getClueTaskSummary(options: ClueTaskOptions): ClueTaskSummaryVo { |
| | | return clueTaskMapper.selectSummaryCount(options) |
| | | } |
| | | |
| | | override fun finishClueTask(clueTaskId: String): Int { |
| | | return clueTaskMapper.updateByPrimaryKeySelective(ClueTask().apply { |
| | | guid = clueTaskId |
| | | finished = true |
| | | }) |
| | | } |
| | | } |
| | |
| | | package com.flightfeather.grid.vo |
| | | |
| | | import com.google.gson.Gson |
| | | import io.swagger.annotations.ApiModel |
| | | import io.swagger.annotations.ApiModelProperty |
| | | |
| | |
| | | message = if (success) "è¯·æ±æå" else "请æ±å¤±è´¥" |
| | | } |
| | | } |
| | | |
| | | override fun toString(): String { |
| | | return Gson().toJson(this) |
| | | } |
| | | } |
| | | |
| | | data class DataHead( |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.grid.vo |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat |
| | | import com.fasterxml.jackson.annotation.JsonInclude |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * åºåæ¥è¯¢æ¡ä»¶ |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | open class ClueTaskOptions{ |
| | | // æ¯å¦æ¯å
é¨ä»»å¡ |
| | | var internal: Boolean? = null |
| | | // è¡æ¿åºå |
| | | var provinceCode: String? = null |
| | | var provinceName: String? = null |
| | | var cityCode: String? = null |
| | | var cityName: String? = null |
| | | var districtCode: String? = null |
| | | var districtName: String? = null |
| | | var townCode: String? = null |
| | | var townName: String? = null |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | var startTime: LocalDateTime? = null |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | var endTime: LocalDateTime? = null |
| | | |
| | | // 任塿¯å¦å®æ |
| | | var finished: Boolean? = null |
| | | // æåºæ¹å¼ï¼asc: ååºæåï¼descï¼éåºæå |
| | | var sort: String = "desc" |
| | | // æåºå段ï¼é»è®¤ç±æ¥å£èªè¡å®ä¹ |
| | | var sortBy: String? = null |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.grid.vo |
| | | |
| | | /** |
| | | * 线索任å¡å®ææ
åµç»è®¡ |
| | | * @date 2025/4/27 |
| | | * @author feiyu02 |
| | | */ |
| | | data class ClueTaskSummaryVo( |
| | | // 任塿»è®¡ |
| | | val totalCount: Int = 0, |
| | | |
| | | // å
é¨ä»»å¡æ»è®¡ |
| | | val internalTaskCount: Int = 0, |
| | | // å¤é¨ä»»å¡æ»è®¡ |
| | | val externalTaskCount: Int = 0, |
| | | |
| | | // 宿任塿»è®¡ |
| | | val finishedCount: Int = 0, |
| | | // æªå®æä»»å¡æ»è®¡ |
| | | val unfinishedCount: Int = 0, |
| | | |
| | | // å
é¨å®æä»»å¡æ»è®¡ |
| | | val internalFinishedCount: Int = 0, |
| | | // å
鍿ªå®æä»»å¡æ»è®¡ |
| | | val internalUnFinishedCount: Int = 0, |
| | | |
| | | // å¤é¨å®æä»»å¡æ»è®¡ |
| | | val externalFinishedCount: Int = 0, |
| | | // å¤é¨æªå®æä»»å¡æ»è®¡ |
| | | val externalUnFinishedCount: Int = 0, |
| | | ) |
| | |
| | | import com.flightfeather.grid.config.exception.BizException |
| | | import com.flightfeather.grid.vo.BaseResponse |
| | | import com.flightfeather.grid.vo.DataHead |
| | | import com.github.pagehelper.Page |
| | | |
| | | |
| | | /** |
| | |
| | | BaseResponse(false, message = e.message ?: "") |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
è£
带æå页çè¿åç»æ |
| | | */ |
| | | fun <T> responsePack(p: Page<T>): Pair<DataHead, List<T?>> { |
| | | return DataHead(p.pageNum, p.pages, p.total) to p.result |
| | | } |
| | |
| | | @PostMapping("/update") |
| | | fun updateQuestion( |
| | | @ApiParam("线索é®é¢json") @RequestParam("question") question: String, |
| | | @ApiParam("å é¤çå¾çè·¯å¾æ°ç»") @RequestParam("deleteImg") deleteImg: String, |
| | | @ApiParam("æ°å¢ç线索å¾ç") @RequestPart("images") files: Array<MultipartFile>, |
| | | @ApiParam("å é¤çå¾çè·¯å¾æ°ç»") @RequestParam("deleteImg", required = false) deleteImg: String?, |
| | | @ApiParam("æ°å¢ç线索å¾ç") @RequestPart("images", required = false) files: Array<MultipartFile>?, |
| | | ) = resPack { clueQuestionService.updateQuestionAndImage(question, deleteImg, files) } |
| | | |
| | | @ApiOperation("å é¤çº¿ç´¢é®é¢åå¾ç") |
| | |
| | | import com.flightfeather.grid.domain.ds1.entity.ClueTask |
| | | import com.flightfeather.grid.service.ClueTaskService |
| | | import com.flightfeather.grid.vo.ClueInternalTaskVo |
| | | import com.flightfeather.grid.vo.ClueTaskOptions |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | |
| | | @ApiParam("线索任å¡") @RequestBody clueTask: ClueTask, |
| | | ) = resPack { clueTaskService.getClueTask(clueTask) } |
| | | |
| | | @ApiOperation("æ¥è¯¢çº¿ç´¢ä»»å¡") |
| | | @PostMapping("/search") |
| | | fun searchClueTask( |
| | | @RequestParam("page", required = false) page: Int?, |
| | | @RequestParam("per_page", required = false) perPage: Int?, |
| | | @ApiParam("çº¿ç´¢ä»»å¡æ¥è¯¢æ¡ä»¶") @RequestBody clueTaskOptions: ClueTaskOptions, |
| | | ) = resPack { clueTaskService.searchClueTask(clueTaskOptions, page, perPage) } |
| | | |
| | | @ApiOperation("å é¤çº¿ç´¢ä»»å¡") |
| | | @DeleteMapping("/delete") |
| | | fun deleteClueTask( |
| | | @ApiParam("线索任å¡") @RequestBody clueTask: ClueTask, |
| | | ) = resPack { clueTaskService.deleteClueTask(clueTask) } |
| | | |
| | | @ApiOperation("æ¥è¯¢çº¿ç´¢ä»»å¡å®ææ
åµç»è®¡") |
| | | @PostMapping("/summary") |
| | | fun getClueTaskSummary( |
| | | @ApiParam("çº¿ç´¢ä»»å¡æ¥è¯¢æ¡ä»¶") @RequestBody clueTaskOptions: ClueTaskOptions, |
| | | ) = resPack { clueTaskService.getClueTaskSummary(clueTaskOptions) } |
| | | |
| | | @ApiOperation("å®æçº¿ç´¢ä»»å¡") |
| | | @PostMapping("/finish") |
| | | fun finishClueTask( |
| | | @ApiParam("线索任å¡id") @RequestParam clueTaskId: String, |
| | | ) = resPack { clueTaskService.finishClueTask(clueTaskId) } |
| | | } |
| | |
| | | <!-- <table tableName="g_t_clue" domainObjectName="Clue" enableCountByExample="false"--> |
| | | <!-- enableUpdateByExample="false" enableDeleteByExample="false"--> |
| | | <!-- enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="g_t_clue_conclusion" domainObjectName="ClueConclusion" enableCountByExample="false" |
| | | enableUpdateByExample="false" enableDeleteByExample="false" |
| | | enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <table tableName="g_t_clue_question" domainObjectName="ClueQuestion" enableCountByExample="false" |
| | | enableUpdateByExample="false" enableDeleteByExample="false" |
| | | enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="g_t_clue_task" domainObjectName="ClueTask" enableCountByExample="false"--> |
| | | <!-- <table tableName="g_t_clue_conclusion" domainObjectName="ClueConclusion" enableCountByExample="false"--> |
| | | <!-- enableUpdateByExample="false" enableDeleteByExample="false"--> |
| | | <!-- enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="g_t_clue_internal" domainObjectName="ClueInternal" enableCountByExample="true"--> |
| | | <!-- enableUpdateByExample="true" enableDeleteByExample="true"--> |
| | | <!-- enableSelectByExample="true" selectByExampleQueryId="true"/>--> |
| | | <!-- <table tableName="g_t_clue_question" domainObjectName="ClueQuestion" enableCountByExample="false"--> |
| | | <!-- enableUpdateByExample="false" enableDeleteByExample="false"--> |
| | | <!-- enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="g_t_clue_task" domainObjectName="ClueTask" enableCountByExample="false" |
| | | enableUpdateByExample="false" enableDeleteByExample="false" |
| | | enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="g_t_clue_internal" domainObjectName="ClueInternal" enableCountByExample="false"--> |
| | | <!-- enableUpdateByExample="false" enableDeleteByExample="false"--> |
| | | <!-- enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | </context> |
| | | </generatorConfiguration> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.flightfeather.grid.domain.ds1.mapper.ClueInternalMapper"> |
| | | <resultMap id="BaseResultMap" type="com.flightfeather.grid.domain.ds1.entity.ClueInternal"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | <id column="C_Id" jdbcType="INTEGER" property="cId" /> |
| | | <result column="C_Clue_Name" jdbcType="VARCHAR" property="cClueName" /> |
| | | <result column="C_Conclusion" jdbcType="VARCHAR" property="cConclusion" /> |
| | | <result column="C_Alarm_Time" jdbcType="TIMESTAMP" property="cAlarmTime" /> |
| | | <result column="C_Site_Name" jdbcType="VARCHAR" property="cSiteName" /> |
| | | <result column="C_Factor" jdbcType="VARCHAR" property="cFactor" /> |
| | | <result column="C_Release_Time" jdbcType="TIMESTAMP" property="cReleaseTime" /> |
| | | <result column="C_Air_Checked_Options" jdbcType="VARCHAR" property="cAirCheckedOptions" /> |
| | | <result column="C_Pollution_Checked_Options" jdbcType="VARCHAR" property="cPollutionCheckedOptions" /> |
| | | <result column="C_Create_Time" jdbcType="TIMESTAMP" property="cCreateTime" /> |
| | | <result column="C_Center" jdbcType="VARCHAR" property="cCenter" /> |
| | | <result column="C_Zoom" jdbcType="VARCHAR" property="cZoom" /> |
| | | <result column="C_Longitude" jdbcType="DOUBLE" property="cLongitude" /> |
| | | <result column="C_Latitude" jdbcType="DOUBLE" property="cLatitude" /> |
| | | <result column="C_Site_Type" jdbcType="VARCHAR" property="cSiteType" /> |
| | | <result column="C_Report_Time" jdbcType="TIMESTAMP" property="cReportTime" /> |
| | | <result column="C_Upload_Time" jdbcType="TIMESTAMP" property="cUploadTime" /> |
| | | <result column="C_Uploaded" jdbcType="BIT" property="cUploaded" /> |
| | | <result column="C_Address" jdbcType="VARCHAR" property="cAddress" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | C_Id, C_Clue_Name, C_Conclusion, C_Alarm_Time, C_Site_Name, C_Factor, C_Release_Time, |
| | | C_Air_Checked_Options, C_Pollution_Checked_Options, C_Create_Time, C_Center, C_Zoom, |
| | | C_Longitude, C_Latitude, C_Site_Type, C_Report_Time, C_Upload_Time, C_Uploaded, C_Address |
| | | </sql> |
| | | |
| | | <resultMap extends="BaseResultMap" id="ClueVoMap" type="com.flightfeather.grid.vo.ClueInternalVo"> |
| | | <!-- &lt;result column="questionCount" jdbcType="INTEGER" property="questionCount" /&gt;--> |
| | | <!-- &lt;result column="conclusionCount" jdbcType="INTEGER" property="conclusionCount" /&gt;--> |
| | | </resultMap> |
| | | |
| | | <sql id="selectClueVo"> |
| | | SELECT |
| | | a.*, |
| | | COUNT(DISTINCT b.CC_Id) AS conclusionCount, |
| | | COUNT(DISTINCT c.CQ_Id) AS questionCount, |
| | | COUNT(DISTINCT d.guid) AS taskCount |
| | | FROM |
| | | g_t_clue_internal AS a |
| | | LEFT JOIN g_t_clue_conclusion AS b ON a.C_Id = b.C_Id and b.CC_Internal = true |
| | | LEFT JOIN g_t_clue_question AS c ON a.C_Id = c.C_Id and c.CQ_Internal = true |
| | | LEFT JOIN g_t_clue_task AS d ON a.C_Id = d.clue_id and d.internal_task = true |
| | | </sql> |
| | | <sql id="groupClueId"> |
| | | GROUP BY |
| | | a.C_Id |
| | | ORDER BY |
| | | a.C_Id DESC |
| | | </sql> |
| | | |
| | | <select id="getClue" resultMap="ClueVoMap"> |
| | | <include refid="selectClueVo" /> |
| | | <where> |
| | | <if test="sTime != null"> |
| | | AND a.C_Release_Time >= #{sTime} |
| | | </if> |
| | | <if test="eTime != null"> |
| | | AND a.C_Release_Time <= #{eTime} |
| | | </if> |
| | | </where> |
| | | <include refid="groupClueId" /> |
| | | </select> |
| | | |
| | | <select id="getClueById" resultMap="ClueVoMap"> |
| | | <include refid="selectClueVo" /> |
| | | <where> |
| | | a.C_Id = #{clueId} |
| | | </where> |
| | | <include refid="groupClueId" /> |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |
| | | <result column="executor_ids" jdbcType="VARCHAR" property="executorIds" /> |
| | | <result column="internal_task" jdbcType="BIT" property="internalTask" /> |
| | | <result column="finished" jdbcType="BIT" property="finished" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | |
| | | --> |
| | | guid, clue_id, task_time, province_code, province_name, city_code, city_name, district_code, |
| | | district_name, town_code, town_name, response_level, travel_mode, has_uav, create_time, |
| | | update_time, executor_ids, internal_task |
| | | update_time, executor_ids, internal_task, finished |
| | | </sql> |
| | | |
| | | <!-- éç¨SQLè¯å¥--> |
| | | <sql id="Where_Area"> |
| | | <if test="provinceCode != null"> |
| | | AND ${tableAlias}.province_code = #{provinceCode} |
| | | </if> |
| | | <if test="provinceName != null"> |
| | | AND ${tableAlias}.province_name = #{provinceName} |
| | | </if> |
| | | <if test="cityCode != null"> |
| | | AND ${tableAlias}.city_code = #{cityCode} |
| | | </if> |
| | | <if test="cityName != null"> |
| | | AND ${tableAlias}.city_name = #{cityName} |
| | | </if> |
| | | <if test="districtCode != null"> |
| | | AND ${tableAlias}.district_code = #{districtCode} |
| | | </if> |
| | | <if test="districtName != null"> |
| | | AND ${tableAlias}.district_name = #{districtName} |
| | | </if> |
| | | <if test="townCode != null"> |
| | | AND ${tableAlias}.town_code = #{townCode} |
| | | </if> |
| | | <if test="townName != null"> |
| | | AND ${tableAlias}.town_name = #{townName} |
| | | </if> |
| | | </sql> |
| | | <sql id="Where_Task_Time"> |
| | | <if test="startTime != null"> |
| | | AND ${tableAlias}.task_time >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND ${tableAlias}.task_time <= #{endTime} |
| | | </if> |
| | | </sql> |
| | | |
| | | <!-- è¿åç»ææ¨¡æ¿--> |
| | | <resultMap extends="BaseResultMap" id="SummaryMap" type="com.flightfeather.grid.vo.ClueTaskSummaryVo"> |
| | | </resultMap> |
| | | |
| | | <!-- æ¥è¯¢è¯å¥--> |
| | | <select id="selectSummaryCount" resultMap="SummaryMap"> |
| | | select |
| | | count(*) as totalCount, |
| | | sum(if(internal_task = true, 1, 0)) as internalTaskCount, |
| | | sum(if(internal_task = false, 1, 0)) as externalTaskCount, |
| | | sum(if(finished = true, 1, 0)) as finishedCount, |
| | | sum(if(finished = false, 1, 0)) as unfinishedCount, |
| | | sum(if(finished = true and internal_task = true, 1, 0)) as internalFinishedCount, |
| | | sum(if(finished = false and internal_task = true, 1, 0)) as internalUnFinishedCount, |
| | | sum(if(finished = true and internal_task = false, 1, 0)) as externalFinishedCount, |
| | | sum(if(finished = false and internal_task = false, 1, 0)) as externalUnFinishedCount |
| | | from g_t_clue_task as a |
| | | <where> |
| | | <include refid="Where_Area"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | <include refid="Where_Task_Time"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | @Test |
| | | fun getClue() { |
| | | val res = clueHttpService.getClue("2024-08-04 00:00:00") |
| | | val res = clueHttpService.getClue("2025-08-01 00:00:00") |
| | | res.forEach { |
| | | println(it.clueName) |
| | | } |
| | |
| | | package com.flightfeather.grid.web |
| | | |
| | | import com.flightfeather.grid.domain.ds1.entity.ClueTask |
| | | import com.flightfeather.grid.vo.ClueTaskOptions |
| | | import org.junit.jupiter.api.Test |
| | | |
| | | import org.junit.jupiter.api.Assertions.* |
| | |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit.jupiter.SpringExtension |
| | | import org.springframework.test.context.junit4.SpringRunner |
| | | import java.time.LocalDateTime |
| | | |
| | | @RunWith(SpringRunner::class) |
| | | @ExtendWith(SpringExtension::class) |
| | |
| | | lateinit var clueTaskController: ClueTaskController |
| | | |
| | | @Test |
| | | fun createClueTask() { |
| | | clueTaskController.createClueTask(ClueTask().apply { |
| | | |
| | | fun searchClueTask() { |
| | | val res = clueTaskController.searchClueTask(1, 30, ClueTaskOptions().apply { |
| | | provinceCode = "31" |
| | | provinceName = "䏿µ·å¸" |
| | | cityCode = "3100" |
| | | cityName = "䏿µ·å¸" |
| | | startTime = LocalDateTime.of(2025, 4, 22, 14, 35, 0) |
| | | endTime = LocalDateTime.of(2025, 4, 24, 15, 10, 0) |
| | | internal |
| | | finished |
| | | }) |
| | | println(res.toString()) |
| | | } |
| | | |
| | | @Test |
| | | fun getClueTask() { |
| | | fun getClueTaskSummary() { |
| | | val res = clueTaskController.getClueTaskSummary(ClueTaskOptions()) |
| | | println(res.toString()) |
| | | } |
| | | } |