diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java index 1abb99eb..0364e260 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcCyController.java @@ -1,14 +1,20 @@ package com.ruoyi.tcZz.controller; +import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.tcZz.domain.TcAqyh; +import com.ruoyi.tcZz.domain.TcBzhan; import com.ruoyi.tcZz.domain.TcCy; +import com.ruoyi.tcZz.domain.TcWljg; import com.ruoyi.tcZz.service.ITcCyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -54,7 +60,20 @@ public class TcCyController extends BaseController { @ApiOperation(value = "新增词云") @PostMapping public AjaxResult add(@RequestBody TcCy tcCy) { - return toAjax(tcCyService.insertTcCy(tcCy)); + //根据area_id + cy_name判断如果已存在,则调修改 + TcCy newtcCy = new TcCy(); + newtcCy.setAreaId(tcCy.getAreaId()); + newtcCy.setCyName(tcCy.getCyName()); + List list = tcCyService.selectTcCyList(newtcCy); + if (!list.isEmpty()) { + for (TcCy a : list) { + tcCy.setId(a.getId()); + tcCyService.updateTcCy(tcCy); + } + } else { + tcCyService.insertTcCy(tcCy); + } + return AjaxResult.success(); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcJbsjndfltjController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcJbsjndfltjController.java index 8362519c..d378c194 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcJbsjndfltjController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcJbsjndfltjController.java @@ -65,7 +65,19 @@ public class TcJbsjndfltjController extends BaseController { @ApiOperation("新增举报事件年度分类统计") @PostMapping public AjaxResult add(@RequestBody TcJbsjndfltj tcJbsjndfltj) { - return toAjax(tcJbsjndfltjService.insertTcJbsjndfltj(tcJbsjndfltj)); + //根据type判断如果已存在,则调修改 + TcJbsjndfltj newtcJbsjndfltj = new TcJbsjndfltj(); + newtcJbsjndfltj.setType(tcJbsjndfltj.getType()); + List list = tcJbsjndfltjService.selectTcJbsjndfltjList(newtcJbsjndfltj); + if (!list.isEmpty()) { + for (TcJbsjndfltj a : list) { + tcJbsjndfltj.setId(a.getId()); + tcJbsjndfltjService.updateTcJbsjndfltj(tcJbsjndfltj); + } + } else { + tcJbsjndfltjService.insertTcJbsjndfltj(tcJbsjndfltj); + } + return AjaxResult.success(); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcSslxController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcSslxController.java index 9e219187..3183a105 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcSslxController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcSslxController.java @@ -1,14 +1,20 @@ package com.ruoyi.tcZz.controller; +import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.tcZz.domain.TcAqg; +import com.ruoyi.tcZz.domain.TcAqyh; +import com.ruoyi.tcZz.domain.TcSjlytj; import com.ruoyi.tcZz.domain.TcSslx; import com.ruoyi.tcZz.service.ITcSslxService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -65,7 +71,18 @@ public class TcSslxController extends BaseController { @ApiOperation(value = "新增涉事类型") @PostMapping public AjaxResult add(@RequestBody TcSslx tcSslx) { - return toAjax(tcSslxService.insertTcSslx(tcSslx)); + TcSslx newtcSslx=new TcSslx(); + newtcSslx.setName(tcSslx.getName()); + List list = tcSslxService.selectTcSslxList(newtcSslx); + if (!list.isEmpty()){ + for (TcSslx a :list) { + tcSslx.setId(a.getId()); + tcSslxService.updateTcSslx(tcSslx); + } + }else { + tcSslxService.insertTcSslx(tcSslx); + } + return AjaxResult.success(); } /** @@ -87,6 +104,7 @@ public class TcSslxController extends BaseController { } + /** * 导入 */ @@ -109,13 +127,14 @@ public class TcSslxController extends BaseController { @ApiOperation("批量启用禁用") @GetMapping("/isStatus") public AjaxResult isStatus(@RequestParam("isStatus") Integer isStatus, @RequestParam("ids") List ids) { - tcSslxService.updateByisStatus(isStatus, ids); + tcSslxService.updateByisStatus(isStatus,ids); return AjaxResult.success(); } @ApiOperation("通用下载excel模板") @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) { + public void importTemplate(HttpServletResponse response) + { ExcelUtil util = new ExcelUtil(TcSslx.class); util.importTemplateExcel(response, " 涉事类型"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcAqyhServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcAqyhServiceImpl.java index 3fde23f7..76a806f0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcAqyhServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcAqyhServiceImpl.java @@ -100,7 +100,18 @@ public class TcAqyhServiceImpl implements ITcAqyhService StringBuilder successMsg = new StringBuilder(); if (!tcAqyhList.isEmpty()) { for (TcAqyh tcAqyh : tcAqyhList) { - tcAqyhMapper.insertTcAqyh(tcAqyh); + + TcAqyh newtcAqyh=new TcAqyh(); + newtcAqyh.setYhName(tcAqyh.getYhName()); + List list = tcAqyhMapper.selectTcAqyhList(newtcAqyh); + if (!list.isEmpty()){ + for (TcAqyh a :list) { + tcAqyh.setId(a.getId()); + tcAqyhMapper.updateTcAqyh(tcAqyh); + } + }else { + tcAqyhMapper.insertTcAqyh(tcAqyh); + } } successMsg.append("导入成功"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java index 3a7a63ed..929277c3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcCyServiceImpl.java @@ -1,97 +1,90 @@ package com.ruoyi.tcZz.service.impl; -import java.util.List; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.tcZz.domain.TcWljg; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.tcZz.mapper.TcCyMapper; import com.ruoyi.tcZz.domain.TcCy; +import com.ruoyi.tcZz.mapper.TcCyMapper; import com.ruoyi.tcZz.service.ITcCyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; /** * 词云Service业务层处理 - * + * * @author ruoyi * @date 2023-10-13 */ @Service -public class TcCyServiceImpl implements ITcCyService -{ +public class TcCyServiceImpl implements ITcCyService { @Autowired private TcCyMapper tcCyMapper; /** * 查询词云 - * + * * @param id 词云主键 * @return 词云 */ @Override - public TcCy selectTcCyById(Long id) - { + public TcCy selectTcCyById(Long id) { return tcCyMapper.selectTcCyById(id); } /** * 查询词云列表 - * + * * @param tcCy 词云 * @return 词云 */ @Override - public List selectTcCyList(TcCy tcCy) - { + public List selectTcCyList(TcCy tcCy) { return tcCyMapper.selectTcCyList(tcCy); } /** * 新增词云 - * + * * @param tcCy 词云 * @return 结果 */ @Override - public int insertTcCy(TcCy tcCy) - { + public int insertTcCy(TcCy tcCy) { tcCy.setCreateTime(DateUtils.getNowDate()); return tcCyMapper.insertTcCy(tcCy); } /** * 修改词云 - * + * * @param tcCy 词云 * @return 结果 */ @Override - public int updateTcCy(TcCy tcCy) - { + public int updateTcCy(TcCy tcCy) { tcCy.setUpdateTime(DateUtils.getNowDate()); return tcCyMapper.updateTcCy(tcCy); } /** * 批量删除词云 - * + * * @param ids 需要删除的词云主键 * @return 结果 */ @Override - public int deleteTcCyByIds(Long[] ids) - { + public int deleteTcCyByIds(Long[] ids) { return tcCyMapper.deleteTcCyByIds(ids); } /** * 删除词云信息 - * + * * @param id 词云主键 * @return 结果 */ @Override - public int deleteTcCyById(Long id) - { + public int deleteTcCyById(Long id) { return tcCyMapper.deleteTcCyById(id); } @@ -100,15 +93,28 @@ public class TcCyServiceImpl implements ITcCyService StringBuilder successMsg = new StringBuilder(); if (!tcCyList.isEmpty()) { for (TcCy tcCy : tcCyList) { - tcCyMapper.insertTcCy(tcCy); + //根据area_id + cy_name判断如果已存在,则调修改 + TcCy newtcCy = new TcCy(); + newtcCy.setAreaId(tcCy.getAreaId()); + newtcCy.setCyName(tcCy.getCyName()); + List list = tcCyMapper.selectTcCyList(newtcCy); + if (!list.isEmpty()) { + for (TcCy a : list) { + tcCy.setId(a.getId()); + tcCyMapper.updateTcCy(tcCy); + } + } else { + tcCyMapper.insertTcCy(tcCy); + } } successMsg.append("导入成功"); } return successMsg.toString(); } + @Override - public void updateByisStatus(Integer isStatus,List ids) { - tcCyMapper.updateByisStatus(isStatus,ids); + public void updateByisStatus(Integer isStatus, List ids) { + tcCyMapper.updateByisStatus(isStatus, ids); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcFbqkServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcFbqkServiceImpl.java index 306b5200..afbe393f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcFbqkServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcFbqkServiceImpl.java @@ -100,7 +100,17 @@ public class TcFbqkServiceImpl implements ITcFbqkService StringBuilder successMsg = new StringBuilder(); if (!tcFbqkList.isEmpty()) { for (TcFbqk tcFbqk : tcFbqkList) { - tcFbqkMapper.insertTcFbqk(tcFbqk); + TcFbqk newtcFbqk=new TcFbqk(); + newtcFbqk.setCityName(tcFbqk.getCityName()); + List list = tcFbqkMapper.selectTcFbqkList(newtcFbqk); + if (!list.isEmpty()){ + for (TcFbqk a :list) { + tcFbqk.setId(a.getId()); + tcFbqkMapper.updateTcFbqk(tcFbqk); + } + }else { + tcFbqkMapper.insertTcFbqk(tcFbqk); + } } successMsg.append("导入成功"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcJbsjndfltjServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcJbsjndfltjServiceImpl.java index d053d505..8bf8d769 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcJbsjndfltjServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcJbsjndfltjServiceImpl.java @@ -93,7 +93,18 @@ public class TcJbsjndfltjServiceImpl implements ITcJbsjndfltjService { StringBuilder successMsg = new StringBuilder(); if (!tcJbsjndfltjList.isEmpty()) { for (TcJbsjndfltj tcJbsjndfltj : tcJbsjndfltjList) { - tcJbsjndfltjMapper.insertTcJbsjndfltj(tcJbsjndfltj); + //根据type判断如果已存在,则调修改 + TcJbsjndfltj newtcJbsjndfltj = new TcJbsjndfltj(); + newtcJbsjndfltj.setType(tcJbsjndfltj.getType()); + List list = tcJbsjndfltjMapper.selectTcJbsjndfltjList(newtcJbsjndfltj); + if (!list.isEmpty()) { + for (TcJbsjndfltj a : list) { + tcJbsjndfltj.setId(a.getId()); + tcJbsjndfltjMapper.updateTcJbsjndfltj(tcJbsjndfltj); + } + } else { + tcJbsjndfltjMapper.insertTcJbsjndfltj(tcJbsjndfltj); + } } successMsg.append("导入成功"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcMtlxServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcMtlxServiceImpl.java index ea4c75cf..aba3243c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcMtlxServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcMtlxServiceImpl.java @@ -1,97 +1,90 @@ package com.ruoyi.tcZz.service.impl; -import java.util.List; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.tcZz.domain.TcAqg; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.tcZz.mapper.TcMtlxMapper; import com.ruoyi.tcZz.domain.TcMtlx; +import com.ruoyi.tcZz.mapper.TcMtlxMapper; import com.ruoyi.tcZz.service.ITcMtlxService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; /** * 媒体类型Service业务层处理 - * + * * @author ruoyi * @date 2023-10-12 */ @Service -public class TcMtlxServiceImpl implements ITcMtlxService -{ +public class TcMtlxServiceImpl implements ITcMtlxService { @Autowired private TcMtlxMapper tcMtlxMapper; /** * 查询媒体类型 - * + * * @param id 媒体类型主键 * @return 媒体类型 */ @Override - public TcMtlx selectTcMtlxById(Long id) - { + public TcMtlx selectTcMtlxById(Long id) { return tcMtlxMapper.selectTcMtlxById(id); } /** * 查询媒体类型列表 - * + * * @param tcMtlx 媒体类型 * @return 媒体类型 */ @Override - public List selectTcMtlxList(TcMtlx tcMtlx) - { + public List selectTcMtlxList(TcMtlx tcMtlx) { return tcMtlxMapper.selectTcMtlxList(tcMtlx); } /** * 新增媒体类型 - * + * * @param tcMtlx 媒体类型 * @return 结果 */ @Override - public int insertTcMtlx(TcMtlx tcMtlx) - { + public int insertTcMtlx(TcMtlx tcMtlx) { tcMtlx.setCreateTime(DateUtils.getNowDate()); return tcMtlxMapper.insertTcMtlx(tcMtlx); } /** * 修改媒体类型 - * + * * @param tcMtlx 媒体类型 * @return 结果 */ @Override - public int updateTcMtlx(TcMtlx tcMtlx) - { + public int updateTcMtlx(TcMtlx tcMtlx) { tcMtlx.setUpdateTime(DateUtils.getNowDate()); return tcMtlxMapper.updateTcMtlx(tcMtlx); } /** * 批量删除媒体类型 - * + * * @param ids 需要删除的媒体类型主键 * @return 结果 */ @Override - public int deleteTcMtlxByIds(Long[] ids) - { + public int deleteTcMtlxByIds(Long[] ids) { return tcMtlxMapper.deleteTcMtlxByIds(ids); } /** * 删除媒体类型信息 - * + * * @param id 媒体类型主键 * @return 结果 */ @Override - public int deleteTcMtlxById(Long id) - { + public int deleteTcMtlxById(Long id) { return tcMtlxMapper.deleteTcMtlxById(id); } @@ -100,7 +93,17 @@ public class TcMtlxServiceImpl implements ITcMtlxService StringBuilder successMsg = new StringBuilder(); if (!tcMtlxList.isEmpty()) { for (TcMtlx tcMtlx : tcMtlxList) { - tcMtlxMapper.insertTcMtlx(tcMtlx); + TcMtlx newtcMtlx = new TcMtlx(); + newtcMtlx.setName(tcMtlx.getName()); + List list = tcMtlxMapper.selectTcMtlxList(newtcMtlx); + if (!list.isEmpty()) { + for (TcMtlx a : list) { + tcMtlx.setId(a.getId()); + tcMtlxMapper.updateTcMtlx(tcMtlx); + } + } else { + tcMtlxMapper.insertTcMtlx(tcMtlx); + } } successMsg.append("导入成功"); } @@ -109,7 +112,7 @@ public class TcMtlxServiceImpl implements ITcMtlxService } @Override - public void updateByisStatus(Integer isStatus,List ids) { - tcMtlxMapper.updateByisStatus(isStatus,ids); + public void updateByisStatus(Integer isStatus, List ids) { + tcMtlxMapper.updateByisStatus(isStatus, ids); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSgjipTop5ServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSgjipTop5ServiceImpl.java index 5d777daf..9542fe52 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSgjipTop5ServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSgjipTop5ServiceImpl.java @@ -100,7 +100,17 @@ public class TcSgjipTop5ServiceImpl implements ITcSgjipTop5Service StringBuilder successMsg = new StringBuilder(); if (!tcSgjipTop5List.isEmpty()) { for (TcSgjipTop5 tcSgjipTop5 : tcSgjipTop5List) { - tcSgjipTop5Mapper.insertTcSgjipTop5(tcSgjipTop5); + TcSgjipTop5 newtcSgjipTop5=new TcSgjipTop5(); + newtcSgjipTop5.setSAttackIp(tcSgjipTop5.getSAttackIp()); + List list = tcSgjipTop5Mapper.selectTcSgjipTop5List(newtcSgjipTop5); + if (!list.isEmpty()){ + for (TcSgjipTop5 a :list) { + tcSgjipTop5.setId(a.getId()); + tcSgjipTop5Mapper.updateTcSgjipTop5(tcSgjipTop5); + } + }else { + tcSgjipTop5Mapper.insertTcSgjipTop5(tcSgjipTop5); + } } successMsg.append("导入成功"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSslxServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSslxServiceImpl.java index 3669355c..850adca9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSslxServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcSslxServiceImpl.java @@ -100,7 +100,17 @@ public class TcSslxServiceImpl implements ITcSslxService StringBuilder successMsg = new StringBuilder(); if (!tcSslxList.isEmpty()) { for (TcSslx tcSslx : tcSslxList) { - tcSslxMapper.insertTcSslx(tcSslx); + TcSslx newtcSslx=new TcSslx(); + newtcSslx.setName(tcSslx.getName()); + List list = tcSslxMapper.selectTcSslxList(newtcSslx); + if (!list.isEmpty()){ + for (TcSslx a :list) { + tcSslx.setId(a.getId()); + tcSslxMapper.updateTcSslx(tcSslx); + } + }else { + tcSslxMapper.insertTcSslx(tcSslx); + } } successMsg.append("导入成功"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcTbwcServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcTbwcServiceImpl.java index 1828a3d6..15bc7a09 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcTbwcServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcTbwcServiceImpl.java @@ -1,97 +1,90 @@ package com.ruoyi.tcZz.service.impl; -import java.util.List; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.tcZz.domain.TcAqg; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.tcZz.mapper.TcTbwcMapper; import com.ruoyi.tcZz.domain.TcTbwc; +import com.ruoyi.tcZz.mapper.TcTbwcMapper; import com.ruoyi.tcZz.service.ITcTbwcService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; /** * 通报完成情况Service业务层处理 - * + * * @author ruoyi * @date 2023-10-12 */ @Service -public class TcTbwcServiceImpl implements ITcTbwcService -{ +public class TcTbwcServiceImpl implements ITcTbwcService { @Autowired private TcTbwcMapper tcTbwcMapper; /** * 查询通报完成情况 - * + * * @param id 通报完成情况主键 * @return 通报完成情况 */ @Override - public TcTbwc selectTcTbwcById(Long id) - { + public TcTbwc selectTcTbwcById(Long id) { return tcTbwcMapper.selectTcTbwcById(id); } /** * 查询通报完成情况列表 - * + * * @param tcTbwc 通报完成情况 * @return 通报完成情况 */ @Override - public List selectTcTbwcList(TcTbwc tcTbwc) - { + public List selectTcTbwcList(TcTbwc tcTbwc) { return tcTbwcMapper.selectTcTbwcList(tcTbwc); } /** * 新增通报完成情况 - * + * * @param tcTbwc 通报完成情况 * @return 结果 */ @Override - public int insertTcTbwc(TcTbwc tcTbwc) - { + public int insertTcTbwc(TcTbwc tcTbwc) { tcTbwc.setCreateTime(DateUtils.getNowDate()); return tcTbwcMapper.insertTcTbwc(tcTbwc); } /** * 修改通报完成情况 - * + * * @param tcTbwc 通报完成情况 * @return 结果 */ @Override - public int updateTcTbwc(TcTbwc tcTbwc) - { + public int updateTcTbwc(TcTbwc tcTbwc) { tcTbwc.setUpdateTime(DateUtils.getNowDate()); return tcTbwcMapper.updateTcTbwc(tcTbwc); } /** * 批量删除通报完成情况 - * + * * @param ids 需要删除的通报完成情况主键 * @return 结果 */ @Override - public int deleteTcTbwcByIds(Long[] ids) - { + public int deleteTcTbwcByIds(Long[] ids) { return tcTbwcMapper.deleteTcTbwcByIds(ids); } /** * 删除通报完成情况信息 - * + * * @param id 通报完成情况主键 * @return 结果 */ @Override - public int deleteTcTbwcById(Long id) - { + public int deleteTcTbwcById(Long id) { return tcTbwcMapper.deleteTcTbwcById(id); } @@ -101,7 +94,19 @@ public class TcTbwcServiceImpl implements ITcTbwcService StringBuilder successMsg = new StringBuilder(); if (!tcTbwcList.isEmpty()) { for (TcTbwc tcTbwc : tcTbwcList) { - tcTbwcMapper.insertTcTbwc(tcTbwc); + //根据year + Time_name判断如果已存在,则调修改 + TcTbwc newtcTbwc = new TcTbwc(); + newtcTbwc.setYear(tcTbwc.getYear()); + newtcTbwc.setTimeName(tcTbwc.getTimeName()); + List list = tcTbwcMapper.selectTcTbwcList(newtcTbwc); + if (!list.isEmpty()) { + for (TcTbwc a : list) { + tcTbwc.setId(a.getId()); + tcTbwcMapper.updateTcTbwc(tcTbwc); + } + } else { + tcTbwcMapper.insertTcTbwc(tcTbwc); + } } successMsg.append("导入成功"); } @@ -109,7 +114,7 @@ public class TcTbwcServiceImpl implements ITcTbwcService } @Override - public void updateByisStatus(Integer isStatus,List ids) { - tcTbwcMapper.updateByisStatus(isStatus,ids); + public void updateByisStatus(Integer isStatus, List ids) { + tcTbwcMapper.updateByisStatus(isStatus, ids); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWpyrwwclServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWpyrwwclServiceImpl.java index 41d5f696..38ed687b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWpyrwwclServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcWpyrwwclServiceImpl.java @@ -100,7 +100,18 @@ public class TcWpyrwwclServiceImpl implements ITcWpyrwwclService StringBuilder successMsg = new StringBuilder(); if (!tTcWpyrwwclList.isEmpty()) { for (TcWpyrwwcl tcWpyrwwcl : tTcWpyrwwclList) { - tcWpyrwwclMapper.insertTcWpyrwwcl(tcWpyrwwcl); + //根据unit判断如果已存在,则调修改 + TcWpyrwwcl newtcWpyrwwcl=new TcWpyrwwcl(); + newtcWpyrwwcl.setUnit(tcWpyrwwcl.getUnit()); + List list = tcWpyrwwclMapper.selectTcWpyrwwclList(newtcWpyrwwcl); + if (!list.isEmpty()){ + for (TcWpyrwwcl a :list) { + tcWpyrwwcl.setId(a.getId()); + tcWpyrwwclMapper.updateTcWpyrwwcl(tcWpyrwwcl); + } + }else { + tcWpyrwwclMapper.insertTcWpyrwwcl(tcWpyrwwcl); + } } successMsg.append("导入成功"); }