rf设备绑定删除,推送优化

This commit is contained in:
15856 2024-11-29 17:06:02 +08:00
parent 7d05d66430
commit fca9f5a86d
8 changed files with 56 additions and 0 deletions

View File

@ -270,4 +270,7 @@ public class MaMachine extends BaseEntity {
@ApiModelProperty(value = "推送到租赁标识0未推送 1推送") @ApiModelProperty(value = "推送到租赁标识0未推送 1推送")
private Integer pushStatus; private Integer pushStatus;
@ApiModelProperty(value = "企业机构代码(统一社会信用代码)")
private String socialCreditCode;
} }

View File

@ -61,6 +61,22 @@ public class LeaseOutDetailsController extends BaseController {
} }
} }
/**
* 绑定设备
*/
@ApiOperation(value = "根据Rfid解绑-app")
@PostMapping("/delMachineByRfid")
public AjaxResult delMachineByRfid(@RequestBody MaMachine maMachine) {
int i = leaseOutDetailsService.delMachineByRfid(maMachine);
if (i == 0) {
return AjaxResult.success("解绑成功");
} else if (i == 1) {
return AjaxResult.error("未查询到该设备");
} else {
return AjaxResult.error("该设备未被绑定");
}
}
/** /**
* 根据二维码绑定设备 * 根据二维码绑定设备
*/ */

View File

@ -79,4 +79,6 @@ public interface LeaseOutDetailsService {
List<TmTask> getDetailsByApplyId(TmTask id); List<TmTask> getDetailsByApplyId(TmTask id);
TmTask getLeaseOutOrder(String parentId,String typeId); TmTask getLeaseOutOrder(String parentId,String typeId);
int delMachineByRfid(MaMachine maMachine);
} }

View File

@ -153,6 +153,23 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
return orderHead; return orderHead;
} }
@Override
public int delMachineByRfid(MaMachine maMachine) {
List<MaMachine> maMachineByMaIdAndMaCode = maMachineMapper.getMaMachineByMaIdAndMaCode(maMachine);
if (CollUtil.isNotEmpty(maMachineByMaIdAndMaCode)) {
for (MaMachine machine : maMachineByMaIdAndMaCode) {
if (StringUtils.isNotBlank(machine.getRfidCode())){
machine.setRfidCode(maMachine.getRfidCode());
maMachineMapper.delMachineByRfid(machine);
} else {
return 2;
}
}
return 0;
}
return 1;
}
/** /**
* 领料出库处理 * 领料出库处理
* *

View File

@ -53,4 +53,6 @@ public interface MaMachineMapper {
Long selectMaMachineByItemId(Long itemId); Long selectMaMachineByItemId(Long itemId);
Integer updateItemStatus(DataReceiveDetail dataReceiveDetail); Integer updateItemStatus(DataReceiveDetail dataReceiveDetail);
int delMachineByRfid(MaMachine machine);
} }

View File

@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
@ -194,6 +195,13 @@ public class MaMachineServiceImpl implements MaMachineService {
if (maMachineList.isEmpty()) { if (maMachineList.isEmpty()) {
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG, "maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR); throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG, "maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
} }
//获取当前登录用户的企业机构代码
if ( SecurityUtils.getLoginUser().getSysUser()==null && SecurityUtils.getLoginUser().getSysUser().getDept()==null){
throw new ServiceException(ExceptionDict.PERMISSION_ERROR_MSG, ExceptionDict.PERMISSION_ERROR);
}
String socialCreditCode = SecurityUtils.getLoginUser().getSysUser().getDept().getSocialCreditCode();
maMachineList.forEach(maMachine -> maMachine.setSocialCreditCode(socialCreditCode));
String content = JSONObject.toJSONString(maMachineList); String content = JSONObject.toJSONString(maMachineList);
String encrypt; String encrypt;
try { try {

View File

@ -35,6 +35,9 @@ public class ExceptionDict {
public static final Integer ERROR_OCCURRED_DURING_SCRAP_TASK_REVIEW = 50009; public static final Integer ERROR_OCCURRED_DURING_SCRAP_TASK_REVIEW = 50009;
public static final String ERROR_OCCURRED_DURING_SCRAP_TASK_REVIEW_MSG = "报废任务审核失败!"; public static final String ERROR_OCCURRED_DURING_SCRAP_TASK_REVIEW_MSG = "报废任务审核失败!";
public static final Integer PERMISSION_ERROR = 50010;
public static final String PERMISSION_ERROR_MSG = "用户企业信息有误!";
/* public static void main(String[] args) { /* public static void main(String[] args) {

View File

@ -286,6 +286,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{maId} #{maId}
</foreach> </foreach>
</delete> </delete>
<delete id="delMachineByRfid">
UPDATE ma_machine mm
SET mm.rfid_code = ''
where mm.ma_id = #{maId}
</delete>
<select id="selectMaMachineByMaId" parameterType="Long" resultType="com.bonus.sgzb.base.api.domain.MaMachine"> <select id="selectMaMachineByMaId" parameterType="Long" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
select m.ma_id, m.type_id, m.ma_code, m.pre_code, m.ma_status, m.qr_code, m.buy_price, m.ma_vender, m.out_fac_time, m.out_fac_code, select m.ma_id, m.type_id, m.ma_code, m.pre_code, m.ma_status, m.qr_code, m.buy_price, m.ma_vender, m.out_fac_time, m.out_fac_code,