推送智慧工程代码完善

This commit is contained in:
15856 2024-09-10 10:17:35 +08:00
parent be435a5b8f
commit 821254a944
6 changed files with 59 additions and 7 deletions

View File

@ -21,7 +21,9 @@ import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult; import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.GetTokenByAppKey; import com.bonus.sgzb.common.security.utils.GetTokenByAppKey;
import com.bonus.sgzb.common.security.utils.SecurityUtils; import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.LeaseRecord;
import com.bonus.sgzb.material.exception.ExceptionDict; import com.bonus.sgzb.material.exception.ExceptionDict;
import com.bonus.sgzb.material.mapper.LeaseRecordMapper;
import com.bonus.sgzb.system.api.model.LoginUser; import com.bonus.sgzb.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -86,6 +88,9 @@ public class TmTaskServiceImpl implements TmTaskService {
private final static String STRING_ADMIN = "admin"; private final static String STRING_ADMIN = "admin";
@Resource
private LeaseRecordMapper leaseRecordMapper;
/** /**
* 领料任务审核状态 * 领料任务审核状态
* *
@ -1390,7 +1395,13 @@ public class TmTaskServiceImpl implements TmTaskService {
} catch (Exception e) { } catch (Exception e) {
return AjaxResult.error("请求失败!{}", e.getMessage()); return AjaxResult.error("请求失败!{}", e.getMessage());
} }
//TODO 更改pushStatus log.info("推送成功!修改状态");
//更改推送的状态
for (TmTask tmTask:tmTasks) {
LeaseRecord leaseRecord = new LeaseRecord();
leaseRecord.setId(Integer.valueOf(tmTask.getId()));
leaseRecordMapper.updateLeaseRecord(leaseRecord);
}
return AjaxResult.success("请求成功!"); return AjaxResult.success("请求成功!");
} }
return AjaxResult.success("请求成功!"); return AjaxResult.success("请求成功!");

View File

@ -179,4 +179,12 @@ public class LeaseRecord{
@ApiModelProperty(value = "实时库存") @ApiModelProperty(value = "实时库存")
private Integer num; private Integer num;
@ApiModelProperty(value = "绑定IOT设备数量")
private Integer IotNum;
@ApiModelProperty(value = "Iot定位设备编号")
private String iotCode;
@ApiModelProperty(value = "是否推送到智慧工程01:是")
private Integer pushNotifications;
} }

View File

@ -35,4 +35,6 @@ public interface LeaseRecordMapper {
MaType getMaType(Integer typeId); MaType getMaType(Integer typeId);
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") MaType ma); int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") MaType ma);
void updateLeaseRecord(LeaseRecord leaseRecord);
} }

View File

@ -1,11 +1,16 @@
package com.bonus.sgzb.material.service.impl; package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.domain.vo.IotRecordVo;
import com.bonus.sgzb.base.mapper.BaseIotMachineMapper;
import com.bonus.sgzb.material.domain.LeaseRecord; import com.bonus.sgzb.material.domain.LeaseRecord;
import com.bonus.sgzb.material.mapper.LeaseRecordMapper; import com.bonus.sgzb.material.mapper.LeaseRecordMapper;
import com.bonus.sgzb.material.service.LeaseRecordService; import com.bonus.sgzb.material.service.LeaseRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -15,12 +20,30 @@ import java.util.List;
@Service @Service
public class LeaseRecordServiceImpl implements LeaseRecordService { public class LeaseRecordServiceImpl implements LeaseRecordService {
@Autowired @Resource
private LeaseRecordMapper leaseRecordMapper; private LeaseRecordMapper leaseRecordMapper;
@Resource
private BaseIotMachineMapper baseIotMachineMapper;
@Override @Override
public List<LeaseRecord> getLeaseRecordList(LeaseRecord bean) { public List<LeaseRecord> getLeaseRecordList(LeaseRecord bean) {
return leaseRecordMapper.getLeaseRecordList(bean); List<LeaseRecord> listMaMachine =leaseRecordMapper.getLeaseRecordList(bean);
if (listMaMachine.size() > 0){
for (LeaseRecord leaseRecord : listMaMachine) {
//根据机具编码查询iot设备
List<IotRecordVo> iotRecordVoList = baseIotMachineMapper.selectList(leaseRecord.getMaCode());
leaseRecord.setIotNum(iotRecordVoList.size());
//判断是否绑定了iot设备
if (iotRecordVoList.size()>0){
for (int i = 0; i < iotRecordVoList.size(); i++) {
//保存定位iot设备编码
if ("125".equals(iotRecordVoList.get(i).getIotType())){
leaseRecord.setIotCode(iotRecordVoList.get(i).getIotCode());
}
}
}
}
}
return listMaMachine;
} }
} }

View File

@ -1191,6 +1191,6 @@
left join ma_type mt1 on mt.parent_id = mt1.type_id left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_type mt3 on mt2.parent_id = mt3.type_id left join ma_type mt3 on mt2.parent_id = mt3.type_id
where lod.parent_id = #{id} where lod.id = #{id}
</select> </select>
</mapper> </mapper>

View File

@ -12,18 +12,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set num = #{num} set num = #{num}
where id = #{id} where id = #{id}
</update> </update>
<update id="updateLeaseRecord">
update lease_out_details
set push_notifications = 1
where id = #{id}
</update>
<select id="getLeaseRecordList" resultType="com.bonus.sgzb.material.domain.LeaseRecord"> <select id="getLeaseRecordList" resultType="com.bonus.sgzb.material.domain.LeaseRecord">
SELECT mt2.type_name as typeName, SELECT lod.id as id,
mt2.type_name as typeName,
mt.type_name as typeModelName, mt.type_name as typeModelName,
bai.agreement_code as agreementCode, bai.agreement_code as agreementCode,
mm.ma_code as maCode, mm.ma_code as maCode,
mt.unit_name as unit, mt.unit_name as unit,
mt.manage_type as manageType,
lod.out_num as preNum, lod.out_num as preNum,
lai.lease_person as leasePerson, lai.lease_person as leasePerson,
lod.create_time as createTime, lod.create_time as createTime,
bpl.lot_name as proName, bpl.lot_name as proName,
bui.unit_name as unitName bui.unit_name as unitName,
lod.push_notifications as pushNotifications
FROM lease_out_details lod FROM lease_out_details lod
LEFT JOIN lease_apply_info lai on lai.id = lod.parent_id LEFT JOIN lease_apply_info lai on lai.id = lod.parent_id
LEFT JOIN tm_task_agreement tta on tta.task_id = lai.task_id LEFT JOIN tm_task_agreement tta on tta.task_id = lai.task_id