2024-03-05 18:14:36 +08:00
|
|
|
package com.zcloud.controller.comprehensive;
|
|
|
|
|
|
|
|
import com.zcloud.controller.base.BaseController;
|
|
|
|
import com.zcloud.entity.Page;
|
|
|
|
import com.zcloud.entity.PageData;
|
|
|
|
import com.zcloud.service.comprehensive.TrafficSafetyMeetingRecipienService;
|
|
|
|
import com.zcloud.service.comprehensive.TrafficSafetyMeetingService;
|
|
|
|
import com.zcloud.util.*;
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
2024-03-08 18:05:27 +08:00
|
|
|
import java.util.stream.Collectors;
|
2024-03-05 18:14:36 +08:00
|
|
|
|
|
|
|
@Controller
|
|
|
|
@RequestMapping("/app/safetymeeting")
|
|
|
|
public class AppTrafficSafetyMeetingController extends BaseController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private TrafficSafetyMeetingService trafficSafetyMeetingService;
|
|
|
|
@Autowired
|
|
|
|
private TrafficSafetyMeetingRecipienService meetingRecipienService;
|
2024-03-08 18:05:27 +08:00
|
|
|
@Autowired
|
|
|
|
private Smb smb;
|
2024-03-05 18:14:36 +08:00
|
|
|
//列表
|
|
|
|
@RequestMapping(value = "/listForSafetyMeeting")
|
|
|
|
@ResponseBody
|
|
|
|
public Object listForSecurityNotice(Page page) throws Exception {
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
String errInfo = "success";
|
|
|
|
PageData pd = new PageData();
|
|
|
|
pd = this.getPageData();
|
|
|
|
|
|
|
|
String MEETING_TITLE = pd.getString("MEETING_TITLE"); // 关键词检索条件
|
|
|
|
if (Tools.notEmpty(MEETING_TITLE))
|
|
|
|
pd.put("MEETING_TITLE", MEETING_TITLE.trim());
|
|
|
|
|
|
|
|
page.setPd(pd);
|
|
|
|
List<PageData> varList = trafficSafetyMeetingService.listForSafetyMeeting(page);
|
|
|
|
map.put("varList", varList);
|
|
|
|
map.put("page", page);
|
|
|
|
map.put("result", errInfo);
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**删除
|
|
|
|
* @param
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
@RequestMapping(value="/delete")
|
|
|
|
@ResponseBody
|
|
|
|
public Object delete() throws Exception{
|
|
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
|
|
String errInfo = "success";
|
|
|
|
PageData pd = new PageData();
|
|
|
|
pd = this.getPageData();
|
|
|
|
pd.put("DELETOR", Jurisdiction.getUSER_ID());//删除人id
|
|
|
|
pd.put("DELETORNAME", Jurisdiction.getUsername());//删除人姓名
|
|
|
|
pd.put("DELETETIME", DateUtil.date2Str(new Date()));//删除时间
|
|
|
|
trafficSafetyMeetingService.delete(pd);
|
|
|
|
map.put("result", errInfo);
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
//详情
|
|
|
|
@RequestMapping(value="/goEdit")
|
|
|
|
@ResponseBody
|
|
|
|
public Object goEdit() throws Exception {
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
String errInfo = "success";
|
|
|
|
PageData pd = this.getPageData();
|
2024-03-08 18:05:27 +08:00
|
|
|
pd = trafficSafetyMeetingService.getInfo(pd); // 根据ID读取
|
2024-03-05 18:14:36 +08:00
|
|
|
if (pd == null) {
|
|
|
|
map.put("pd", pd); // 这里pd是null
|
|
|
|
map.put("result", errInfo);
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
List<PageData> varList = trafficSafetyMeetingService.listForSafetyMeetingRecipient(pd);
|
2024-03-08 18:05:27 +08:00
|
|
|
List<PageData> filteredList = varList.stream()
|
|
|
|
.filter(pageData -> "1".equals(pageData.getString("ATTENDANCE_STATUS")))
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
pd.put("totalPersonNum", varList.size());//应参会人数
|
|
|
|
pd.put("realPersonNum", filteredList.size());//实际参会人数
|
|
|
|
pd.put("recipientsList", filteredList);
|
2024-03-05 18:14:36 +08:00
|
|
|
map.put("pd", pd);
|
|
|
|
map.put("result", errInfo);
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
//修改
|
|
|
|
@RequestMapping(value = "/edit")
|
|
|
|
@ResponseBody
|
2024-03-11 18:10:24 +08:00
|
|
|
public Object edit(@RequestParam(value="livePhoto",required=false) MultipartFile livePhoto,
|
|
|
|
@RequestParam(value="signPhoto", required=false) MultipartFile signPhoto) throws Exception {
|
2024-03-05 18:14:36 +08:00
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
String errInfo = "success";
|
|
|
|
PageData pd = this.getPageData();
|
|
|
|
|
|
|
|
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); // 修改人id
|
|
|
|
pd.put("OPERATORNAME", Jurisdiction.getName()); // 修改人姓名
|
|
|
|
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
|
|
|
|
pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 经营企业
|
|
|
|
|
2024-03-11 18:10:24 +08:00
|
|
|
if (livePhoto != null && StringUtils.isNotBlank(pd.getString("OPERATORNAME"))){
|
|
|
|
String livePhotoPath = saveFile(livePhoto, pd);
|
|
|
|
if (livePhotoPath != null) {
|
|
|
|
pd.put("LIVEPHOTOS", livePhotoPath);
|
|
|
|
} else {
|
2024-03-08 18:05:27 +08:00
|
|
|
errInfo = "fail";
|
|
|
|
map.put("result", errInfo);
|
2024-03-11 18:10:24 +08:00
|
|
|
map.put("msg", "实时照片文件格式不正确或保存失败!");
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 对于signPhoto的处理
|
|
|
|
if (signPhoto != null && StringUtils.isNotBlank(pd.getString("OPERATORNAME"))){
|
|
|
|
String signPhotoPath = saveFile(signPhoto, pd);
|
|
|
|
if (signPhotoPath != null) {
|
|
|
|
pd.put("SIGNATUREPICTURE", signPhotoPath);
|
|
|
|
} else {
|
|
|
|
errInfo = "fail";
|
|
|
|
map.put("result", errInfo);
|
|
|
|
map.put("msg", "签字图片文件格式不正确或保存失败!");
|
2024-03-08 18:05:27 +08:00
|
|
|
return map;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-05 18:14:36 +08:00
|
|
|
meetingRecipienService.edit(pd);
|
|
|
|
|
|
|
|
map.put("result", errInfo);
|
|
|
|
map.put("pd", pd);
|
|
|
|
return map;
|
|
|
|
}
|
2024-03-11 18:10:24 +08:00
|
|
|
private String saveFile(MultipartFile file, PageData pd) throws Exception {
|
|
|
|
String ffile = DateUtil.getDays(), fileName = null;
|
|
|
|
if (file != null) {
|
|
|
|
String suffixName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
|
|
|
|
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|
|
|
smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile);
|
|
|
|
return Const.FILEPATHFILE + pd.getString("TRANSPORTATIONCOMPANY") + "/" + ffile + "/" + fileName;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2024-03-05 18:14:36 +08:00
|
|
|
}
|