|
@ -26,19 +26,43 @@ |
|
|
package com.yxt.anrui.scm.biz.scmvehiclepatrolinspectionsheet; |
|
|
package com.yxt.anrui.scm.biz.scmvehiclepatrolinspectionsheet; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleFeign; |
|
|
|
|
|
import com.yxt.anrui.base.api.basevehicle.BaseVehicleVo; |
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
import com.yxt.anrui.scm.api.scmfile.ScmFile; |
|
|
import com.yxt.anrui.scm.api.scmfile.ScmFile; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspection.AppScmVehiclePatrolinspectionPageQuery; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspection.AppScmVehiclePatrolinspectionPageVo; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspectionsheet.AppScmVehiclePatroVo; |
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspection.ScmVehiclePatrolinspection; |
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspection.ScmVehiclePatrolinspection; |
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspectionsheet.*; |
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspectionsheet.*; |
|
|
import com.yxt.anrui.scm.api.scmvehiclestaypatrolinspection.ScmVehicleStayPatrolinspection; |
|
|
import com.yxt.anrui.scm.api.scmvehinventoryreport.AppReportDto; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehinventoryreport.RecipientListDto; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehpatrolinspectionmonth.ScmVehPatrolinspectionmonth; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehpatrolinspectionmonth.ScmVehPatrolinspectionmonthFeign; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmvehpatrolinspectionmonth.ScmVehPatrolinspectionmonthVo; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmwarehouse.ScmWarehouse; |
|
|
|
|
|
import com.yxt.anrui.scm.api.scmwarehouse.ScmWarehouseFeign; |
|
|
import com.yxt.anrui.scm.biz.scmfile.ScmFileService; |
|
|
import com.yxt.anrui.scm.biz.scmfile.ScmFileService; |
|
|
import com.yxt.anrui.scm.biz.scmvehiclepatrolinspection.ScmVehiclePatrolinspectionService; |
|
|
import com.yxt.anrui.scm.biz.scmvehiclepatrolinspection.ScmVehiclePatrolinspectionService; |
|
|
import com.yxt.anrui.scm.biz.scmvehiclestaypatrolinspection.ScmVehicleStayPatrolinspectionService; |
|
|
import com.yxt.anrui.scm.biz.scmvehiclestaypatrolinspection.ScmVehicleStayPatrolinspectionService; |
|
|
|
|
|
import com.yxt.anrui.scm.biz.scmvehinventorymonth.ScmVehInventorymonthService; |
|
|
|
|
|
import com.yxt.anrui.scm.biz.scmvehpatrolinspectionmonth.ScmVehPatrolinspectionmonthService; |
|
|
|
|
|
import com.yxt.anrui.scm.biz.scmwarehouse.ScmWarehouseService; |
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
|
|
import com.yxt.common.base.utils.JPushServer; |
|
|
|
|
|
import com.yxt.messagecenter.api.message.AppMessageDto; |
|
|
|
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
|
|
import com.yxt.messagecenter.api.message.MsgTargetUriEnum; |
|
|
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListDto; |
|
|
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListFeign; |
|
|
|
|
|
import com.yxt.messagecenter.api.messagetype.MessageTypeFeign; |
|
|
|
|
|
import com.yxt.messagecenter.api.messagetype.MessageTypeVo; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
@ -52,9 +76,16 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Arrays; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
|
|
import java.util.concurrent.Executors; |
|
|
|
|
|
import java.util.concurrent.Future; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Project: anrui_scm(anrui_scm) <br/> |
|
|
* Project: anrui_scm(anrui_scm) <br/> |
|
@ -81,9 +112,29 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
@Autowired |
|
|
@Autowired |
|
|
ScmVehicleStayPatrolinspectionService scmVehicleStayPatrolinspectionService; |
|
|
ScmVehicleStayPatrolinspectionService scmVehicleStayPatrolinspectionService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
ScmVehPatrolinspectionmonthService scmVehPatrolinspectionmonthService; |
|
|
|
|
|
@Autowired |
|
|
SysStaffOrgFeign sysStaffOrgFeign; |
|
|
SysStaffOrgFeign sysStaffOrgFeign; |
|
|
@Autowired |
|
|
@Autowired |
|
|
SysUserFeign sysUserFeign; |
|
|
SysUserFeign sysUserFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
BaseVehicleFeign baseVehicleFeign; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 消息类型:0002手机端 |
|
|
|
|
|
*/ |
|
|
|
|
|
public static final String IDENTIFIER = "0002"; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
ScmVehInventorymonthService scmVehInventorymonthService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private MessageFeign messageFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private MessageTypeFeign messageTypeFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
ScmWarehouseService scmWarehouseService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private QueryWrapper<ScmVehiclePatrolinspectionsheet> createQueryWrapper(ScmVehiclePatrolinspectionsheetQuery query) { |
|
|
private QueryWrapper<ScmVehiclePatrolinspectionsheet> createQueryWrapper(ScmVehiclePatrolinspectionsheetQuery query) { |
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
@ -144,12 +195,26 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
List<String> images = new ArrayList<>(); |
|
|
List<String> images = new ArrayList<>(); |
|
|
AppScmVehiclePatrolinspectionsheetInfoVo vo = baseMapper.getInspection(recordSid); |
|
|
AppScmVehiclePatrolinspectionsheetInfoVo vo = baseMapper.getInspection(recordSid); |
|
|
if (vo == null) { |
|
|
if (vo == null) { |
|
|
AppScmVehiclePatrolinspectionsheetInfoVo appScmVehiclePatrolinspectionsheetInfoVo = new AppScmVehiclePatrolinspectionsheetInfoVo(); |
|
|
AppScmVehiclePatrolinspectionsheetInfoVo patrolinspectionsheetInfoVo = new AppScmVehiclePatrolinspectionsheetInfoVo(); |
|
|
List<String> stringList = new ArrayList<>(); |
|
|
ScmVehiclePatrolinspection scmVehiclePatrolinspection = scmVehiclePatrolinspectionService.fetchBySid(recordSid); |
|
|
appScmVehiclePatrolinspectionsheetInfoVo.setImages(stringList); |
|
|
patrolinspectionsheetInfoVo.setVin(scmVehiclePatrolinspection.getVinNo()); |
|
|
appScmVehiclePatrolinspectionsheetInfoVo.setRecordSid(recordSid); |
|
|
BaseVehicleVo data = baseVehicleFeign.selVehicleByVinNo(scmVehiclePatrolinspection.getVinNo()).getData(); |
|
|
return appScmVehiclePatrolinspectionsheetInfoVo; |
|
|
patrolinspectionsheetInfoVo.setModel(data.getModelName()); |
|
|
|
|
|
patrolinspectionsheetInfoVo.setModelSid(data.getModelSid()); |
|
|
|
|
|
patrolinspectionsheetInfoVo.setRecordSid(recordSid); |
|
|
|
|
|
return patrolinspectionsheetInfoVo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<AppLiableListVo> list = new ArrayList<>(); |
|
|
|
|
|
List<String> splitName = Arrays.asList(vo.getLiableName().split(",")); |
|
|
|
|
|
List<String> splitSid = Arrays.asList(vo.getLiableSid().split(",")); |
|
|
|
|
|
for (int i = 0; i < splitName.size(); i++) { |
|
|
|
|
|
AppLiableListVo v = new AppLiableListVo(); |
|
|
|
|
|
v.setLiableName(splitName.get(i)); |
|
|
|
|
|
v.setLiableSid(splitSid.get(i)); |
|
|
|
|
|
list.add(v); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setLiableList(list); |
|
|
List<ScmFile> scmFiles1 = scmFileService.selectByLinkSid(vo.getSid(), type1); |
|
|
List<ScmFile> scmFiles1 = scmFileService.selectByLinkSid(vo.getSid(), type1); |
|
|
if (scmFiles1.size() > 0) { |
|
|
if (scmFiles1.size() > 0) { |
|
|
for (ScmFile scmFile : scmFiles1) { |
|
|
for (ScmFile scmFile : scmFiles1) { |
|
@ -159,10 +224,40 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
} else { |
|
|
} else { |
|
|
vo.setImages(images); |
|
|
vo.setImages(images); |
|
|
} |
|
|
} |
|
|
|
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(vo.getUserSid()).getData(); |
|
|
|
|
|
vo.setUserName(sysUserVo.getName()); |
|
|
vo.setRecordSid(recordSid); |
|
|
vo.setRecordSid(recordSid); |
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AppScmVehiclePatroVo getInspectionInfo(String recordSid) { |
|
|
|
|
|
String type1 = "06"; // 巡检相关照片
|
|
|
|
|
|
AppScmVehiclePatroVo vo = baseMapper.getInspectionInfo(recordSid); |
|
|
|
|
|
if (StringUtils.isNotBlank(vo.getLiableName())) { |
|
|
|
|
|
List<AppLiableListVo> list = new ArrayList<>(); |
|
|
|
|
|
List<String> splitName = Arrays.asList(vo.getLiableName().split(",")); |
|
|
|
|
|
List<String> splitSid = Arrays.asList(vo.getLiableSid().split(",")); |
|
|
|
|
|
for (int i = 0; i < splitName.size(); i++) { |
|
|
|
|
|
AppLiableListVo v = new AppLiableListVo(); |
|
|
|
|
|
v.setLiableName(splitName.get(i)); |
|
|
|
|
|
v.setLiableSid(splitSid.get(i)); |
|
|
|
|
|
list.add(v); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setLiableList(list); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> images = new ArrayList<>(); |
|
|
|
|
|
List<ScmFile> scmFiles1 = scmFileService.selectByLinkSid(vo.getSid(), type1); |
|
|
|
|
|
if (scmFiles1.size() > 0) { |
|
|
|
|
|
for (ScmFile scmFile : scmFiles1) { |
|
|
|
|
|
images.add(fileUploadComponent.getUrlPrefix() + scmFile.getFilePath()); |
|
|
|
|
|
} |
|
|
|
|
|
vo.setImages(images); |
|
|
|
|
|
} else { |
|
|
|
|
|
vo.setImages(images); |
|
|
|
|
|
} |
|
|
|
|
|
return vo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 手机端-保存巡检操作 |
|
|
* 手机端-保存巡检操作 |
|
|
* |
|
|
* |
|
@ -174,12 +269,49 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
String s1 = ""; |
|
|
String s1 = ""; |
|
|
String type1 = "06"; //巡检相关照片
|
|
|
String type1 = "06"; //巡检相关照片
|
|
|
|
|
|
String oneKey = "001"; |
|
|
|
|
|
String oneValue = "问题未解决"; |
|
|
|
|
|
String newDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
|
|
ScmVehiclePatrolinspectionsheet scmVehiclePatrolinspectionsheet = new ScmVehiclePatrolinspectionsheet(); |
|
|
ScmVehiclePatrolinspectionsheet scmVehiclePatrolinspectionsheet = new ScmVehiclePatrolinspectionsheet(); |
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); |
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); |
|
|
ScmVehiclePatrolinspectionsheetDetailsVo pcInspection = baseMapper.getPCInspection(dto.getMainSid()); |
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(dto.getUserSid()).getData(); |
|
|
if (pcInspection == null) { |
|
|
SysStaffOrg sysStaffOrg = sysStaffOrgFeign.getOrgByStaffSid(sysUserVo.getStaffSid()).getData(); |
|
|
|
|
|
Boolean newAdd = dto.getNewAdd(); |
|
|
|
|
|
if (newAdd) { |
|
|
|
|
|
List<ScmVehPatrolinspectionmonthVo> monthVoList = scmVehPatrolinspectionmonthService.selectListAll(); |
|
|
|
|
|
ScmVehPatrolinspectionmonthVo scmVehPatrolinspectionmonthVo = null; |
|
|
|
|
|
if (monthVoList.size() > 0) { |
|
|
|
|
|
scmVehPatrolinspectionmonthVo = monthVoList.get(0); |
|
|
|
|
|
} else { |
|
|
|
|
|
scmVehPatrolinspectionmonthService.getInspectionRecords(dto.getUserSid()); |
|
|
|
|
|
monthVoList = scmVehPatrolinspectionmonthService.selectListAll(); |
|
|
|
|
|
scmVehPatrolinspectionmonthVo = monthVoList.get(0); |
|
|
|
|
|
} |
|
|
|
|
|
ScmVehiclePatrolinspection scmVehiclePatrolinspection = new ScmVehiclePatrolinspection(); |
|
|
|
|
|
scmVehiclePatrolinspection.setVinNo(dto.getVinNo()); |
|
|
|
|
|
scmVehiclePatrolinspection.setMainSid(scmVehPatrolinspectionmonthVo.getSid()); |
|
|
|
|
|
scmVehiclePatrolinspection.setLocation(dto.getWarehouse()); |
|
|
|
|
|
scmVehiclePatrolinspection.setLocationSid(dto.getWarehouseSid()); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionState(oneValue); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionStateKey(oneKey); |
|
|
|
|
|
scmVehiclePatrolinspection.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspection.setUseOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspectionService.save(scmVehiclePatrolinspection); |
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(dto, scmVehiclePatrolinspectionsheet, "sid"); |
|
|
BeanUtil.copyProperties(dto, scmVehiclePatrolinspectionsheet, "sid"); |
|
|
|
|
|
List<AppLiableListDto> liableList = dto.getLiableList(); |
|
|
|
|
|
String DutyName = ""; |
|
|
|
|
|
String DutySid = ""; |
|
|
|
|
|
for (AppLiableListDto appLiableListDto : liableList) { |
|
|
|
|
|
DutyName = appLiableListDto.getLiableName() + "," + DutyName; |
|
|
|
|
|
DutySid = appLiableListDto.getLiableSid() + "," + DutySid; |
|
|
|
|
|
} |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setDutyName(DutyName.substring(0, DutyName.length() - 1)); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setDutySid(DutySid.substring(0, DutySid.length() - 1)); |
|
|
scmVehiclePatrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
scmVehiclePatrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setCreateBySid(dto.getUserSid()); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setUseOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setMainSid(scmVehiclePatrolinspection.getSid()); |
|
|
save(scmVehiclePatrolinspectionsheet); |
|
|
save(scmVehiclePatrolinspectionsheet); |
|
|
scmFileService.deleteByLinkSidAndType(scmVehiclePatrolinspectionsheet.getSid(), type1); |
|
|
scmFileService.deleteByLinkSidAndType(scmVehiclePatrolinspectionsheet.getSid(), type1); |
|
|
List<String> images = dto.getImages(); |
|
|
List<String> images = dto.getImages(); |
|
@ -194,29 +326,235 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
scmFile1.setLinkSid(scmVehiclePatrolinspectionsheet.getSid()); |
|
|
scmFile1.setLinkSid(scmVehiclePatrolinspectionsheet.getSid()); |
|
|
scmFileService.save(scmFile1); |
|
|
scmFileService.save(scmFile1); |
|
|
} |
|
|
} |
|
|
return rb.success(); |
|
|
List<String> receiveIdList = new ArrayList<>(); |
|
|
} else { |
|
|
for (AppLiableListDto appLiableListDto : liableList) { |
|
|
dto.setCreateOrgSid(useOrgSid); |
|
|
SysUserVo sysUserVos = sysUserFeign.fetchBySid(appLiableListDto.getLiableSid()).getData(); |
|
|
dto.setSid(pcInspection.getSid()); |
|
|
Integer id = sysUserVos.getId(); |
|
|
int i = updateBySid(dto, pcInspection.getSid()); |
|
|
receiveIdList.add(String.valueOf(id)); |
|
|
if (i == 0) { |
|
|
|
|
|
return rb.setMsg("操作失败"); |
|
|
|
|
|
} |
|
|
} |
|
|
scmFileService.deleteByLinkSidAndType(dto.getSid(), type1); |
|
|
AppPatrolinspectionDto appPatrolinspectionDto = new AppPatrolinspectionDto(); |
|
|
List<String> images = dto.getImages(); |
|
|
appPatrolinspectionDto.setMsgContent(sysUserVo.getName()); |
|
|
for (String s : images) { |
|
|
appPatrolinspectionDto.setList(liableList); |
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
appPatrolinspectionDto.setMainSid(dto.getMainSid()); |
|
|
s1 = s.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
appPatrolinspectionDto.setReceiveIdList(receiveIdList); |
|
|
|
|
|
// 消息推送
|
|
|
|
|
|
sendMessage(appPatrolinspectionDto); |
|
|
|
|
|
return rb.success().setMsg("添加成功"); |
|
|
|
|
|
} |
|
|
|
|
|
BeanUtil.copyProperties(dto, scmVehiclePatrolinspectionsheet, "sid"); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setCreateBySid(dto.getUserSid()); |
|
|
|
|
|
List<AppLiableListDto> liableList = dto.getLiableList(); |
|
|
|
|
|
String DutyName = ""; |
|
|
|
|
|
String DutySid = ""; |
|
|
|
|
|
for (AppLiableListDto appLiableListDto : liableList) { |
|
|
|
|
|
DutyName = appLiableListDto.getLiableName() + "," + DutyName; |
|
|
|
|
|
DutySid = appLiableListDto.getLiableSid() + "," + DutySid; |
|
|
|
|
|
} |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setDutyName(DutyName.substring(0, DutyName.length() - 1)); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setDutySid(DutySid.substring(0, DutySid.length() - 1)); |
|
|
|
|
|
scmFileService.deleteByLinkSidAndType(scmVehiclePatrolinspectionsheet.getSid(), type1); |
|
|
|
|
|
List<String> images = dto.getImages(); |
|
|
|
|
|
for (String s : images) { |
|
|
|
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
|
|
s1 = s.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
|
|
} |
|
|
|
|
|
ScmFile scmFile1 = new ScmFile(); |
|
|
|
|
|
scmFile1.setAttachType(type1); |
|
|
|
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
|
|
|
scmFile1.setFilePath(s1); |
|
|
|
|
|
scmFile1.setLinkSid(scmVehiclePatrolinspectionsheet.getSid()); |
|
|
|
|
|
scmFileService.save(scmFile1); |
|
|
|
|
|
} |
|
|
|
|
|
save(scmVehiclePatrolinspectionsheet); |
|
|
|
|
|
scmVehiclePatrolinspectionService.updateByMainSid(oneKey, oneValue, newDate, sysUserVo.getName(), dto.getMainSid()); |
|
|
|
|
|
List<String> receiveIdList = new ArrayList<>(); |
|
|
|
|
|
for (AppLiableListDto appLiableListDto : liableList) { |
|
|
|
|
|
SysUserVo sysUserVos = sysUserFeign.fetchBySid(appLiableListDto.getLiableSid()).getData(); |
|
|
|
|
|
Integer id = sysUserVos.getId(); |
|
|
|
|
|
receiveIdList.add(String.valueOf(id)); |
|
|
|
|
|
} |
|
|
|
|
|
AppPatrolinspectionDto appPatrolinspectionDto = new AppPatrolinspectionDto(); |
|
|
|
|
|
appPatrolinspectionDto.setMsgContent(sysUserVo.getName()); |
|
|
|
|
|
appPatrolinspectionDto.setList(liableList); |
|
|
|
|
|
appPatrolinspectionDto.setMainSid(dto.getMainSid()); |
|
|
|
|
|
appPatrolinspectionDto.setReceiveIdList(receiveIdList); |
|
|
|
|
|
// 消息推送
|
|
|
|
|
|
sendMessage(appPatrolinspectionDto); |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 手机端-盘库推送保存巡检操作 |
|
|
|
|
|
* |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public ResultBean savePatrolinspectionsheet(ScmVehiclePatrolinspectionsheetDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
String s1 = ""; |
|
|
|
|
|
String type1 = "06"; //巡检相关照片
|
|
|
|
|
|
String oneKey = "001"; |
|
|
|
|
|
String oneValue = "问题未解决"; |
|
|
|
|
|
|
|
|
|
|
|
ScmVehiclePatrolinspectionsheet scmVehiclePatrolinspectionsheet = new ScmVehiclePatrolinspectionsheet(); |
|
|
|
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); |
|
|
|
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(dto.getUserSid()).getData(); |
|
|
|
|
|
//查询是否有月度巡检记录
|
|
|
|
|
|
List<ScmVehPatrolinspectionmonthVo> monthVoList = scmVehPatrolinspectionmonthService.selectListAll(); |
|
|
|
|
|
ScmVehPatrolinspectionmonthVo scmVehPatrolinspectionmonthVo = null; |
|
|
|
|
|
if (monthVoList.size() > 0) { // 有 根据生成巡检月度报告 判断 是否已生成报告
|
|
|
|
|
|
|
|
|
|
|
|
scmVehPatrolinspectionmonthVo = monthVoList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
if (scmVehPatrolinspectionmonthVo.getState() == 0) { |
|
|
|
|
|
// 否 继续走新增
|
|
|
|
|
|
scmVehPatrolinspectionmonthVo = monthVoList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
} else if (scmVehPatrolinspectionmonthVo.getState() == 1) { |
|
|
|
|
|
// 是 先生成月度巡检 和 巡检记录
|
|
|
|
|
|
scmVehPatrolinspectionmonthService.getInspectionRecords(dto.getUserSid()); |
|
|
|
|
|
monthVoList = scmVehPatrolinspectionmonthService.selectListAll(); |
|
|
|
|
|
scmVehPatrolinspectionmonthVo = monthVoList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} else { // 否 先生成月度巡检 和 巡检记录
|
|
|
|
|
|
|
|
|
|
|
|
scmVehPatrolinspectionmonthService.getInspectionRecords(dto.getUserSid()); |
|
|
|
|
|
monthVoList = scmVehPatrolinspectionmonthService.selectListAll(); |
|
|
|
|
|
scmVehPatrolinspectionmonthVo = monthVoList.get(0); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ScmVehiclePatrolinspection scmVehiclePatrolinspection = new ScmVehiclePatrolinspection(); |
|
|
|
|
|
scmVehiclePatrolinspection.setVinNo(dto.getVinNo()); |
|
|
|
|
|
scmVehiclePatrolinspection.setMainSid(scmVehPatrolinspectionmonthVo.getSid()); |
|
|
|
|
|
scmVehiclePatrolinspection.setLocation(dto.getWarehouse()); |
|
|
|
|
|
scmVehiclePatrolinspection.setLocationSid(dto.getWarehouseSid()); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionState(oneValue); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionStateKey(oneKey); |
|
|
|
|
|
scmVehiclePatrolinspection.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspection.setUseOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspection.setState(0); |
|
|
|
|
|
scmVehiclePatrolinspectionService.save(scmVehiclePatrolinspection); |
|
|
|
|
|
|
|
|
|
|
|
BeanUtil.copyProperties(dto, scmVehiclePatrolinspectionsheet, "sid"); |
|
|
|
|
|
ScmWarehouse scmWarehouse = scmWarehouseService.fetchBySid(dto.getWarehouseSid()); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setDutyName(scmWarehouse.getLibTubeName()); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setDutySid(scmWarehouse.getLibTubeSid()); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setCreateBySid(dto.getUserSid()); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setUseOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setMainSid(scmVehiclePatrolinspection.getSid()); |
|
|
|
|
|
BaseVehicleVo vehicleVo = baseVehicleFeign.selVehicleByVinNo(dto.getVinNo()).getData(); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setModel(vehicleVo.getModelName()); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setModelSid(vehicleVo.getModelSid()); |
|
|
|
|
|
save(scmVehiclePatrolinspectionsheet); |
|
|
|
|
|
|
|
|
|
|
|
scmFileService.deleteByLinkSidAndType(scmVehiclePatrolinspectionsheet.getSid(), type1); |
|
|
|
|
|
List<String> images = dto.getImages(); |
|
|
|
|
|
if (images != null) { |
|
|
|
|
|
if (images.size() > 0) { |
|
|
|
|
|
for (String s : images) { |
|
|
|
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
|
|
s1 = s.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
|
|
} |
|
|
|
|
|
ScmFile scmFile1 = new ScmFile(); |
|
|
|
|
|
scmFile1.setAttachType(type1); |
|
|
|
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
|
|
|
scmFile1.setFilePath(s1); |
|
|
|
|
|
scmFile1.setLinkSid(scmVehiclePatrolinspectionsheet.getSid()); |
|
|
|
|
|
scmFileService.save(scmFile1); |
|
|
} |
|
|
} |
|
|
ScmFile scmFile1 = new ScmFile(); |
|
|
|
|
|
scmFile1.setAttachType(type1); |
|
|
|
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
|
|
|
scmFile1.setFilePath(s1); |
|
|
|
|
|
scmFile1.setLinkSid(dto.getSid()); |
|
|
|
|
|
scmFileService.save(scmFile1); |
|
|
|
|
|
} |
|
|
} |
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<String> receiveIdList = new ArrayList<>(); |
|
|
|
|
|
SysUserVo sysUserVos = sysUserFeign.fetchBySid(scmWarehouse.getLibTubeSid()).getData(); |
|
|
|
|
|
Integer id = sysUserVos.getId(); |
|
|
|
|
|
receiveIdList.add(String.valueOf(id)); |
|
|
|
|
|
List<AppLiableListDto> liableList = new ArrayList<>(); |
|
|
|
|
|
AppLiableListDto appLiableListDto = new AppLiableListDto(); |
|
|
|
|
|
appLiableListDto.setLiableName(scmWarehouse.getLibTubeName()); |
|
|
|
|
|
appLiableListDto.setLiableSid(scmWarehouse.getLibTubeSid()); |
|
|
|
|
|
liableList.add(appLiableListDto); |
|
|
|
|
|
AppPatrolinspectionDto appPatrolinspectionDto = new AppPatrolinspectionDto(); |
|
|
|
|
|
appPatrolinspectionDto.setMsgContent(sysUserVo.getName()); |
|
|
|
|
|
appPatrolinspectionDto.setList(liableList); |
|
|
|
|
|
appPatrolinspectionDto.setMainSid(dto.getMainSid()); |
|
|
|
|
|
appPatrolinspectionDto.setReceiveIdList(receiveIdList); |
|
|
|
|
|
// 消息推送
|
|
|
|
|
|
sendMessage(appPatrolinspectionDto); |
|
|
|
|
|
return rb.success().setMsg("添加成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 保存消息、发出推送 |
|
|
|
|
|
* |
|
|
|
|
|
* @throws InterruptedException |
|
|
|
|
|
*/ |
|
|
|
|
|
public void sendMessage(AppPatrolinspectionDto appPatrolinspectionDto) { |
|
|
|
|
|
// 1、保存消息体
|
|
|
|
|
|
AppMessageDto messageDto = new AppMessageDto(); |
|
|
|
|
|
ResultBean<List<MessageTypeVo>> messageBean = messageTypeFeign.selectAppMsgTypeList(IDENTIFIER); |
|
|
|
|
|
if (messageBean.getSuccess() && messageBean.getData() != null) { |
|
|
|
|
|
List<MessageTypeVo> typeVoList = messageBean.getData(); |
|
|
|
|
|
for (MessageTypeVo message : typeVoList) { |
|
|
|
|
|
if (message.getMsgType().equals("供应链")) { |
|
|
|
|
|
messageDto.setMsgTypeSid(message.getMsgTypeSid()); |
|
|
|
|
|
messageDto.setMsgType(message.getMsgType()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
messageDto.setMsgTitle("月度巡检问题"); |
|
|
|
|
|
messageDto.setMsgContent(appPatrolinspectionDto.getMsgContent() + "提交的月度巡检问题,请查阅"); |
|
|
|
|
|
messageDto.setMsgSource("供应链"); |
|
|
|
|
|
messageDto.setMsgTargetUri(MsgTargetUriEnum.GYLXJWT.getUri()); |
|
|
|
|
|
messageDto.setApp_type("2"); |
|
|
|
|
|
messageDto.setModuleSid("98ff0724-5df4-4fc7-ab6d-3996e7706acd"); |
|
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
|
|
json.put("recordSid", appPatrolinspectionDto.getMainSid()); |
|
|
|
|
|
messageDto.setArgs_json(json.toJSONString()); |
|
|
|
|
|
String msgSid = (String) messageFeign.saveOrUpdateAppMessage(messageDto).getData(); |
|
|
|
|
|
String msgTypeSid = messageDto.getMsgTypeSid(); |
|
|
|
|
|
// 2、保存至消息列表
|
|
|
|
|
|
List<AppLiableListDto> list = appPatrolinspectionDto.getList(); |
|
|
|
|
|
// 使用多线程保存
|
|
|
|
|
|
List<Future<?>> futures = new ArrayList<Future<?>>(); |
|
|
|
|
|
ExecutorService executor = Executors.newFixedThreadPool(4); |
|
|
|
|
|
for (AppLiableListDto appLiableListDto : list) { |
|
|
|
|
|
Future<?> f = executor.submit(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
System.out.println("run start-----------------" + System.currentTimeMillis() + ":" + Thread.currentThread().getName()); |
|
|
|
|
|
MessageListDto messageList = new MessageListDto(); |
|
|
|
|
|
messageList.setMsgSid(msgSid); |
|
|
|
|
|
messageList.setRDelStatus(0); |
|
|
|
|
|
messageList.setSDelStatus(0); |
|
|
|
|
|
messageList.setReceiverSid(appLiableListDto.getLiableSid()); |
|
|
|
|
|
messageListFeign.save(messageList); |
|
|
|
|
|
// Thread.sleep(5 * 1000);
|
|
|
|
|
|
System.out.println("run end-----------------" + System.currentTimeMillis() + ":" + Thread.currentThread().getName()); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
futures.add(f); |
|
|
|
|
|
} |
|
|
|
|
|
executor.shutdown(); |
|
|
|
|
|
for (int i = 0; i < appPatrolinspectionDto.getReceiveIdList().size(); i++) { |
|
|
|
|
|
/** |
|
|
|
|
|
* msgTitle:排产申请 |
|
|
|
|
|
* content:xxx的排产申请 |
|
|
|
|
|
*/ |
|
|
|
|
|
JPushServer.sendPushAlias(messageDto.getMsgTitle(), messageDto.getMsgContent(), msgTypeSid, "供应链", appPatrolinspectionDto.getReceiveIdList().get(i)); |
|
|
|
|
|
} // 3、推送
|
|
|
|
|
|
// JPushServer.sendPushAll(messageDto.getMsgTitle(), messageDto.getMsgContent(), msgTypeSid, messageDto.getMsgType());
|
|
|
|
|
|
// JPushServer.sendPushAlias(messageDto.getMsgTitle(), messageDto.getMsgContent(), msgSid, messageDto.getMsgType(), "23","26","66"); // 别名
|
|
|
|
|
|
System.out.println("process end"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -228,27 +566,35 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public ResultBean submitInspection(ScmVehiclePatrolinspectionsheetDto dto) { |
|
|
public ResultBean submitInspection(ScmVehiclePatrolinspectionsheetDto dto) { |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
if (StringUtils.isNotBlank(dto.getDutyName())) { |
|
|
|
|
|
return rb.setMsg("选择相关责任人后,不允许点击通过"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getDutySid())) { |
|
|
|
|
|
return rb.setMsg("选择相关责任人后,不允许点击通过"); |
|
|
|
|
|
} |
|
|
|
|
|
String s1 = ""; |
|
|
String s1 = ""; |
|
|
String type1 = "06"; //巡检相关照片
|
|
|
String type1 = "06"; //巡检相关照片
|
|
|
String patrolInspectionSid = dto.getMainSid(); |
|
|
String twoKey = "002"; |
|
|
String newTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
|
|
String twoValue = "问题已解决"; |
|
|
ScmVehiclePatrolinspectionsheetDetailsVo pcInspection = baseMapper.getPCInspection(patrolInspectionSid); |
|
|
String threeKey = "003"; |
|
|
|
|
|
String threeValue = "正常"; |
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); |
|
|
String useOrgSid = sysStaffOrgFeign.getPathSidByUserSid(dto.getUserSid()).getData(); |
|
|
String staffSid = sysUserFeign.getUserOrgInfoByUserSid(dto.getUserSid()).getData().getStaffSid(); |
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(dto.getUserSid()).getData(); |
|
|
SysStaffOrg data = sysStaffOrgFeign.getOrgByStaffSid(staffSid).getData(); |
|
|
String mainSid = dto.getMainSid(); |
|
|
if (pcInspection != null) { |
|
|
String newDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
|
|
dto.setCreateOrgSid(useOrgSid); |
|
|
AppScmVehiclePatrolinspectionsheetVo vo = baseMapper.selectByMainSid(mainSid); |
|
|
int i = updateBySid(dto, dto.getSid()); |
|
|
if (vo == null) { |
|
|
if (i == 0) { |
|
|
ScmVehiclePatrolinspectionsheet patrolinspectionsheet = new ScmVehiclePatrolinspectionsheet(); |
|
|
return rb.setMsg("操作失败"); |
|
|
BeanUtil.copyProperties(dto, patrolinspectionsheet, "sid"); |
|
|
|
|
|
patrolinspectionsheet.setUseOrgSid(useOrgSid); |
|
|
|
|
|
patrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
patrolinspectionsheet.setCreateBySid(dto.getUserSid()); |
|
|
|
|
|
List<AppLiableListDto> liableList = dto.getLiableList(); |
|
|
|
|
|
if (liableList.size() > 0) { |
|
|
|
|
|
String DutyName = ""; |
|
|
|
|
|
String DutySid = ""; |
|
|
|
|
|
for (AppLiableListDto appLiableListDto : liableList) { |
|
|
|
|
|
DutyName = appLiableListDto.getLiableName() + "," + DutyName; |
|
|
|
|
|
DutySid = appLiableListDto.getLiableSid() + "," + DutySid; |
|
|
|
|
|
} |
|
|
|
|
|
patrolinspectionsheet.setDutyName(DutyName.substring(0, DutyName.length() - 1)); |
|
|
|
|
|
patrolinspectionsheet.setDutySid(DutySid.substring(0, DutySid.length() - 1)); |
|
|
} |
|
|
} |
|
|
scmFileService.deleteByLinkSidAndType(dto.getSid(), type1); |
|
|
scmFileService.deleteByLinkSidAndType(patrolinspectionsheet.getSid(), type1); |
|
|
List<String> images = dto.getImages(); |
|
|
List<String> images = dto.getImages(); |
|
|
for (String s : images) { |
|
|
for (String s : images) { |
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
@ -258,57 +604,43 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
scmFile1.setAttachType(type1); |
|
|
scmFile1.setAttachType(type1); |
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
scmFile1.setFilePath(s1); |
|
|
scmFile1.setFilePath(s1); |
|
|
scmFile1.setLinkSid(dto.getSid()); |
|
|
scmFile1.setLinkSid(patrolinspectionsheet.getSid()); |
|
|
scmFileService.save(scmFile1); |
|
|
scmFileService.save(scmFile1); |
|
|
} |
|
|
} |
|
|
ScmVehicleStayPatrolinspection scmVehicleStayPatrolinspection = scmVehicleStayPatrolinspectionService.fetchBySid(patrolInspectionSid); |
|
|
save(patrolinspectionsheet); |
|
|
scmVehicleStayPatrolinspectionService.updateByStaySid(patrolInspectionSid, newTime, dto.getUserName()); |
|
|
scmVehiclePatrolinspectionService.updateByMainSid(threeKey, threeValue, newDate, sysUserVo.getName(), dto.getMainSid()); |
|
|
ScmVehiclePatrolinspection scmVehiclePatrolinspection = new ScmVehiclePatrolinspection(); |
|
|
} else { |
|
|
scmVehiclePatrolinspection.setMainSid(scmVehicleStayPatrolinspection.getMainSid()); |
|
|
ScmVehiclePatrolinspectionsheet patrolinspectionsheet = fetchBySid(vo.getSid()); |
|
|
scmVehiclePatrolinspection.setPatrolInspectionState("1"); |
|
|
BeanUtil.copyProperties(dto, patrolinspectionsheet, "sid"); |
|
|
scmVehiclePatrolinspection.setLocation(scmVehicleStayPatrolinspection.getLocation()); |
|
|
patrolinspectionsheet.setUseOrgSid(useOrgSid); |
|
|
scmVehiclePatrolinspection.setLocationSid(scmVehicleStayPatrolinspection.getLocationSid()); |
|
|
patrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
scmVehiclePatrolinspection.setPatrolInspectionDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); |
|
|
patrolinspectionsheet.setCreateBySid(dto.getUserSid()); |
|
|
scmVehiclePatrolinspection.setPatrolInspectionName(dto.getUserName()); |
|
|
List<AppLiableListDto> liableList = dto.getLiableList(); |
|
|
scmVehiclePatrolinspection.setUseOrgSid(dto.getCreateOrgSid()); |
|
|
String DutyName = ""; |
|
|
scmVehiclePatrolinspection.setCreateOrgSid(dto.getCreateOrgSid()); |
|
|
String DutySid = ""; |
|
|
scmVehiclePatrolinspectionService.save(scmVehiclePatrolinspection); |
|
|
for (AppLiableListDto appLiableListDto : liableList) { |
|
|
baseMapper.updatePatSid(pcInspection.getSid(), scmVehiclePatrolinspection.getSid()); |
|
|
DutyName = appLiableListDto.getLiableName() + "," + DutyName; |
|
|
return rb.success().setMsg("操作成功"); |
|
|
DutySid = appLiableListDto.getLiableSid() + "," + DutySid; |
|
|
} |
|
|
|
|
|
ScmVehiclePatrolinspectionsheet scmVehiclePatrolinspectionsheet = new ScmVehiclePatrolinspectionsheet(); |
|
|
|
|
|
BeanUtil.copyProperties(dto, scmVehiclePatrolinspectionsheet, "sid"); |
|
|
|
|
|
String sid = scmVehiclePatrolinspectionsheet.getSid(); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmFileService.deleteByLinkSidAndType(scmVehiclePatrolinspectionsheet.getSid(), type1); |
|
|
|
|
|
List<String> images = dto.getImages(); |
|
|
|
|
|
for (String s : images) { |
|
|
|
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
|
|
s1 = s.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
|
|
} |
|
|
} |
|
|
ScmFile scmFile1 = new ScmFile(); |
|
|
patrolinspectionsheet.setDutyName(DutyName.substring(0, DutyName.length() - 1)); |
|
|
scmFile1.setAttachType(type1); |
|
|
patrolinspectionsheet.setDutySid(DutySid.substring(0, DutySid.length() - 1)); |
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
scmFileService.deleteByLinkSidAndType(patrolinspectionsheet.getSid(), type1); |
|
|
scmFile1.setFilePath(s1); |
|
|
List<String> images = dto.getImages(); |
|
|
scmFile1.setLinkSid(sid); |
|
|
for (String s : images) { |
|
|
scmFileService.save(scmFile1); |
|
|
if (s.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
|
|
s1 = s.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
|
|
} |
|
|
|
|
|
ScmFile scmFile1 = new ScmFile(); |
|
|
|
|
|
scmFile1.setAttachType(type1); |
|
|
|
|
|
scmFile1.setFileName("巡检相关照片"); |
|
|
|
|
|
scmFile1.setFilePath(s1); |
|
|
|
|
|
scmFile1.setLinkSid(patrolinspectionsheet.getSid()); |
|
|
|
|
|
scmFileService.save(scmFile1); |
|
|
|
|
|
} |
|
|
|
|
|
updateById(patrolinspectionsheet); |
|
|
|
|
|
scmVehiclePatrolinspectionService.updateByMainSid(twoKey, twoValue, newDate, sysUserVo.getName(), dto.getMainSid()); |
|
|
} |
|
|
} |
|
|
ScmVehicleStayPatrolinspection scmVehicleStayPatrolinspection = scmVehicleStayPatrolinspectionService.fetchBySid(patrolInspectionSid); |
|
|
return rb.success(); |
|
|
scmVehicleStayPatrolinspectionService.updateByStaySid(patrolInspectionSid, newTime, dto.getUserName()); |
|
|
|
|
|
ScmVehiclePatrolinspection scmVehiclePatrolinspection = new ScmVehiclePatrolinspection(); |
|
|
|
|
|
scmVehiclePatrolinspection.setMainSid(scmVehicleStayPatrolinspection.getMainSid()); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionState("1"); |
|
|
|
|
|
scmVehiclePatrolinspection.setLocation(scmVehicleStayPatrolinspection.getLocation()); |
|
|
|
|
|
scmVehiclePatrolinspection.setLocationSid(scmVehicleStayPatrolinspection.getLocationSid()); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionDate(newTime); |
|
|
|
|
|
scmVehiclePatrolinspection.setPatrolInspectionName(dto.getUserName()); |
|
|
|
|
|
scmVehiclePatrolinspection.setCreateOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspection.setUseOrgSid(useOrgSid); |
|
|
|
|
|
scmVehiclePatrolinspection.setSid(scmVehicleStayPatrolinspection.getSid()); |
|
|
|
|
|
scmVehiclePatrolinspectionService.save(scmVehiclePatrolinspection); |
|
|
|
|
|
scmVehiclePatrolinspectionsheet.setMainSid(scmVehiclePatrolinspection.getSid()); |
|
|
|
|
|
save(scmVehiclePatrolinspectionsheet); |
|
|
|
|
|
return rb.success().setMsg("操作成功"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ResultBean<ScmVehiclePatrolinspectionsheetDetailsVo> fetchSheetBySid(String sid) { |
|
|
public ResultBean<ScmVehiclePatrolinspectionsheetDetailsVo> fetchSheetBySid(String sid) { |
|
@ -334,4 +666,25 @@ public class ScmVehiclePatrolinspectionsheetService extends MybatisBaseService<S |
|
|
vo.setImages(images); |
|
|
vo.setImages(images); |
|
|
return vo; |
|
|
return vo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getApplyCode() { |
|
|
|
|
|
String billNo = ""; |
|
|
|
|
|
LocalDateTime now = LocalDateTime.now(ZoneId.of("+8")); |
|
|
|
|
|
String pattern = "yyyyMM"; |
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); |
|
|
|
|
|
String bill = formatter.format(now); |
|
|
|
|
|
String i = scmVehPatrolinspectionmonthService.selectNum(bill); |
|
|
|
|
|
if (StringUtils.isNotBlank(i)) { |
|
|
|
|
|
billNo = getBillNo(bill, Integer.valueOf(i).intValue()); |
|
|
|
|
|
} else { |
|
|
|
|
|
billNo = getBillNo(bill, 0); |
|
|
|
|
|
} |
|
|
|
|
|
return billNo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String getBillNo(String bill, int i) { |
|
|
|
|
|
String num = String.format("%02d", i + 1); // 不足2位补0
|
|
|
|
|
|
String billNo = bill + num; |
|
|
|
|
|
return billNo; |
|
|
|
|
|
} |
|
|
} |
|
|
} |