Administrator
2023-08-09 9cf1626b76c6de6c837727761dc7816d3639ca87
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
@@ -2,7 +2,11 @@
import java.util.List;
import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecordImg;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointRecordImgMapper;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.utils.result.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.app.patrolplan.mapper.ArdAppPatrolpointRecordMapper;
@@ -21,6 +25,9 @@
public class ArdAppPatrolpointRecordServiceImpl implements IArdAppPatrolpointRecordService {
    @Resource
    private ArdAppPatrolpointRecordMapper ardAppPatrolpointRecordMapper;
    @Resource
    private ArdAppPatrolpointRecordImgMapper recordImgMapper;
    /**
     * 查询app巡检计划记录
@@ -88,4 +95,25 @@
    public int deleteArdAppPatrolpointRecordById(String id) {
        return ardAppPatrolpointRecordMapper.deleteArdAppPatrolpointRecordById(id);
    }
    @Override
    public Results record(ArdAppPatrolpointRecord ardAppPatrolpointRecord) {
        String id = IdUtils.simpleUUID();
        ardAppPatrolpointRecord.setId(id);
        int num = ardAppPatrolpointRecordMapper.insert(ardAppPatrolpointRecord);
        List<String> list = ardAppPatrolpointRecord.getImg();
        for (int i = 0; i < list.size(); i++) {
            ArdAppPatrolpointRecordImg recordImg = new ArdAppPatrolpointRecordImg();
            String imgId = IdUtils.simpleUUID();
            recordImg.setId(imgId);
            recordImg.setAppPatrolponitRecordId(id);
            recordImg.setImg(list.get(i));
            recordImgMapper.insert(recordImg);
        }
        if(num>0){
            return Results.succeed("打卡成功!");
        }else {
            return Results.error("打开失败!");
        }
    }
}