diff --git a/src/main/java/com/zcloud/controller/safetyMeeting/SafetyMeetingController.java b/src/main/java/com/zcloud/controller/safetyMeeting/SafetyMeetingController.java index 6cfa506..c0a3445 100644 --- a/src/main/java/com/zcloud/controller/safetyMeeting/SafetyMeetingController.java +++ b/src/main/java/com/zcloud/controller/safetyMeeting/SafetyMeetingController.java @@ -5,6 +5,7 @@ import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.safetyMeeting.SafetyMeetingService; +import com.zcloud.service.system.ImgFilesService; import com.zcloud.util.InitPageDataUtil; import com.zcloud.util.Jurisdiction; import com.zcloud.util.ReturnMap; @@ -27,6 +28,8 @@ public class SafetyMeetingController extends BaseController { @Resource private SafetyMeetingService safetyMeetingService; @Resource + private ImgFilesService imgFilesService; + @Resource private InitPageDataUtil initPageDataUtil; /** @@ -45,7 +48,7 @@ public class SafetyMeetingController extends BaseController { initPageDataUtil.initSave(pageData,"SAFETY_MEETING_ID"); safetyMeetingService.save(pageData); - return ReturnMap.ok(); + return ReturnMap.ok().put("SAFETY_MEETING_ID", pageData.getString("SAFETY_MEETING_ID")); } /** @@ -94,7 +97,9 @@ public class SafetyMeetingController extends BaseController { @ResponseBody public Object goEdit() throws Exception { PageData pageData = getPageData(); - return ReturnMap.ok().put("pd", safetyMeetingService.findById(pageData)); + return ReturnMap.ok().put("pd", safetyMeetingService.findById(pageData)) + .put("people", safetyMeetingService.saftPersonList(pageData)) + .put("imgs", imgFilesService.getListByKeyAndType(pageData.getString("SAFETY_MEETING_ID"), "105")); } /** * @Description: 安全例会 修改 @@ -109,6 +114,6 @@ public class SafetyMeetingController extends BaseController { public Object edit() throws Exception { PageData pageData = getPageData(); safetyMeetingService.edit(pageData); - return ReturnMap.ok(); + return ReturnMap.ok().put("SAFETY_MEETING_ID", pageData.getString("SAFETY_MEETING_ID")); } } diff --git a/src/main/java/com/zcloud/controller/system/DepartmentController.java b/src/main/java/com/zcloud/controller/system/DepartmentController.java index 5366c0d..9143bcf 100644 --- a/src/main/java/com/zcloud/controller/system/DepartmentController.java +++ b/src/main/java/com/zcloud/controller/system/DepartmentController.java @@ -316,6 +316,11 @@ public class DepartmentController extends BaseController { dept=this.departmentService.findByCorpId(dept); Department depar = new Department(); + if(pd.get("rootDisabled")!= null && pd.get("rootDisabled").toString().equals("Y")){ + depar.setDISABLED(true); + }else { + depar.setDISABLED(false); + } depar.setDEPARTMENT_ID(dept.getString("DEPARTMENT_ID")); depar.setPARENT_ID(dept.getString("PARENT_ID")); depar.setNAME(dept.getString("NAME")); diff --git a/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingMapper.java b/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingMapper.java index 62926c1..4f348eb 100644 --- a/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingMapper.java @@ -20,4 +20,6 @@ public interface SafetyMeetingMapper { PageData findById(PageData pageData); void edit(PageData pageData); + + List saftPersonList(PageData pageData); } diff --git a/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingPeopleMapper.java b/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingPeopleMapper.java index cf9991e..4375f2c 100644 --- a/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingPeopleMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/safetyMeeting/SafetyMeetingPeopleMapper.java @@ -11,4 +11,10 @@ import java.util.List; */ public interface SafetyMeetingPeopleMapper { void saveBatch(List safetyMeetingPeopledataList); + + void removeBySafetMeetingId(PageData pageData); + + void saveOrUpdateBatch(List safetyMeetingPeopledataList); + + void removeBySafetMeetingUserFeedback(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/safetyMeeting/SafetyMeetingService.java b/src/main/java/com/zcloud/service/safetyMeeting/SafetyMeetingService.java index e6e96b9..a388692 100644 --- a/src/main/java/com/zcloud/service/safetyMeeting/SafetyMeetingService.java +++ b/src/main/java/com/zcloud/service/safetyMeeting/SafetyMeetingService.java @@ -20,4 +20,6 @@ public interface SafetyMeetingService { PageData findById(PageData pageData); void edit(PageData pageData); + + List saftPersonList(PageData pageData); } diff --git a/src/main/java/com/zcloud/service/safetyMeeting/impl/SafetyMeetingServiceImpl.java b/src/main/java/com/zcloud/service/safetyMeeting/impl/SafetyMeetingServiceImpl.java index d5efd0e..829f1b2 100644 --- a/src/main/java/com/zcloud/service/safetyMeeting/impl/SafetyMeetingServiceImpl.java +++ b/src/main/java/com/zcloud/service/safetyMeeting/impl/SafetyMeetingServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; /** * 说明:TODO @@ -35,18 +36,24 @@ public class SafetyMeetingServiceImpl implements SafetyMeetingService { public void save(PageData pageData) { List dataList = JSON.parseArray(pageData.getString("people"), PageData.class); List safetyMeetingPeopledataList = new ArrayList<>(); + AtomicInteger peopleCount = new AtomicInteger(); dataList.forEach(item ->{ - String[] userIds = item.getString("USER_ID").split(","); + String DEPARTMENT_ID = item.getString("DEPARTMENT_ID"); + String POST_ID = item.getString("POST_ID"); + List userIds = JSON.parseArray(item.getString("USER_ID"),String.class); + peopleCount.addAndGet(userIds.size()); for (String userId : userIds) { PageData safetyMeetingPeopledata = new PageData(); safetyMeetingPeopledata.put("SAFETY_MEETING_ID",pageData.getString("SAFETY_MEETING_ID")); - safetyMeetingPeopledata.put("SIGNATORY",userId); + safetyMeetingPeopledata.put("USER_ID",userId); safetyMeetingPeopledata.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + safetyMeetingPeopledata.put("POST_ID", POST_ID); + safetyMeetingPeopledata.put("DEPARTMENT_ID", DEPARTMENT_ID); initPageDataUtil.initSave(safetyMeetingPeopledata,"SAFETY_MEETING_PEOPLE_ID"); safetyMeetingPeopledataList.add(safetyMeetingPeopledata); } }); - pageData.put("ALL_SIGNATURES",dataList.size()); + pageData.put("ALL_SIGNATURES",peopleCount.get()); pageData.put("SIGNATURES",0); safetyMeetingMapper.save(pageData); safetyMeetingPeopleMapper.saveBatch(safetyMeetingPeopledataList); @@ -69,6 +76,38 @@ public class SafetyMeetingServiceImpl implements SafetyMeetingService { @Override public void edit(PageData pageData) { + // 首先把 涉及人删掉 + safetyMeetingPeopleMapper.removeBySafetMeetingId(pageData); + initPageDataUtil.initEdit(pageData); + List dataList = JSON.parseArray(pageData.getString("people"), PageData.class); + List safetyMeetingPeopledataList = new ArrayList<>(); + AtomicInteger peopleCount = new AtomicInteger(); + dataList.forEach(item ->{ + String DEPARTMENT_ID = item.getString("DEPARTMENT_ID"); + String POST_ID = item.getString("POST_ID"); + List userIds = JSON.parseArray(item.getString("USER_ID"),String.class); + peopleCount.addAndGet(userIds.size()); + for (String userId : userIds) { + PageData safetyMeetingPeopledata = new PageData(); + safetyMeetingPeopledata.put("SAFETY_MEETING_ID", pageData.getString("SAFETY_MEETING_ID")); + safetyMeetingPeopledata.put("USER_ID", userId); + safetyMeetingPeopledata.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + safetyMeetingPeopledata.put("POST_ID", POST_ID); + safetyMeetingPeopledata.put("DEPARTMENT_ID", DEPARTMENT_ID); + initPageDataUtil.initSave(safetyMeetingPeopledata, "SAFETY_MEETING_PEOPLE_ID"); + safetyMeetingPeopledataList.add(safetyMeetingPeopledata); + } + }); safetyMeetingMapper.edit(pageData); + // 把删除的人重新激活 + safetyMeetingPeopleMapper.saveOrUpdateBatch(safetyMeetingPeopledataList); + // 清理掉被删除人的反馈 + safetyMeetingPeopleMapper.removeBySafetMeetingUserFeedback(pageData); + + } + + @Override + public List saftPersonList(PageData pageData) { + return safetyMeetingMapper.saftPersonList(pageData); } } diff --git a/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingMapper.xml b/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingMapper.xml index 501f053..86456a2 100644 --- a/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingMapper.xml +++ b/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingMapper.xml @@ -8,14 +8,9 @@ - f - . - SAFETY_MEETING_ID - , + f.SAFETY_MEETING_ID, f.SAFETY_MEETING_TITLE, f.SAFETY_MEETING_CONTENT, - f.SIGNATURES, - f.ALL_SIGNATURES, f.CORPINFO_ID, f.CREATOR, f.CREATTIME, @@ -25,12 +20,9 @@ - SAFETY_MEETING_ID - , + SAFETY_MEETING_ID, SAFETY_MEETING_TITLE, SAFETY_MEETING_CONTENT, - SIGNATURES, - ALL_SIGNATURES, CORPINFO_ID, CREATOR, CREATTIME, @@ -41,12 +33,9 @@ - #{SAFETY_MEETING_ID} - , + #{SAFETY_MEETING_ID}, #{SAFETY_MEETING_TITLE}, #{SAFETY_MEETING_CONTENT}, - #{SIGNATURES}, - #{ALL_SIGNATURES}, #{CORPINFO_ID}, #{CREATOR}, #{CREATTIME}, @@ -80,26 +69,36 @@ set SAFETY_MEETING_TITLE=#{SAFETY_MEETING_TITLE}, SAFETY_MEETING_CONTENT=#{SAFETY_MEETING_CONTENT}, - SIGNATURES=#{SIGNATURES}, - ALL_SIGNATURES=#{ALL_SIGNATURES}, - CORPINFO_ID=#{CORPINFO_ID}, - CREATOR=#{CREATOR}, - CREATTIME=#{CREATTIME}, OPERATOR=#{OPERATOR}, OPERATTIME=#{OPERATTIME} where SAFETY_MEETING_ID = #{SAFETY_MEETING_ID} + diff --git a/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingPeopleMapper.xml b/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingPeopleMapper.xml index 750416d..dee1a0c 100644 --- a/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingPeopleMapper.xml +++ b/src/main/resources/mybatis/datasource/safetyMeeting/SafetyMeetingPeopleMapper.xml @@ -16,7 +16,9 @@ f.SAFETY_MEETING_PEOPLE_ID, f.SAFETY_MEETING_ID, - f.SIGNATORY, + f.USER_ID, + f.DEPARTMENT_ID, + f.POST_ID, f.FEED_BACK, f.CORPINFO_ID, f.CREATOR, @@ -30,7 +32,9 @@ SAFETY_MEETING_PEOPLE_ID, SAFETY_MEETING_ID, - SIGNATORY, + DEPARTMENT_ID, + POST_ID, + USER_ID, FEED_BACK, CORPINFO_ID, CREATOR, @@ -44,7 +48,9 @@ #{SAFETY_MEETING_PEOPLE_ID}, #{SAFETY_MEETING_ID}, - #{SIGNATORY}, + #{DEPARTMENT_ID}, + #{POST_ID}, + #{USER_ID}, #{FEED_BACK}, #{CORPINFO_ID}, #{CREATOR}, @@ -56,7 +62,9 @@ #{item.SAFETY_MEETING_PEOPLE_ID}, #{item.SAFETY_MEETING_ID}, - #{item.SIGNATORY}, + #{item.DEPARTMENT_ID}, + #{item.POST_ID}, + #{item.USER_ID}, #{item.FEED_BACK}, #{item.CORPINFO_ID}, #{item.CREATOR}, @@ -82,5 +90,31 @@ () + + update + + set + ISDELETE = '1', + OPERATOR=#{OPERATOR}, + OPERATTIME=#{OPERATTIME} + where + SAFETY_MEETING_ID = #{SAFETY_MEETING_ID} + + + insert into + () values + + () + + ON DUPLICATE KEY UPDATE `ISDELETE` = 0 + + + update + + set + FEED_BACK = null + where + SAFETY_MEETING_ID = #{SAFETY_MEETING_ID} and ISDELETE = 1 +