forked from integrated_whb/integrated_whb
安全例会
parent
425f26928e
commit
d911193e36
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -20,4 +20,6 @@ public interface SafetyMeetingMapper {
|
|||
PageData findById(PageData pageData);
|
||||
|
||||
void edit(PageData pageData);
|
||||
|
||||
List<PageData> saftPersonList(PageData pageData);
|
||||
}
|
||||
|
|
|
@ -11,4 +11,10 @@ import java.util.List;
|
|||
*/
|
||||
public interface SafetyMeetingPeopleMapper {
|
||||
void saveBatch(List<PageData> safetyMeetingPeopledataList);
|
||||
|
||||
void removeBySafetMeetingId(PageData pageData);
|
||||
|
||||
void saveOrUpdateBatch(List<PageData> safetyMeetingPeopledataList);
|
||||
|
||||
void removeBySafetMeetingUserFeedback(PageData pageData);
|
||||
}
|
||||
|
|
|
@ -20,4 +20,6 @@ public interface SafetyMeetingService {
|
|||
PageData findById(PageData pageData);
|
||||
|
||||
void edit(PageData pageData);
|
||||
|
||||
List<PageData> saftPersonList(PageData pageData);
|
||||
}
|
||||
|
|
|
@ -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<PageData> dataList = JSON.parseArray(pageData.getString("people"), PageData.class);
|
||||
List<PageData> 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<String> 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<PageData> dataList = JSON.parseArray(pageData.getString("people"), PageData.class);
|
||||
List<PageData> 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<String> 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<PageData> saftPersonList(PageData pageData) {
|
||||
return safetyMeetingMapper.saftPersonList(pageData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,9 @@
|
|||
</sql>
|
||||
<!-- 字段 -->
|
||||
<sql id="Field">
|
||||
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 @@
|
|||
</sql>
|
||||
<!-- 字段用于新增 -->
|
||||
<sql id="Field2">
|
||||
SAFETY_MEETING_ID
|
||||
,
|
||||
SAFETY_MEETING_ID,
|
||||
SAFETY_MEETING_TITLE,
|
||||
SAFETY_MEETING_CONTENT,
|
||||
SIGNATURES,
|
||||
ALL_SIGNATURES,
|
||||
CORPINFO_ID,
|
||||
CREATOR,
|
||||
CREATTIME,
|
||||
|
@ -41,12 +33,9 @@
|
|||
|
||||
<!-- 字段值 -->
|
||||
<sql id="FieldValue">
|
||||
#{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}
|
||||
</update>
|
||||
<select id="datalistPage" resultType="com.zcloud.entity.PageData">
|
||||
select * from <include refid="tableName"></include> where ISDELETE = '0' and CORPINFO_ID = #{pd.CORPINFO_ID}
|
||||
SELECT
|
||||
t.*,
|
||||
COUNT(p.SAFETY_MEETING_ID) ALL_SIGNATURES,
|
||||
COUNT(p.FEED_BACK) SIGNATURES,
|
||||
GROUP_CONCAT( i.FILEPATH ) imgs
|
||||
FROM
|
||||
`safety_meeting` t
|
||||
LEFT JOIN bus_imgfiles i ON t.SAFETY_MEETING_ID = i.FOREIGN_KEY
|
||||
LEFT JOIN safety_meeting_people p ON t.SAFETY_MEETING_ID = p.SAFETY_MEETING_ID and p.ISDELETE = 0
|
||||
where t.ISDELETE = '0' and t.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||||
<if test="pd.SAFETY_MEETING_TITLE != null and pd.SAFETY_MEETING_TITLE != ''">
|
||||
and SAFETY_MEETING_TITLE like '%${pd.SAFETY_MEETING_TITLE}%'
|
||||
and t.SAFETY_MEETING_TITLE like '%${pd.SAFETY_MEETING_TITLE}%'
|
||||
</if>
|
||||
GROUP BY
|
||||
t.SAFETY_MEETING_ID
|
||||
ORDER BY t.OPERATTIME desc
|
||||
</select>
|
||||
<select id="findById" resultType="com.zcloud.entity.PageData">
|
||||
select * from <include refid="tableName"></include> where ISDELETE = '0'
|
||||
and SAFETY_MEETING_ID = #{SAFETY_MEETING_ID}
|
||||
</select>
|
||||
<select id="saftPersonList" resultType="com.zcloud.entity.PageData">
|
||||
SELECT * FROM `safety_meeting_people` where SAFETY_MEETING_ID = #{SAFETY_MEETING_ID} and ISDELETE = 0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
<sql id="Field">
|
||||
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 @@
|
|||
<sql id="Field2">
|
||||
SAFETY_MEETING_PEOPLE_ID,
|
||||
SAFETY_MEETING_ID,
|
||||
SIGNATORY,
|
||||
DEPARTMENT_ID,
|
||||
POST_ID,
|
||||
USER_ID,
|
||||
FEED_BACK,
|
||||
CORPINFO_ID,
|
||||
CREATOR,
|
||||
|
@ -44,7 +48,9 @@
|
|||
<sql id="FieldValue">
|
||||
#{SAFETY_MEETING_PEOPLE_ID},
|
||||
#{SAFETY_MEETING_ID},
|
||||
#{SIGNATORY},
|
||||
#{DEPARTMENT_ID},
|
||||
#{POST_ID},
|
||||
#{USER_ID},
|
||||
#{FEED_BACK},
|
||||
#{CORPINFO_ID},
|
||||
#{CREATOR},
|
||||
|
@ -56,7 +62,9 @@
|
|||
<sql id="FieldValue2">
|
||||
#{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 @@
|
|||
(<include refid="FieldValue2"></include>)
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="removeBySafetMeetingId">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1',
|
||||
OPERATOR=#{OPERATOR},
|
||||
OPERATTIME=#{OPERATTIME}
|
||||
where
|
||||
SAFETY_MEETING_ID = #{SAFETY_MEETING_ID}
|
||||
</update>
|
||||
<update id="saveOrUpdateBatch">
|
||||
insert into <include refid="tableName"></include>
|
||||
(<include refid="Field2"></include>) values
|
||||
<foreach item="item" index="index" collection="list" separator="," >
|
||||
(<include refid="FieldValue2"></include>)
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE `ISDELETE` = 0
|
||||
</update>
|
||||
<update id="removeBySafetMeetingUserFeedback">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
FEED_BACK = null
|
||||
where
|
||||
SAFETY_MEETING_ID = #{SAFETY_MEETING_ID} and ISDELETE = 1
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue