手持接口-巡检工单-提交接口

highway
wws 1 year ago
parent f60d6559f9
commit 45c3b2b7c9

@ -2,6 +2,7 @@ package com.op.device.mapper;
import java.util.List; import java.util.List;
import com.op.common.core.domain.BaseFileData;
import com.op.device.domain.EquOrderStandard; import com.op.device.domain.EquOrderStandard;
/** /**
@ -65,4 +66,10 @@ public interface EquOrderStandardMapper {
* @return * @return
*/ */
List<EquOrderStandard> selectEquOrderStandardByParentCode(String code); List<EquOrderStandard> selectEquOrderStandardByParentCode(String code);
/**
*
* @param files
*/
void insertBaseFileBatch(List<BaseFileData> files);
} }

@ -1,7 +1,13 @@
package com.op.device.service.impl; package com.op.device.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils;
import com.op.device.domain.EquOrder; import com.op.device.domain.EquOrder;
import com.op.device.domain.EquOrderDetail; import com.op.device.domain.EquOrderDetail;
import com.op.device.domain.EquOrderEqu; import com.op.device.domain.EquOrderEqu;
@ -121,12 +127,51 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
/** /**
* TODO * TODO
*
* @param equOrder * @param equOrder
* @return * @return
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult updateInspectionRecord(EquOrder equOrder) { public AjaxResult updateInspectionRecord(EquOrder equOrder) {
// 改变工单状态-已完成
equOrder.setOrderStatus("1");
EquOrderEqu equ = equOrder.getEqu();
List<EquOrderDetail> detailList = equ.getDetailList();
for (EquOrderDetail detail : detailList) {
List<EquOrderStandard> standardList = detail.getStandardList();
for (EquOrderStandard standard : standardList) {
//上传附件
if (StringUtils.isNotEmpty(standard.getPicturePath())) {
String[] ids = standard.getPicturePath().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(standard.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
equOrderStandardMapper.insertBaseFileBatch(files);
}
// 更新标准
standard.setUpdateTime(DateUtils.getNowDate());
equOrderStandardMapper.updateEquOrderStandard(standard);
}
}
// 更新工单信息
equOrder.setUpdateTime(DateUtils.getNowDate());
equOrderMapper.updateEquOrder(equOrder);
return success(equOrder); return success(equOrder);
} }
} }

@ -88,7 +88,7 @@
<select id="selectTodayTask" resultType="java.lang.Integer" resultMap="EquOrderResult"> <select id="selectTodayTask" resultType="java.lang.Integer" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/> <include refid="selectEquOrderVo"/>
where CONVERT(date,GETDATE()) > order_start and plan_type = 'inspection' and del_flag = '0' and order_status != '1' and order_code in ( where CONVERT(date,GETDATE()) > plan_loop_start and plan_type = 'inspection' and del_flag = '0' and order_status != '1' and order_code in (
select order_code from equ_order_person where del_flag = '0' and user_id = #{userId} GROUP BY order_code select order_code from equ_order_person where del_flag = '0' and user_id = #{userId} GROUP BY order_code
) )
</select> </select>

@ -117,6 +117,22 @@
</trim> </trim>
</insert> </insert>
<insert id="insertBaseFileBatch">
INSERT INTO base_file(file_id, file_name, file_address, source_id, remark, create_by, create_time)
VALUES
<foreach collection="baseFiles" index="" item="baseFile" separator=",">
(
#{baseFile.fileId},
#{baseFile.fileName},
#{baseFile.fileAddress},
#{baseFile.sourceId},
#{baseFile.remark},
#{baseFile.createBy},
#{baseFile.createTime}
)
</foreach>
</insert>
<update id="updateEquOrderStandard" parameterType="EquOrderStandard"> <update id="updateEquOrderStandard" parameterType="EquOrderStandard">
update equ_order_standard update equ_order_standard
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">

Loading…
Cancel
Save