|
@@ -0,0 +1,601 @@
|
|
|
+package com.sooka.sponest.data.emergency.appmin.xunjian.service.impl;
|
|
|
+
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.ruoyi.common.core.utils.uuid.UUID;
|
|
|
+import com.ruoyi.common.core.web.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
+import com.ruoyi.system.api.domain.SysDept;
|
|
|
+import com.ruoyi.system.api.domain.SysUser;
|
|
|
+import com.ruoyi.system.api.model.LoginUser;
|
|
|
+import com.sooka.sponest.data.emergency.appmin.base.AppBaseService;
|
|
|
+import com.sooka.sponest.data.emergency.appmin.util.ImageUtil;
|
|
|
+import com.sooka.sponest.data.emergency.appmin.xunjian.domain.*;
|
|
|
+import com.sooka.sponest.data.emergency.appmin.xunjian.mapper.AppXunjianMapper;
|
|
|
+import com.sooka.sponest.data.emergency.appmin.xunjian.service.AppXunjianService;
|
|
|
+import com.sooka.sponest.data.emergency.domain.*;
|
|
|
+import com.sooka.sponest.data.emergency.mapper.*;
|
|
|
+import com.sooka.sponest.data.emergency.remoteapi.service.center.data.RemoteSystemBaseService;
|
|
|
+import com.sooka.sponest.data.emergency.service.ITBusZsseqService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class AppXunjianServiceImpl extends AppBaseService implements AppXunjianService {
|
|
|
+ @Resource
|
|
|
+ AppXunjianMapper appXunjianMapper;
|
|
|
+ @Resource
|
|
|
+ TBusEnterpriseMapper tBusEnterpriseMapper;
|
|
|
+ @Resource
|
|
|
+ TBusInspectionMapper tBusInspectionMapper;
|
|
|
+ @Resource
|
|
|
+ TBusLogMapper tBusLogMapper;
|
|
|
+ @Resource
|
|
|
+ TBusTrackMapper tBusTrackMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TAttachMapper attachMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBusItemsMapper tBusItemsMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBusDeptMapper tBusDeptMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBusEnterpriseItemsMappingMapper tBusEnterpriseItemsMappingMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TTzsXhxqzggzsItemMapper tTzsXhxqzggzsItemMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TTzsXhxqzggzsMapper tTzsXhxqzggzsMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TTzsFcyjgzsMapper tTzsFcyjgzsMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ ITBusZsseqService itBusZsseqService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RemoteSystemBaseService remoteSystemBaseService;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getXunjianItems(AppXunjianVO vo) {
|
|
|
+ AjaxResult ajaxResult = new AjaxResult();
|
|
|
+ try {
|
|
|
+ List<AppXunjianItemBO> list = appXunjianMapper.getXunjianItems(vo);
|
|
|
+ Map<String, List> map = new HashMap();
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ AppXunjianItemBO bo = list.get(i);
|
|
|
+ //看看这个key以前有没有
|
|
|
+ if (map.get(bo.getYjId() + "_" + bo.getEjId()) == null) {
|
|
|
+ List new_li = new ArrayList();
|
|
|
+ List content = new ArrayList();
|
|
|
+ String[] names = new String[2];
|
|
|
+ names[0] = bo.getYjName();
|
|
|
+ names[1] = bo.getEjName();
|
|
|
+ new_li.add(names);
|
|
|
+
|
|
|
+ ListDataBO listDataBO = new ListDataBO();
|
|
|
+ listDataBO.setChecked(true);
|
|
|
+ listDataBO.setInfo(list.get(i).getBusItemName());
|
|
|
+ listDataBO.setListid(list.get(i).getBusItemsId());
|
|
|
+ listDataBO.setYjId(list.get(i).getYjId());
|
|
|
+ listDataBO.setEjId(list.get(i).getEjId());
|
|
|
+ listDataBO.setJibie(listDataBO.getYjId() + "_" + listDataBO.getEjId());
|
|
|
+ listDataBO.setTimeLimit(list.get(i).getBusItemLimit());
|
|
|
+
|
|
|
+
|
|
|
+// content.add(list.get(i));
|
|
|
+ content.add(listDataBO);
|
|
|
+ new_li.add(content);
|
|
|
+ map.put(bo.getYjId() + "_" + bo.getEjId(), new_li);
|
|
|
+ } else {
|
|
|
+ List old_li = map.get(bo.getYjId() + "_" + bo.getEjId());
|
|
|
+ List content = (List) old_li.get(1);
|
|
|
+
|
|
|
+
|
|
|
+ ListDataBO listDataBO = new ListDataBO();
|
|
|
+ listDataBO.setChecked(true);
|
|
|
+ listDataBO.setInfo(list.get(i).getBusItemName());
|
|
|
+ listDataBO.setListid(list.get(i).getBusItemsId());
|
|
|
+ listDataBO.setYjId(list.get(i).getYjId());
|
|
|
+ listDataBO.setEjId(list.get(i).getEjId());
|
|
|
+ listDataBO.setJibie(listDataBO.getYjId() + "_" + listDataBO.getEjId());
|
|
|
+ listDataBO.setTimeLimit(list.get(i).getBusItemLimit());
|
|
|
+ content.add(listDataBO);
|
|
|
+// content.add(bo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ajaxResult.put("xunjianItems", map);
|
|
|
+ return ajaxResult;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("查询失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult submitXunjian(AppXunjianVO vo) {
|
|
|
+ Map result = new HashMap();
|
|
|
+ //是否有限期整改的
|
|
|
+ Boolean haveXQZG = false;//限期整改
|
|
|
+ Boolean haveLCLG = false;//立查立改
|
|
|
+ String pictures_local_path = remoteSystemBaseService.configKeyapp("pictures_local_path").get("code").toString();
|
|
|
+ Date createTime = new Date();
|
|
|
+ try {
|
|
|
+ //取得登录人信息
|
|
|
+ LoginUser sysUser = SecurityUtils.getLoginUser();
|
|
|
+ //写日志表
|
|
|
+ TBusLog tBusLog = new TBusLog();
|
|
|
+ String logId = UUID.fastUUID().toString();
|
|
|
+ tBusLog.setBusLogId(logId);
|
|
|
+ tBusLog.setCreateBy(sysUser.getUserid().toString());
|
|
|
+ tBusLog.setCreateTime(createTime);
|
|
|
+ //日志类型-巡检
|
|
|
+ tBusLog.setBusLogType("log_type_0");
|
|
|
+ //日志来源
|
|
|
+ SysDept sysDept = remoteSystemBaseService.selectDeptById(sysUser.getSysUser().getDeptId()).getData();
|
|
|
+ if (sysDept == null || sysDept.getDeptType() == null) {
|
|
|
+ return AjaxResult.error("人员未配置部门或部门类型");
|
|
|
+ } else if (sysDept.getDeptType().equals("dept_type_3")) {
|
|
|
+ //企业
|
|
|
+ tBusLog.setLogSource("log_source_1");
|
|
|
+ } else {
|
|
|
+ //其余全是专干
|
|
|
+ tBusLog.setLogSource("log_source_0");
|
|
|
+ }
|
|
|
+ //判断是否有隐患
|
|
|
+ Map map = vo.getXuanjianItems();
|
|
|
+ Set set = map.keySet();
|
|
|
+ Iterator<String> iterator = set.iterator();
|
|
|
+ //默认为无隐患 - 默认为已整改
|
|
|
+ tBusLog.setIsRisk("0");
|
|
|
+ tBusLog.setRiskStatus("risk_status_3");
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ String key = iterator.next();
|
|
|
+ List list = (List) map.get(key);
|
|
|
+ List content = (List) list.get(1);
|
|
|
+ ObjectMapper mapper = new ObjectMapper();
|
|
|
+ List<ListDataBO> pojos = mapper.convertValue(content, new TypeReference<List<ListDataBO>>() {
|
|
|
+ });
|
|
|
+
|
|
|
+ for (int i = 0; i < pojos.size(); i++) {
|
|
|
+ ListDataBO listDataBO = pojos.get(i);
|
|
|
+ //循环插入巡检表
|
|
|
+ TBusInspection tBusInspection = new TBusInspection();
|
|
|
+ String busInspectionId = UUID.fastUUID().toString();
|
|
|
+ tBusInspection.setRiskStatus("risk_status_3");
|
|
|
+ tBusInspection.setIsPass("Y");
|
|
|
+ tBusInspection.setCreateTime(createTime);
|
|
|
+
|
|
|
+ if (listDataBO.getChecked() == false) {
|
|
|
+ tBusLog.setIsRisk("1");
|
|
|
+ tBusInspection.setRiskStatus("risk_status_0");
|
|
|
+ tBusInspection.setIsPass("N");
|
|
|
+ tBusInspection.setItemsType(listDataBO.getItemsType());
|
|
|
+ //有隐患,就放里一个进度
|
|
|
+ TBusTrack tBusTrack = new TBusTrack();
|
|
|
+ tBusTrack.setBusTrackId(UUID.fastUUID().toString());
|
|
|
+ tBusTrack.setBusLogId(logId);
|
|
|
+ tBusTrack.setBusInspectionId(busInspectionId);
|
|
|
+ tBusTrack.setDeptId(sysUser.getSysUser().getDept().getDeptId());
|
|
|
+ tBusTrack.setUserId(sysUser.getSysUser().getUserId());
|
|
|
+ tBusTrack.setRiskStatus("risk_status_0");
|
|
|
+ tBusTrack.setBusTrackContent(listDataBO.getBusTrackContent());
|
|
|
+ tBusTrack.setCreateTime(createTime);
|
|
|
+ tBusTrackMapper.insertTBusTrack(tBusTrack);
|
|
|
+ //如果是立查立改,就再放一个完成的进度 - 巡检表状态标识为已整改
|
|
|
+ if (listDataBO.getItemsType().equals("items_type_0")) {
|
|
|
+ haveLCLG = true;
|
|
|
+ tBusInspection.setRiskStatus("risk_status_2");
|
|
|
+ tBusTrack.setRiskStatus("risk_status_2");
|
|
|
+ tBusTrack.setCreateTime(new Date(new Date().getTime()+1000));
|
|
|
+ tBusTrack.setBusTrackId(UUID.fastUUID().toString());
|
|
|
+ tBusTrackMapper.insertTBusTrack(tBusTrack);
|
|
|
+ } else {
|
|
|
+ tBusLog.setRiskStatus("risk_status_0");
|
|
|
+ haveXQZG = true;
|
|
|
+ }
|
|
|
+ //放附件
|
|
|
+ for (AppXunjianPictureVO pic : listDataBO.getPicturesBefore()) {
|
|
|
+ ImageUtil.convertBase64StrToImage(pic.getPic_base64(), pictures_local_path + "/" + pic.getPic_key() + ".png");
|
|
|
+ TAttach tAttach = new TAttach();
|
|
|
+ tAttach.setAttachId(UUID.fastUUID().toString());
|
|
|
+ tAttach.setBusId(tBusTrack.getBusTrackId());
|
|
|
+ tAttach.setAttachUrl(pic.getPic_key() + ".png");
|
|
|
+ tAttach.setAttachName(pic.getPic_key());
|
|
|
+ tAttach.setAttachLabel(pic.getPic_value());
|
|
|
+ attachMapper.insertTAttach(tAttach);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ tBusInspection.setBusInspectionId(busInspectionId);
|
|
|
+ tBusInspection.setBusLogId(logId);
|
|
|
+ tBusInspection.setBusItemsId(listDataBO.getListid());
|
|
|
+ tBusInspection.setBusItemsName(listDataBO.getInfo());
|
|
|
+
|
|
|
+ if (listDataBO.getItemsType() != null && listDataBO.getItemsType().equals("items_type_1")) {
|
|
|
+ //限期整改
|
|
|
+ Integer limitTime = listDataBO.getTimeLimit();
|
|
|
+ tBusInspection.setTimeLimit(limitTime);
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.add(Calendar.DATE, limitTime);
|
|
|
+ tBusInspection.setLatTime(calendar.getTime());
|
|
|
+ }
|
|
|
+ tBusInspectionMapper.insertTBusInspection(tBusInspection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tBusLog.setBusEnterpriseId(vo.getBusEnterpriseId());
|
|
|
+ TBusEnterprise enterprise = tBusEnterpriseMapper.selectTBusEnterpriseByBusEnterpriseId(vo.getBusEnterpriseId());
|
|
|
+ tBusLog.setBusEnterpriseName(enterprise.getBusinessName());
|
|
|
+ tBusLog.setLatitude(vo.getLatitude());
|
|
|
+ tBusLog.setLongitude(vo.getLongitude());
|
|
|
+
|
|
|
+ if(haveLCLG && haveXQZG){
|
|
|
+ tBusLog.setRiskStatus("risk_status_0");
|
|
|
+ }else if(haveLCLG && !haveXQZG){
|
|
|
+ tBusLog.setRiskStatus("risk_status_2");
|
|
|
+ }
|
|
|
+
|
|
|
+ tBusLogMapper.insertTBusLog(tBusLog);
|
|
|
+
|
|
|
+ //写业务部门表
|
|
|
+ TBusDept tBusDept = new TBusDept();
|
|
|
+ tBusDept.setBusDeptId(UUID.fastUUID().toString());
|
|
|
+ tBusDept.setBusLogId(logId);
|
|
|
+ tBusDept.setDeptId(sysUser.getSysUser().getDeptId());
|
|
|
+ tBusDept.setUserId(sysUser.getUserid());
|
|
|
+ tBusDept.setCreateTime(new Date());
|
|
|
+ tBusDept.setDeptType(sysUser.getSysUser().getDept().getDeptType());
|
|
|
+ tBusDeptMapper.insertTBusDept(tBusDept);
|
|
|
+
|
|
|
+ result.put("logId", logId);
|
|
|
+ result.put("haveXQZG", haveXQZG);
|
|
|
+ return AjaxResult.success(result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("巡检上报异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getXqzggzs2(AppXunjianVO vo) {
|
|
|
+ try {
|
|
|
+ //巡检项目
|
|
|
+ TBusInspection tBusInspection = new TBusInspection();
|
|
|
+ tBusInspection.setItemsType("items_type_1");
|
|
|
+ tBusInspection.setBusLogId(vo.getLogId());
|
|
|
+ List<TBusInspection> list = tBusInspectionMapper.selectTBusInspectionList(tBusInspection);
|
|
|
+ //最后整改时间
|
|
|
+ Date latTime = new Date();
|
|
|
+ for (TBusInspection bi : list) {
|
|
|
+ if (bi.getLatTime() != null && bi.getLatTime().after(latTime)) {
|
|
|
+ latTime = bi.getLatTime();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
+ String day = format.format(latTime);
|
|
|
+ //检查人员 姓名 部门 时间 部门印章
|
|
|
+ LoginUser user = SecurityUtils.getLoginUser();
|
|
|
+ //
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("nickName", user.getSysUser().getNickName());
|
|
|
+ map.put("deptName", user.getSysUser().getDept().getDeptName());
|
|
|
+ map.put("latTime", day);
|
|
|
+ map.put("riskInspections", list);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("整改通知书获取失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult submitXqzggzs2(AppXunjianVO vo) {
|
|
|
+ return AjaxResult.success("");
|
|
|
+ }
|
|
|
+
|
|
|
+ //-----------------------------巡检配置操作-----------------------------------
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getXunjianczData(AppXunjianVO vo) {
|
|
|
+ try {
|
|
|
+ //获取本企业的配置项目
|
|
|
+ //获取1级配置项目
|
|
|
+ TBusItems tBusItems = new TBusItems();
|
|
|
+ tBusItems.setParentId("0");
|
|
|
+ List list = tBusItemsMapper.selectTBusItemsList(tBusItems);
|
|
|
+
|
|
|
+ AjaxResult ajaxResult = getXunjianItems(vo);
|
|
|
+ ajaxResult.put("items_first", list);
|
|
|
+
|
|
|
+
|
|
|
+ return ajaxResult;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getBusInspectionIsRiskByEnterpriseCount(AppXunjianVO vo) {
|
|
|
+ try {
|
|
|
+ int c = appXunjianMapper.getBusInspectionIsRiskByEnterpriseCount(vo);
|
|
|
+ if (c == 0) {
|
|
|
+ return AjaxResult.success(c);
|
|
|
+ } else {
|
|
|
+ return AjaxResult.error("本企业有未处理完成隐患项目");
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getItems(AppXunjianVO vo) {
|
|
|
+ try {
|
|
|
+ TBusItems tBusItems = new TBusItems();
|
|
|
+ tBusItems.setParentId(vo.getParentId());
|
|
|
+ List ls = tBusItemsMapper.selectTBusItemsList(tBusItems);
|
|
|
+ return AjaxResult.success(ls);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getItemsLast(AppXunjianVO vo) {
|
|
|
+ //找出巡检最后一项,没有被配置过的
|
|
|
+ try {
|
|
|
+ List ls = appXunjianMapper.getItemsLast(vo);
|
|
|
+ return AjaxResult.success(ls);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("错误");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult saveXunjianItems(AppXunjianVO vo) {
|
|
|
+ try {
|
|
|
+ Map<String, Boolean> map = vo.getChooseItems();
|
|
|
+ if (map != null) {
|
|
|
+ //保存现有配置项目
|
|
|
+ Set set = map.keySet();
|
|
|
+ Iterator iterator = set.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ Object obj = iterator.next();
|
|
|
+ if (obj != null) {
|
|
|
+ String key = obj.toString();
|
|
|
+ Boolean b = map.get(key);
|
|
|
+ if (b) {
|
|
|
+ TBusEnterpriseItemsMapping tBusEnterpriseItemsMapping = new TBusEnterpriseItemsMapping();
|
|
|
+ tBusEnterpriseItemsMapping.setBusEnterpriseId(vo.getBusEnterpriseId());
|
|
|
+ tBusEnterpriseItemsMapping.setBusItemsId(key);
|
|
|
+ tBusEnterpriseItemsMappingMapper.insertTBusEnterpriseItemsMapping(tBusEnterpriseItemsMapping);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AjaxResult.success("保存完成");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("保存错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult deleteXunjianItem(AppXunjianVO vo) {
|
|
|
+ try {
|
|
|
+ appXunjianMapper.deleteXunjianItem(vo);
|
|
|
+ return AjaxResult.success("删除成功", vo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult saveZGTZS(AppZgtzsVO vo) {
|
|
|
+ try {
|
|
|
+
|
|
|
+
|
|
|
+ TBusEnterprise enterprise = tBusEnterpriseMapper.selectTBusEnterpriseByBusEnterpriseId(vo.getXqzgtzs().getEnterpriseId());
|
|
|
+ SysDept sysDept = remoteSystemBaseService.selectDeptById(enterprise.getDeptId()).getData();
|
|
|
+
|
|
|
+ //处理图片
|
|
|
+ String pictureBasePath = remoteSystemBaseService.configKeyapp("pictureBasePath").get("code").toString();
|
|
|
+ String pictures_local_path = remoteSystemBaseService.configKeyapp("pictures_local_path").get("code").toString();
|
|
|
+
|
|
|
+ String checker1Sign = UUID.fastUUID().toString();
|
|
|
+ String checker2Sign = UUID.fastUUID().toString();
|
|
|
+ String becheckerSign = UUID.fastUUID().toString();
|
|
|
+ ImageUtil.convertBase64StrToImage(vo.getXqzgtzs().getChecker1Sign(), pictures_local_path + "/" + checker1Sign + ".png");
|
|
|
+ ImageUtil.convertBase64StrToImage(vo.getXqzgtzs().getChecker2Sign(), pictures_local_path + "/" + checker2Sign + ".png");
|
|
|
+ ImageUtil.convertBase64StrToImage(vo.getXqzgtzs().getBecheckerSign(), pictures_local_path + "/" + becheckerSign + ".png");
|
|
|
+
|
|
|
+ vo.getXqzgtzs().setChecker1Sign(checker1Sign + ".png");
|
|
|
+ vo.getXqzgtzs().setChecker2Sign(checker2Sign + ".png");
|
|
|
+ vo.getXqzgtzs().setBecheckerSign(becheckerSign + ".png");
|
|
|
+
|
|
|
+
|
|
|
+ TTzsXhxqzggzs tTzsXhxqzggzs = vo.getXqzgtzs();
|
|
|
+ String tzs_id = UUID.fastUUID().toString();
|
|
|
+ tTzsXhxqzggzs.setTzsId(tzs_id);
|
|
|
+ tTzsXhxqzggzs.setCheckTime(new Date());
|
|
|
+ tTzsXhxqzggzs.setEnterpriseName(enterprise.getBusinessName());
|
|
|
+ TBusZsseq tBusZsseq = itBusZsseqService.makeZsseq("zs_type_1",sysDept);
|
|
|
+ tTzsXhxqzggzs.setCode(tBusZsseq.getzCode());
|
|
|
+ //整改通知书 增加检查部门
|
|
|
+ tTzsXhxqzggzs.setCheckDept(sysDept.getDeptName());
|
|
|
+ //整改通知书 增加电子公章
|
|
|
+ //取得登录人信息
|
|
|
+ LoginUser sysUser = SecurityUtils.getLoginUser();
|
|
|
+ SysUser seal = remoteSystemBaseService.selectById(sysUser.getUserid()).getData();
|
|
|
+ tTzsXhxqzggzs.setSeal(seal == null ? "" : seal.getEmail());
|
|
|
+ tTzsXhxqzggzsMapper.insertTTzsXhxqzggzs(tTzsXhxqzggzs);
|
|
|
+
|
|
|
+ List<TzsVO> items = vo.getTzs_items();
|
|
|
+ for (int i = 0; i < items.size(); i++) {
|
|
|
+ TzsVO c = items.get(i);
|
|
|
+ TTzsXhxqzggzsItem it = new TTzsXhxqzggzsItem();
|
|
|
+ it.setId(UUID.fastUUID().toString());
|
|
|
+ it.setZgtzsId(tzs_id);
|
|
|
+ it.setItemId(c.getBusItemsId());
|
|
|
+ it.setItemContent(c.getBusItemsName());
|
|
|
+ tTzsXhxqzggzsItemMapper.insertTTzsXhxqzggzsItem(it);
|
|
|
+ }
|
|
|
+ return AjaxResult.success("保存成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("保存失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult saveFCTZS(AppFctzsVO vo) {
|
|
|
+ try {
|
|
|
+ String logId = vo.getTzsFcyjgzs().getLogId();
|
|
|
+ TBusLog tBusLog = tBusLogMapper.selectTBusLogByBusLogId(logId);
|
|
|
+
|
|
|
+ vo.getTzsFcyjgzs().setEnterpriseId(tBusLog.getBusEnterpriseId());
|
|
|
+ vo.getTzsFcyjgzs().setEnterpriseName(tBusLog.getBusEnterpriseName());
|
|
|
+ vo.getTzsFcyjgzs().setTzsId(UUID.fastUUID().toString());
|
|
|
+ vo.getTzsFcyjgzs().setCreateTime(new Date());
|
|
|
+
|
|
|
+ TBusEnterprise enterprise = tBusEnterpriseMapper.selectTBusEnterpriseByBusEnterpriseId(tBusLog.getBusEnterpriseId()) ;
|
|
|
+ SysDept sysDept = remoteSystemBaseService.selectDeptById(enterprise.getDeptId()).getData();
|
|
|
+
|
|
|
+ String pictureBasePath = remoteSystemBaseService.configKeyapp("pictureBasePath").get("code").toString();
|
|
|
+ String pictures_local_path = remoteSystemBaseService.configKeyapp("pictures_local_path").get("code").toString();
|
|
|
+ String checker1Sign = UUID.fastUUID().toString();
|
|
|
+ String checker2Sign = UUID.fastUUID().toString();
|
|
|
+ String becheckerSign = UUID.fastUUID().toString();
|
|
|
+
|
|
|
+ ImageUtil.convertBase64StrToImage(vo.getTzsFcyjgzs().getChecker1Sign(), pictures_local_path + "/" + checker1Sign + ".png");
|
|
|
+ ImageUtil.convertBase64StrToImage(vo.getTzsFcyjgzs().getChecker2Sign(), pictures_local_path + "/" + checker2Sign + ".png");
|
|
|
+ ImageUtil.convertBase64StrToImage(vo.getTzsFcyjgzs().getBecheckerSign(), pictures_local_path + "/" + becheckerSign + ".png");
|
|
|
+
|
|
|
+ vo.getTzsFcyjgzs().setChecker1Sign(checker1Sign + ".png");
|
|
|
+ vo.getTzsFcyjgzs().setChecker2Sign(checker2Sign + ".png");
|
|
|
+ vo.getTzsFcyjgzs().setBecheckerSign(becheckerSign + ".png");
|
|
|
+
|
|
|
+ TBusZsseq tBusZsseq = itBusZsseqService.makeZsseq("zs_type_2",sysDept);
|
|
|
+ vo.getTzsFcyjgzs().setCode(tBusZsseq.getzCode());
|
|
|
+
|
|
|
+ //整改通知书 增加检查部门
|
|
|
+ vo.getTzsFcyjgzs().setCheckDept(sysDept.getDeptName());
|
|
|
+ //整改通知书 增加电子公章
|
|
|
+ //取得登录人信息
|
|
|
+ LoginUser sysUser = SecurityUtils.getLoginUser();
|
|
|
+ SysUser seal = remoteSystemBaseService.selectById(sysUser.getUserid()).getData();
|
|
|
+ vo.getTzsFcyjgzs().setSeal(seal == null ? "" : seal.getEmail());
|
|
|
+ tTzsFcyjgzsMapper.insertTTzsFcyjgzs(vo.getTzsFcyjgzs());
|
|
|
+ return AjaxResult.success("保存成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult getFCTZSdetail(AppFctzsVO vo) {
|
|
|
+ try {
|
|
|
+ Map map = new HashMap();
|
|
|
+ TBusLog tBusLog = tBusLogMapper.selectTBusLogByBusLogId(vo.getLogId());
|
|
|
+ TTzsXhxqzggzs tTzsXhxqzggzs = new TTzsXhxqzggzs();
|
|
|
+ tTzsXhxqzggzs.setLogId(tBusLog.getBusLogId());
|
|
|
+ List<TTzsXhxqzggzs> tzs = tTzsXhxqzggzsMapper.selectTTzsXhxqzggzsList(tTzsXhxqzggzs);
|
|
|
+ map.put("gzs_time", tzs.get(0).getCheckTime());
|
|
|
+ map.put("last_time", tzs.get(0).getLastTime());
|
|
|
+ map.put("gzs_code", tzs.get(0).getCode());
|
|
|
+ LoginUser user = SecurityUtils.getLoginUser();
|
|
|
+ map.put("nickName", user.getSysUser().getNickName());
|
|
|
+ map.put("deptName", user.getSysUser().getDept().getDeptName());
|
|
|
+
|
|
|
+
|
|
|
+ return AjaxResult.success("查询成功", map);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("查询错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult changeInspection(AppXunjianInspectionVO vo) {
|
|
|
+ try {
|
|
|
+ TBusInspection inspection = new TBusInspection();
|
|
|
+ inspection.setBusInspectionId(vo.getBusInspectionId());
|
|
|
+ TBusInspection inp = tBusInspectionMapper.selectTBusInspectionByBusInspectionId(vo.getBusInspectionId());
|
|
|
+
|
|
|
+ //日志
|
|
|
+ TBusTrack tBusTrack = new TBusTrack();
|
|
|
+ tBusTrack.setBusTrackId(UUID.fastUUID().toString());
|
|
|
+ tBusTrack.setBusLogId(vo.getLogId());
|
|
|
+ tBusTrack.setBusInspectionId(vo.getBusInspectionId());
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ tBusTrack.setUserId(loginUser.getUserid());
|
|
|
+ tBusTrack.setDeptId(loginUser.getSysUser().getDeptId());
|
|
|
+ tBusTrack.setCreateTime(new Date());
|
|
|
+ //
|
|
|
+
|
|
|
+
|
|
|
+ if (vo.getLat_day() != null) {
|
|
|
+ //修改天数
|
|
|
+ inspection.setTimeLimit(inp.getTimeLimit() + vo.getLat_day());
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(inp.getLatTime());
|
|
|
+ calendar.add(Calendar.DATE, vo.getLat_day());
|
|
|
+ inspection.setLatTime(calendar.getTime());
|
|
|
+ tBusTrack.setBusTrackContent("延期");
|
|
|
+ tBusTrack.setRiskStatus(inp.getRiskStatus());
|
|
|
+ } else if (vo.getRiskStatus() != null) {
|
|
|
+ //修改状态
|
|
|
+ inspection.setRiskStatus(vo.getRiskStatus());
|
|
|
+ tBusTrack.setBusTrackContent("修改状态");
|
|
|
+ tBusTrack.setRiskStatus(vo.getRiskStatus());
|
|
|
+ }
|
|
|
+ tBusTrackMapper.insertTBusTrack(tBusTrack);
|
|
|
+ tBusInspectionMapper.updateTBusInspection(inspection);
|
|
|
+
|
|
|
+ //判断是否所有的项目都合格,整干净了
|
|
|
+ TBusInspection tBusInspection = new TBusInspection();
|
|
|
+ tBusInspection.setBusInspectionId(inp.getBusInspectionId());
|
|
|
+ List<TBusInspection> log_list = tBusInspectionMapper.selectTBusInspectionList(tBusInspection);
|
|
|
+ TBusLog tBusLog = tBusLogMapper.selectTBusLogByBusLogId(inp.getBusLogId());
|
|
|
+ String y_risk_status = tBusLog.getRiskStatus();
|
|
|
+ for(TBusInspection i:log_list){
|
|
|
+ if(i.getRiskStatus().equals("risk_status_2")){
|
|
|
+ tBusLog.setRiskStatus("risk_status_2");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(y_risk_status.equals("risk_status_0") && tBusLog.getRiskStatus().equals("risk_status_2")){
|
|
|
+ tBusLog.setRiskStatus("risk_status_2");
|
|
|
+ tBusLogMapper.updateTBusLog(tBusLog);
|
|
|
+ }
|
|
|
+
|
|
|
+ return AjaxResult.success("修改成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return AjaxResult.error("修改失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|