diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java index 252163683..fa5db9905 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java @@ -132,13 +132,15 @@ public class TagCodeRecordController extends BaseController { * @param id 主键结合 * @return 删除结果 */ - /* @DeleteMapping("id") + @DeleteMapping("id") public ResponseObject delete(@PathVariable Long id) { TagCodeRecord tagCodeRecord = this.tagCodeRecordService.getById(id); - if () - //码牌id - Integer oilTagId = tagCodeRecord.getOilTagId(); - return getSuccessResult(this.tagCodeRecordService.removeById(id)); - }*/ + if (ObjectUtils.isNotEmpty(tagCodeRecord.getStaffId())){ + return getSuccessResult("该码牌已绑定员工,请先解绑员工!"); + }else { + this.tagCodeRecordService.removeById(id); + return getSuccessResult("解绑成功!"); + } + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/TagCode.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/TagCode.java index 46fa52fa9..ec86b9c22 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/TagCode.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/entity/TagCode.java @@ -22,6 +22,7 @@ public class TagCode extends Model { //主键id @TableId(type = IdType.AUTO) private Integer id; + private Integer deptId; //二维码SN号 private String tagCodeSn; //图片地址 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeServiceImpl.java index 1fcd2c43d..ba70195ce 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeServiceImpl.java @@ -7,7 +7,9 @@ import com.fuint.business.tag.dto.TagCodeDTO; import com.fuint.business.tag.mapper.TagCodeMapper; import com.fuint.business.tag.entity.TagCode; import com.fuint.business.tag.service.TagCodeService; +import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.DateUtil; +import com.fuint.common.util.TokenUtil; import com.fuint.module.backendApi.controller.BackendFileController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.InputStreamResource; @@ -60,6 +62,7 @@ public class TagCodeServiceImpl extends ServiceImpl impl @Transactional public ResponseEntity add(TagCodeDTO tagCodeDTO, HttpServletRequest request, HttpServletResponse response) throws Exception { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); boolean flag = false; if (ObjectUtils.isNotEmpty(tagCodeDTO) && ObjectUtils.isNotEmpty(tagCodeDTO.getTotal())){ int total = tagCodeDTO.getTotal(); @@ -79,6 +82,7 @@ public class TagCodeServiceImpl extends ServiceImpl impl tagCode.setCollection(url); tagCode.setTagCodeSn("byx"+i1); + tagCode.setDeptId(Integer.parseInt(nowAccountInfo.getDeptId().toString())); //在图片上生成二维码 String backgroundImage = "static/qrCodeImg/huanyingguanglin2.jpg";