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";//手工创建
|
||||
|
||||
}
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
@ -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…
Reference in New Issue