DMS:PDA故障报修接口
master
xins 8 months ago
parent 7a47c4f922
commit bcb57874eb

@ -0,0 +1,23 @@
package com.hw.common.core.constant;
/**
* @Description:
* @ClassName: DmsConstants
* @Author : xins
* @Date :2024-03-13 17:26
* @Version :1.0
*/
public class DmsConstants {
/**故障报修工单状态*/
public static final String DMS_BILLS_FAULT_INSTANCE_STATUS_TO_REPAIR = "0";//待维修
/**故障报修工单实例状态*/
public static final String DMS_BILLS_FAULT_INSTANCE_ACTIVITY_STATUS_TO_PICK = "2";//待接取
/**故障报修工单类型*/
public static final String DMS_BILLS_FAULT_INSTANCE_TYPE_MAUAL = "1";//手工创建
}

@ -9,7 +9,13 @@ package com.hw.common.core.constant;
*/
public class WfConstants {
public static final Long WF_QUALITY_ABNORMAL_PROCESS_ID = 301L;
public static final Long WF_BILLS_FAULT_INSTANCE_PROCESS_ID = 102L;//故障报修工单流程ID
public static final Long WF_BILLS_FAULT_INSTANCE_PROCESS_ACTIVITY_FIRST_ID = 1021L;//故障报修工单流程节点第一步ID
public static final Long WF_QUALITY_ABNORMAL_PROCESS_ID = 301L;//不合格处置工单流程ID
/**质检工单实例状态*/
public static final String WF_INSTANCE_STATUS_TO_START = "0";//未启动

@ -99,6 +99,15 @@ public class Seq {
public static final String mesBarcodeCode = "TM";
// 设备报修工单编号记录标识
public static final String dmsBillsFaultInstanceSeqType = "DMSBILLSFAULTINSTANCE";
// 设备报修工单接口序列数
private static AtomicInteger dmsBillsFaultInstanceSeq = new AtomicInteger(1);
// 设备报修工单标识
public static final String dmsBillsFaultInstanceSeqCode = "BF";
/**
*
*
@ -177,6 +186,8 @@ public class Seq {
atomicInt = mesBatchCodeSeq;
}else if (mesBarcodeSeqType.equals(type)) {
atomicInt = mesBarcodeSeq;
}else if (dmsBillsFaultInstanceSeqType.equals(type)) {
atomicInt = dmsBillsFaultInstanceSeq;
}
return getId(atomicInt, 3, code);
}

@ -4,7 +4,6 @@ import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.dms.domain.*;
import com.hw.dms.service.*;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@ -1,105 +0,0 @@
package com.hw.dms.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.dms.domain.DmsFaultInstanceFile;
import com.hw.dms.service.IDmsFaultInstanceFileService;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.page.TableDataInfo;
/**
* ;Controller
*
* @author Open Platform
* @date 2024-02-29
*/
@RestController
@RequestMapping("/dmsFaultInstanceFile")
public class DmsFaultInstanceFileController extends BaseController
{
@Autowired
private IDmsFaultInstanceFileService dmsFaultInstanceFileService;
/**
* ;
*/
@RequiresPermissions("dms:dmsFaultInstanceFile:list")
@GetMapping("/list")
public TableDataInfo list(DmsFaultInstanceFile dmsFaultInstanceFile)
{
startPage();
List<DmsFaultInstanceFile> list = dmsFaultInstanceFileService.selectDmsFaultInstanceFileList(dmsFaultInstanceFile);
return getDataTable(list);
}
/**
* ;
*/
@RequiresPermissions("dms:dmsFaultInstanceFile:export")
@Log(title = "故障文件;手工创建,从故障报修开始", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DmsFaultInstanceFile dmsFaultInstanceFile)
{
List<DmsFaultInstanceFile> list = dmsFaultInstanceFileService.selectDmsFaultInstanceFileList(dmsFaultInstanceFile);
ExcelUtil<DmsFaultInstanceFile> util = new ExcelUtil<DmsFaultInstanceFile>(DmsFaultInstanceFile.class);
util.exportExcel(response, list, "故障文件;手工创建,从故障报修开始数据");
}
/**
* ;
*/
@RequiresPermissions("dms:dmsFaultInstanceFile:query")
@GetMapping(value = "/{repairInstanceFileId}")
public AjaxResult getInfo(@PathVariable("repairInstanceFileId") Long repairInstanceFileId)
{
return success(dmsFaultInstanceFileService.selectDmsFaultInstanceFileByRepairInstanceFileId(repairInstanceFileId));
}
/**
* ;
*/
@RequiresPermissions("dms:dmsFaultInstanceFile:add")
@Log(title = "故障文件;手工创建,从故障报修开始", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DmsFaultInstanceFile dmsFaultInstanceFile)
{
return toAjax(dmsFaultInstanceFileService.insertDmsFaultInstanceFile(dmsFaultInstanceFile));
}
/**
* ;
*/
@RequiresPermissions("dms:dmsFaultInstanceFile:edit")
@Log(title = "故障文件;手工创建,从故障报修开始", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DmsFaultInstanceFile dmsFaultInstanceFile)
{
return toAjax(dmsFaultInstanceFileService.updateDmsFaultInstanceFile(dmsFaultInstanceFile));
}
/**
* ;
*/
@RequiresPermissions("dms:dmsFaultInstanceFile:remove")
@Log(title = "故障文件;手工创建,从故障报修开始", businessType = BusinessType.DELETE)
@DeleteMapping("/{repairInstanceFileIds}")
public AjaxResult remove(@PathVariable Long[] repairInstanceFileIds)
{
return toAjax(dmsFaultInstanceFileService.deleteDmsFaultInstanceFileByRepairInstanceFileIds(repairInstanceFileIds));
}
}

@ -0,0 +1,67 @@
package com.hw.dms.controller;
import com.hw.common.core.domain.R;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.dms.domain.DmsBillsFaultInstance;
import com.hw.dms.service.IDmsBillsFaultInstanceService;
import com.hw.system.api.RemoteFileService;
import com.hw.system.api.domain.SysFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Description:PDA
* @ProjectName:HwMes
* @Author:xins
* @Date:2024-03-13 17:08
* @Version:1.0
*/
@RestController
@RequestMapping("/mobile")
public class DmsMobileController extends BaseController {
@Autowired
private IDmsBillsFaultInstanceService dmsBillsFaultInstanceService;
@Resource
private RemoteFileService remoteFileService;
/**
* PDA-
*
*
* id deviceId
* faultType
* faultDescription
* designOperations
* repairType
* id outsrcId()
* files
* */
// @RequiresPermissions("qms:checkresultdetail:add")
@Log(title = "故障报修工单", businessType = BusinessType.INSERT)
@PostMapping("/insertFaultInstsanceActivity")
public AjaxResult insertFaultInstsanceActivity(DmsBillsFaultInstance dmsBillsFaultInstance,
@RequestParam(value = "files") List<MultipartFile> files) {
List<String> fileUrls = new ArrayList<>();
for (MultipartFile file : files) {
R<SysFile> sysFileR = remoteFileService.upload(file);
SysFile sysFile = sysFileR.getData();
fileUrls.add(sysFile.getUrl());
}
dmsBillsFaultInstance.setFileUrls(fileUrls);
return success(dmsBillsFaultInstanceService.insertDmsBillsFaultInstance(dmsBillsFaultInstance));
}
}

@ -74,7 +74,6 @@ public class DmsBillsFaultInstance extends BaseEntity
/** 是否标识1-是0-否 */
@Excel(name = "是否标识1-是0-否")
private List<DmsFaultInstanceFile> dmsFaultInstanceFiles;
private List<SysFile> sysFiles;
@ -96,6 +95,8 @@ public class DmsBillsFaultInstance extends BaseEntity
private Long outsrcId;
private List<String> fileUrls;
public List<SysFile> getSysFiles() {
return sysFiles;
}
@ -104,13 +105,6 @@ public class DmsBillsFaultInstance extends BaseEntity
this.sysFiles = sysFiles;
}
public List<DmsFaultInstanceFile> getDmsFaultInstanceFiles() {
return dmsFaultInstanceFiles;
}
public void setDmsFaultInstanceFiles(List<DmsFaultInstanceFile> dmsFaultInstanceFiles) {
this.dmsFaultInstanceFiles = dmsFaultInstanceFiles;
}
public String getImgUrl() {
return imgUrl;
}
@ -285,6 +279,14 @@ public class DmsBillsFaultInstance extends BaseEntity
return isFlag;
}
public List<String> getFileUrls() {
return fileUrls;
}
public void setFileUrls(List<String> fileUrls) {
this.fileUrls = fileUrls;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -1,79 +1,79 @@
package com.hw.dms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* ; dms_fault_instance_file
*
* @author Open Platform
* @date 2024-02-29
*/
public class DmsFaultInstanceFile extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long repairInstanceFileId;
/** 关联类型(1故障报修工单实例节点2故障记录) */
@Excel(name = "关联类型(1故障报修工单实例节点2故障记录)")
private String targetType;
/** 关联类型为1时关联维修工单实例节点主键关联类型为2时关联维修记录ID */
@Excel(name = "关联类型为1时关联维修工单实例节点主键关联类型为2时关联维修记录ID")
private Long targetId;
/** 故障文件地址,一般是图片 */
@Excel(name = "故障文件地址,一般是图片")
private String faultFile;
public void setRepairInstanceFileId(Long repairInstanceFileId)
{
this.repairInstanceFileId = repairInstanceFileId;
}
public Long getRepairInstanceFileId()
{
return repairInstanceFileId;
}
public void setTargetType(String targetType)
{
this.targetType = targetType;
}
public String getTargetType()
{
return targetType;
}
public void setTargetId(Long targetId)
{
this.targetId = targetId;
}
public Long getTargetId()
{
return targetId;
}
public void setFaultFile(String faultFile)
{
this.faultFile = faultFile;
}
public String getFaultFile()
{
return faultFile;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("repairInstanceFileId", getRepairInstanceFileId())
.append("targetType", getTargetType())
.append("targetId", getTargetId())
.append("faultFile", getFaultFile())
.toString();
}
}
//package com.hw.dms.domain;
//
//import org.apache.commons.lang3.builder.ToStringBuilder;
//import org.apache.commons.lang3.builder.ToStringStyle;
//import com.hw.common.core.annotation.Excel;
//import com.hw.common.core.web.domain.BaseEntity;
//
///**
// * 故障文件;手工创建,从故障报修开始对象 dms_fault_instance_file
// *
// * @author Open Platform
// * @date 2024-02-29
// */
//public class DmsFaultInstanceFile extends BaseEntity
//{
// private static final long serialVersionUID = 1L;
//
// /** 主键标识 */
// private Long repairInstanceFileId;
//
// /** 关联类型(1故障报修工单实例节点2故障记录) */
// @Excel(name = "关联类型(1故障报修工单实例节点2故障记录)")
// private String targetType;
//
// /** 关联类型为1时关联维修工单实例节点主键关联类型为2时关联维修记录ID */
// @Excel(name = "关联类型为1时关联维修工单实例节点主键关联类型为2时关联维修记录ID")
// private Long targetId;
//
// /** 故障文件地址,一般是图片 */
// @Excel(name = "故障文件地址,一般是图片")
// private String faultFile;
//
// public void setRepairInstanceFileId(Long repairInstanceFileId)
// {
// this.repairInstanceFileId = repairInstanceFileId;
// }
//
// public Long getRepairInstanceFileId()
// {
// return repairInstanceFileId;
// }
// public void setTargetType(String targetType)
// {
// this.targetType = targetType;
// }
//
// public String getTargetType()
// {
// return targetType;
// }
// public void setTargetId(Long targetId)
// {
// this.targetId = targetId;
// }
//
// public Long getTargetId()
// {
// return targetId;
// }
// public void setFaultFile(String faultFile)
// {
// this.faultFile = faultFile;
// }
//
// public String getFaultFile()
// {
// return faultFile;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
// .append("repairInstanceFileId", getRepairInstanceFileId())
// .append("targetType", getTargetType())
// .append("targetId", getTargetId())
// .append("faultFile", getFaultFile())
// .toString();
// }
//}

@ -0,0 +1,79 @@
package com.hw.dms.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
/**
* ; dms_instance_file
*
* @author xins
* @date 2024-03-13
*/
public class DmsInstanceFile extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long instanceFileId;
/** 关联类型(1故障报修工单实例节点2故障记录) */
@Excel(name = "关联类型(1故障报修工单实例节点2故障记录)")
private String targetType;
/** 关联类型为1时关联维修工单实例节点主键关联类型为2时关联维修记录ID */
@Excel(name = "关联类型为1时关联维修工单实例节点主键关联类型为2时关联维修记录ID")
private Long targetId;
/** 故障文件地址,一般是图片 */
@Excel(name = "故障文件地址,一般是图片")
private String filePath;
public void setInstanceFileId(Long instanceFileId)
{
this.instanceFileId = instanceFileId;
}
public Long getInstanceFileId()
{
return instanceFileId;
}
public void setTargetType(String targetType)
{
this.targetType = targetType;
}
public String getTargetType()
{
return targetType;
}
public void setTargetId(Long targetId)
{
this.targetId = targetId;
}
public Long getTargetId()
{
return targetId;
}
public void setFilePath(String filePath)
{
this.filePath = filePath;
}
public String getFilePath()
{
return filePath;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("instanceFileId", getInstanceFileId())
.append("targetType", getTargetType())
.append("targetId", getTargetId())
.append("filePath", getFilePath())
.toString();
}
}

@ -1,66 +0,0 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsFaultInstanceFile;
/**
* ;Mapper
*
* @author Open Platform
* @date 2024-02-29
*/
public interface DmsFaultInstanceFileMapper
{
/**
* ;
*
* @param repairInstanceFileId ;
* @return ;
*/
public DmsFaultInstanceFile selectDmsFaultInstanceFileByRepairInstanceFileId(Long repairInstanceFileId);
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return ;
*/
public List<DmsFaultInstanceFile> selectDmsFaultInstanceFileList(DmsFaultInstanceFile dmsFaultInstanceFile);
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return
*/
public int insertDmsFaultInstanceFile(DmsFaultInstanceFile dmsFaultInstanceFile);
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return
*/
public int updateDmsFaultInstanceFile(DmsFaultInstanceFile dmsFaultInstanceFile);
/**
* ;
*
* @param repairInstanceFileId ;
* @return
*/
public int deleteDmsFaultInstanceFileByRepairInstanceFileId(Long repairInstanceFileId);
/**
* ;
*
* @param repairInstanceFileIds
* @return
*/
public int deleteDmsFaultInstanceFileByRepairInstanceFileIds(Long[] repairInstanceFileIds);
/**
* id
* */
List<DmsFaultInstanceFile> selectDmsFaultInstanceFileByFaultId(Long repairInstanceId);
}

@ -0,0 +1,72 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsInstanceFile;
/**
* ;Mapper
*
* @author xins
* @date 2024-03-13
*/
public interface DmsInstanceFileMapper
{
/**
* ;
*
* @param instanceFileId ;
* @return ;
*/
public DmsInstanceFile selectDmsInstanceFileByInstanceFileId(Long instanceFileId);
/**
* ;
*
* @param dmsInstanceFile ;
* @return ;
*/
public List<DmsInstanceFile> selectDmsInstanceFileList(DmsInstanceFile dmsInstanceFile);
/**
* ;
*
* @param dmsInstanceFile ;
* @return
*/
public int insertDmsInstanceFile(DmsInstanceFile dmsInstanceFile);
/**
* ;
*
* @param dmsInstanceFile ;
* @return
*/
public int updateDmsInstanceFile(DmsInstanceFile dmsInstanceFile);
/**
* ;
*
* @param instanceFileId ;
* @return
*/
public int deleteDmsInstanceFileByInstanceFileId(Long instanceFileId);
/**
* ;
*
* @param instanceFileIds
* @return
*/
public int deleteDmsInstanceFileByInstanceFileIds(Long[] instanceFileIds);
/**
* ;
*
* @param dmsInstanceFileList ;
* @return
*/
public int batchDmsInstanceFile(List<DmsInstanceFile> dmsInstanceFileList);
}

@ -1,61 +0,0 @@
package com.hw.dms.service;
import java.util.List;
import com.hw.dms.domain.DmsFaultInstanceFile;
/**
* ;Service
*
* @author Open Platform
* @date 2024-02-29
*/
public interface IDmsFaultInstanceFileService
{
/**
* ;
*
* @param repairInstanceFileId ;
* @return ;
*/
public DmsFaultInstanceFile selectDmsFaultInstanceFileByRepairInstanceFileId(Long repairInstanceFileId);
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return ;
*/
public List<DmsFaultInstanceFile> selectDmsFaultInstanceFileList(DmsFaultInstanceFile dmsFaultInstanceFile);
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return
*/
public int insertDmsFaultInstanceFile(DmsFaultInstanceFile dmsFaultInstanceFile);
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return
*/
public int updateDmsFaultInstanceFile(DmsFaultInstanceFile dmsFaultInstanceFile);
/**
* ;
*
* @param repairInstanceFileIds ;
* @return
*/
public int deleteDmsFaultInstanceFileByRepairInstanceFileIds(Long[] repairInstanceFileIds);
/**
* ;
*
* @param repairInstanceFileId ;
* @return
*/
public int deleteDmsFaultInstanceFileByRepairInstanceFileId(Long repairInstanceFileId);
}

@ -1,22 +1,19 @@
package com.hw.dms.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.constant.DmsConstants;
import com.hw.common.core.constant.WfConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.dms.domain.DmsFaultInstanceActivity;
import com.hw.dms.domain.DmsFaultInstanceFile;
import com.hw.dms.domain.DmsRepairInstanceActivity;
import com.hw.dms.domain.DmsInstanceFile;
import com.hw.dms.mapper.DmsFaultInstanceActivityMapper;
import com.hw.dms.mapper.DmsFaultInstanceFileMapper;
import com.hw.dms.mapper.DmsRepairInstanceActivityMapper;
import com.hw.dms.service.IDmsRepairInstanceActivityService;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.dms.mapper.DmsInstanceFileMapper;
import com.hw.system.api.domain.SysFile;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsBillsFaultInstanceMapper;
@ -31,16 +28,14 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2024-01-23
*/
@Service
public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceService
{
public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceService {
@Autowired
private DmsBillsFaultInstanceMapper dmsBillsFaultInstanceMapper;
@Autowired
private DmsFaultInstanceActivityMapper dmsFaultInstanceActivityMapper;
@Autowired
private RemoteSysCommonService remoteSysCommonService;
@Autowired
private DmsFaultInstanceFileMapper dmsFaultInstanceFileMapper;
private DmsInstanceFileMapper dmsInstanceFileMapper;
/**
*
@ -49,11 +44,10 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
* @return
*/
@Override
public DmsBillsFaultInstance selectDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId)
{
public DmsBillsFaultInstance selectDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId) {
DmsFaultInstanceActivity dmsFaultInstanceActivity = dmsFaultInstanceActivityMapper.selectDmsFaultInstanceActivityByRepairIdMin(repairInstanceId);
DmsBillsFaultInstance dmsBillsFaultInstance = dmsBillsFaultInstanceMapper.selectDmsBillsFaultInstanceByRepairInstanceId(repairInstanceId);
List<DmsFaultInstanceFile> dmsFaultInstanceFiles = dmsFaultInstanceFileMapper.selectDmsFaultInstanceFileByFaultId(repairInstanceId);
// List<DmsFaultInstanceFile> dmsFaultInstanceFiles = dmsFaultInstanceFileMapper.selectDmsFaultInstanceFileByFaultId(repairInstanceId);
List<SysFile> sysFiles = new ArrayList<SysFile>();
SysFile sysFile = new SysFile();
dmsBillsFaultInstance.setFaultType(dmsFaultInstanceActivity.getFaultType());
@ -62,14 +56,14 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
dmsBillsFaultInstance.setDesignOperations(dmsFaultInstanceActivity.getDesignOperations());
dmsBillsFaultInstance.setDeviceId(dmsFaultInstanceActivity.getDeviceId());
dmsBillsFaultInstance.setRepairType(dmsFaultInstanceActivity.getRepairType());
if (dmsFaultInstanceActivity.getOutsrcId()!=null) {
if (dmsFaultInstanceActivity.getOutsrcId() != null) {
dmsBillsFaultInstance.setOutsrcId(dmsFaultInstanceActivity.getOutsrcId());
}
for (DmsFaultInstanceFile dmsFaultFor : dmsFaultInstanceFiles){
sysFile.setUrl(dmsFaultFor.getFaultFile());
sysFiles.add(sysFile);
}
dmsBillsFaultInstance.setDmsFaultInstanceFiles(dmsFaultInstanceFiles);
// for (DmsFaultInstanceFile dmsFaultFor : dmsFaultInstanceFiles) {
// sysFile.setUrl(dmsFaultFor.getFaultFile());
// sysFiles.add(sysFile);
// }
// dmsBillsFaultInstance.setDmsFaultInstanceFiles(dmsFaultInstanceFiles);
dmsBillsFaultInstance.setSysFiles(sysFiles);
return dmsBillsFaultInstance;
}
@ -81,8 +75,7 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
* @return
*/
@Override
public List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceList(DmsBillsFaultInstance dmsBillsFaultInstance)
{
public List<DmsBillsFaultInstance> selectDmsBillsFaultInstanceList(DmsBillsFaultInstance dmsBillsFaultInstance) {
return dmsBillsFaultInstanceMapper.selectDmsBillsFaultInstanceList(dmsBillsFaultInstance);
}
@ -93,46 +86,52 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
* @param dmsBillsFaultInstance
* @return
*/
@Transactional
@Override
@Transactional(rollbackFor = Exception.class)
public int insertDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm");
String str = sdf.format(DateUtils.getNowDate());
LoginUser user = new LoginUser();
dmsBillsFaultInstance.setWfProcessId(102l);
dmsBillsFaultInstance.setApplyUser(user.getUsername());
dmsBillsFaultInstance.setApplyTime(DateUtils.getNowDate());
dmsBillsFaultInstance.setCreateTime(DateUtils.getNowDate());
dmsBillsFaultInstance.setBillsFaultCode(str);
dmsBillsFaultInstance.setBillsStatus("0");
dmsBillsFaultInstance.setInstanceType("1");
int i = dmsBillsFaultInstanceMapper.insertDmsBillsFaultInstance(dmsBillsFaultInstance);
Long aLong = dmsBillsFaultInstanceMapper.selectProcessActivityId(102l);
public int insertDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance) {
Date curretnDate = new Date();
String userName = SecurityUtils.getUsername();
dmsBillsFaultInstance.setWfProcessId(WfConstants.WF_BILLS_FAULT_INSTANCE_PROCESS_ID);
dmsBillsFaultInstance.setApplyUser(userName);
dmsBillsFaultInstance.setApplyTime(curretnDate);
dmsBillsFaultInstance.setCreateTime(curretnDate);
dmsBillsFaultInstance.setCreateBy(userName);
dmsBillsFaultInstance.setBillsFaultCode(Seq.getId(Seq.dmsBillsFaultInstanceSeqType, Seq.dmsBillsFaultInstanceSeqCode));
dmsBillsFaultInstance.setBillsStatus(DmsConstants.DMS_BILLS_FAULT_INSTANCE_STATUS_TO_REPAIR);
dmsBillsFaultInstance.setInstanceType(DmsConstants.DMS_BILLS_FAULT_INSTANCE_TYPE_MAUAL);
int rows = dmsBillsFaultInstanceMapper.insertDmsBillsFaultInstance(dmsBillsFaultInstance);
DmsFaultInstanceActivity dmsFaultInstanceActivity = new DmsFaultInstanceActivity();
dmsFaultInstanceActivity.setRepairInstanceId(dmsBillsFaultInstance.getRepairInstanceId());
dmsFaultInstanceActivity.setProcessActivityId(aLong);
dmsFaultInstanceActivity.setProcessActivityId(WfConstants.WF_BILLS_FAULT_INSTANCE_PROCESS_ACTIVITY_FIRST_ID);
dmsFaultInstanceActivity.setFaultType(dmsBillsFaultInstance.getFaultType());
dmsFaultInstanceActivity.setFaultDescription(dmsBillsFaultInstance.getFaultDescription());
dmsFaultInstanceActivity.setDesignOperations(dmsBillsFaultInstance.getDesignOperations());
dmsFaultInstanceActivity.setDeviceId(dmsBillsFaultInstance.getDeviceId());
dmsFaultInstanceActivity.setRepairType(dmsBillsFaultInstance.getRepairType());
if (dmsBillsFaultInstance.getOutsrcId()!=null){
if (dmsBillsFaultInstance.getOutsrcId() != null) {
dmsFaultInstanceActivity.setOutsrcId(dmsBillsFaultInstance.getOutsrcId());
}
dmsFaultInstanceActivity.setProcessHandleStatus("2");
dmsFaultInstanceActivity.setProcessHandleStatus(DmsConstants.DMS_BILLS_FAULT_INSTANCE_ACTIVITY_STATUS_TO_PICK);
dmsFaultInstanceActivity.setProcessStepOrder(1l);
dmsFaultInstanceActivityMapper.insertDmsFaultInstanceActivity(dmsFaultInstanceActivity);
//存储图片
List<String> fileUrls = dmsBillsFaultInstance.getFileUrls();
if (fileUrls != null && !fileUrls.isEmpty()) {
List<DmsInstanceFile> dmsInstanceFiles = new ArrayList<>();
for (String fileUrl : fileUrls) {
DmsInstanceFile dmsInstanceFile = new DmsInstanceFile();
dmsInstanceFile.setTargetId(dmsFaultInstanceActivity.getInstanceActivityId());
dmsInstanceFile.setTargetType("1");
dmsInstanceFile.setFilePath(fileUrl);
dmsInstanceFiles.add(dmsInstanceFile);
}
dmsInstanceFileMapper.batchDmsInstanceFile(dmsInstanceFiles);
}
DmsFaultInstanceFile dmsFaultInstanceFile = new DmsFaultInstanceFile();
if (dmsBillsFaultInstance.getImgUrl()!=""&&dmsBillsFaultInstance.getImgUrl()!=null){
dmsFaultInstanceFile.setTargetId(dmsFaultInstanceActivity.getInstanceActivityId());
dmsFaultInstanceFile.setTargetType("1");
dmsFaultInstanceFile.setFaultFile(dmsBillsFaultInstance.getImgUrl());
dmsFaultInstanceFileMapper.insertDmsFaultInstanceFile(dmsFaultInstanceFile);}
return i;
return rows;
}
/**
@ -142,8 +141,7 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
* @return
*/
@Override
public int updateDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance)
{
public int updateDmsBillsFaultInstance(DmsBillsFaultInstance dmsBillsFaultInstance) {
dmsBillsFaultInstance.setUpdateTime(DateUtils.getNowDate());
return dmsBillsFaultInstanceMapper.updateDmsBillsFaultInstance(dmsBillsFaultInstance);
}
@ -155,8 +153,7 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
* @return
*/
@Override
public int deleteDmsBillsFaultInstanceByRepairInstanceIds(Long[] repairInstanceIds)
{
public int deleteDmsBillsFaultInstanceByRepairInstanceIds(Long[] repairInstanceIds) {
return dmsBillsFaultInstanceMapper.deleteDmsBillsFaultInstanceByRepairInstanceIds(repairInstanceIds);
}
@ -167,14 +164,14 @@ public class DmsBillsFaultInstanceServiceImpl implements IDmsBillsFaultInstanceS
* @return
*/
@Override
public int deleteDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId)
{
public int deleteDmsBillsFaultInstanceByRepairInstanceId(Long repairInstanceId) {
return dmsBillsFaultInstanceMapper.deleteDmsBillsFaultInstanceByRepairInstanceId(repairInstanceId);
}
/**
* pda-
* */
public int insertDmsBillsFaultInstancePDA(DmsBillsFaultInstance dmsBillsFaultInstance){
*/
public int insertDmsBillsFaultInstancePDA(DmsBillsFaultInstance dmsBillsFaultInstance) {
//根据报修流程查询工单流程节点id
Long aLong = dmsBillsFaultInstanceMapper.selectProcessActivityId(102l);
int i = dmsBillsFaultInstanceMapper.insertDmsBillsFaultInstance(dmsBillsFaultInstance);

@ -1,95 +0,0 @@
package com.hw.dms.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsFaultInstanceFileMapper;
import com.hw.dms.domain.DmsFaultInstanceFile;
import com.hw.dms.service.IDmsFaultInstanceFileService;
/**
* ;Service
*
* @author Open Platform
* @date 2024-02-29
*/
@Service
public class DmsFaultInstanceFileServiceImpl implements IDmsFaultInstanceFileService
{
@Autowired
private DmsFaultInstanceFileMapper dmsFaultInstanceFileMapper;
/**
* ;
*
* @param repairInstanceFileId ;
* @return ;
*/
@Override
public DmsFaultInstanceFile selectDmsFaultInstanceFileByRepairInstanceFileId(Long repairInstanceFileId)
{
return dmsFaultInstanceFileMapper.selectDmsFaultInstanceFileByRepairInstanceFileId(repairInstanceFileId);
}
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return ;
*/
@Override
public List<DmsFaultInstanceFile> selectDmsFaultInstanceFileList(DmsFaultInstanceFile dmsFaultInstanceFile)
{
return dmsFaultInstanceFileMapper.selectDmsFaultInstanceFileList(dmsFaultInstanceFile);
}
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return
*/
@Override
public int insertDmsFaultInstanceFile(DmsFaultInstanceFile dmsFaultInstanceFile)
{
if (dmsFaultInstanceFile!=null){
return dmsFaultInstanceFileMapper.insertDmsFaultInstanceFile(dmsFaultInstanceFile);}
return 0;
}
/**
* ;
*
* @param dmsFaultInstanceFile ;
* @return
*/
@Override
public int updateDmsFaultInstanceFile(DmsFaultInstanceFile dmsFaultInstanceFile)
{
return dmsFaultInstanceFileMapper.updateDmsFaultInstanceFile(dmsFaultInstanceFile);
}
/**
* ;
*
* @param repairInstanceFileIds ;
* @return
*/
@Override
public int deleteDmsFaultInstanceFileByRepairInstanceFileIds(Long[] repairInstanceFileIds)
{
return dmsFaultInstanceFileMapper.deleteDmsFaultInstanceFileByRepairInstanceFileIds(repairInstanceFileIds);
}
/**
* ;
*
* @param repairInstanceFileId ;
* @return
*/
@Override
public int deleteDmsFaultInstanceFileByRepairInstanceFileId(Long repairInstanceFileId)
{
return dmsFaultInstanceFileMapper.deleteDmsFaultInstanceFileByRepairInstanceFileId(repairInstanceFileId);
}
}

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.dms.mapper.DmsFaultInstanceFileMapper">
<resultMap type="DmsFaultInstanceFile" id="DmsFaultInstanceFileResult">
<result property="repairInstanceFileId" column="repair_instance_file_id" />
<result property="targetType" column="target_type" />
<result property="targetId" column="target_id" />
<result property="faultFile" column="fault_file" />
</resultMap>
<sql id="selectDmsFaultInstanceFileVo">
select repair_instance_file_id, target_type, target_id, fault_file from dms_fault_instance_file
</sql>
<select id="selectDmsFaultInstanceFileList" parameterType="DmsFaultInstanceFile" resultMap="DmsFaultInstanceFileResult">
<include refid="selectDmsFaultInstanceFileVo"/>
<where>
<if test="targetType != null and targetType != ''"> and target_type = #{targetType}</if>
<if test="targetId != null "> and target_id = #{targetId}</if>
<if test="faultFile != null and faultFile != ''"> and fault_file = #{faultFile}</if>
</where>
</select>
<select id="selectDmsFaultInstanceFileByRepairInstanceFileId" parameterType="Long" resultMap="DmsFaultInstanceFileResult">
<include refid="selectDmsFaultInstanceFileVo"/>
where repair_instance_file_id = #{repairInstanceFileId}
</select>
<insert id="insertDmsFaultInstanceFile" parameterType="DmsFaultInstanceFile" useGeneratedKeys="true" keyProperty="repairInstanceFileId">
insert into dms_fault_instance_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type,</if>
<if test="targetId != null">target_id,</if>
<if test="faultFile != null and faultFile != ''">fault_file,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="targetType != null and targetType != ''">#{targetType},</if>
<if test="targetId != null">#{targetId},</if>
<if test="faultFile != null and faultFile != ''">#{faultFile},</if>
</trim>
</insert>
<update id="updateDmsFaultInstanceFile" parameterType="DmsFaultInstanceFile">
update dms_fault_instance_file
<trim prefix="SET" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type = #{targetType},</if>
<if test="targetId != null">target_id = #{targetId},</if>
<if test="faultFile != null and faultFile != ''">fault_file = #{faultFile},</if>
</trim>
where repair_instance_file_id = #{repairInstanceFileId}
</update>
<delete id="deleteDmsFaultInstanceFileByRepairInstanceFileId" parameterType="Long">
delete from dms_fault_instance_file where repair_instance_file_id = #{repairInstanceFileId}
</delete>
<delete id="deleteDmsFaultInstanceFileByRepairInstanceFileIds" parameterType="String">
delete from dms_fault_instance_file where repair_instance_file_id in
<foreach item="repairInstanceFileId" collection="array" open="(" separator="," close=")">
#{repairInstanceFileId}
</foreach>
</delete>
<select id="selectDmsFaultInstanceFileByFaultId" parameterType="Long" resultMap="DmsFaultInstanceFileResult">
select * from dms_fault_instance_file where target_id = (
select min(instance_activity_id) from dms_fault_instance_activity where repair_instance_id = #{repairInstanceId}
)
</select>
</mapper>

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.dms.mapper.DmsInstanceFileMapper">
<resultMap type="DmsInstanceFile" id="DmsInstanceFileResult">
<result property="instanceFileId" column="instance_file_id" />
<result property="targetType" column="target_type" />
<result property="targetId" column="target_id" />
<result property="filePath" column="file_path" />
</resultMap>
<sql id="selectDmsInstanceFileVo">
select instance_file_id, target_type, target_id, file_path from dms_instance_file
</sql>
<select id="selectDmsInstanceFileList" parameterType="DmsInstanceFile" resultMap="DmsInstanceFileResult">
<include refid="selectDmsInstanceFileVo"/>
<where>
<if test="targetType != null and targetType != ''"> and target_type = #{targetType}</if>
<if test="targetId != null "> and target_id = #{targetId}</if>
<if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if>
</where>
</select>
<select id="selectDmsInstanceFileByInstanceFileId" parameterType="Long" resultMap="DmsInstanceFileResult">
<include refid="selectDmsInstanceFileVo"/>
where instance_file_id = #{instanceFileId}
</select>
<insert id="insertDmsInstanceFile" parameterType="DmsInstanceFile" useGeneratedKeys="true" keyProperty="instanceFileId">
insert into dms_instance_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type,</if>
<if test="targetId != null">target_id,</if>
<if test="filePath != null and filePath != ''">file_path,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="targetType != null and targetType != ''">#{targetType},</if>
<if test="targetId != null">#{targetId},</if>
<if test="filePath != null and filePath != ''">#{filePath},</if>
</trim>
</insert>
<update id="updateDmsInstanceFile" parameterType="DmsInstanceFile">
update dms_instance_file
<trim prefix="SET" suffixOverrides=",">
<if test="targetType != null and targetType != ''">target_type = #{targetType},</if>
<if test="targetId != null">target_id = #{targetId},</if>
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
</trim>
where instance_file_id = #{instanceFileId}
</update>
<delete id="deleteDmsInstanceFileByInstanceFileId" parameterType="Long">
delete from dms_instance_file where instance_file_id = #{instanceFileId}
</delete>
<delete id="deleteDmsInstanceFileByInstanceFileIds" parameterType="String">
delete from dms_instance_file where instance_file_id in
<foreach item="instanceFileId" collection="array" open="(" separator="," close=")">
#{instanceFileId}
</foreach>
</delete>
<insert id="batchDmsInstanceFile">
insert into dms_instance_file( instance_file_id, target_type, target_id, file_path) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.instanceFileId}, #{item.targetType}, #{item.targetId}, #{item.filePath})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save