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 fa5db9905..fefaa2967 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 @@ -12,9 +12,11 @@ import com.fuint.business.member.entity.LJStaff; import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.tag.dto.TagCodeRecordDTO; import com.fuint.business.tag.entity.OilTag; +import com.fuint.business.tag.entity.TagCode; import com.fuint.business.tag.entity.TagCodeRecord; import com.fuint.business.tag.service.OilTagService; import com.fuint.business.tag.service.TagCodeRecordService; +import com.fuint.business.tag.service.TagCodeService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import com.fuint.framework.exception.BusinessCheckException; @@ -126,15 +128,34 @@ public class TagCodeRecordController extends BaseController { return getSuccessResult("该员工暂未绑定码牌!"); } + @Resource + private TagCodeService tagCodeService; /** * 码牌与油站解绑 * * @param id 主键结合 * @return 删除结果 */ - @DeleteMapping("id") + @DeleteMapping("{id}") public ResponseObject delete(@PathVariable Long id) { + TagCodeRecord tagCodeRecord = this.tagCodeRecordService.getById(id); + + OilTag oilTag = oilTagService.getById(tagCodeRecord.getOilTagId()); + + TagCode tagCode = tagCodeService.getById(oilTag.getTagCodeId()); + + String collection = ""; + if (tagCode.getCollection().contains("storeId")){ + String[] storeIds = tagCode.getCollection().split("storeId"); + String storeId = storeIds[0]; + String[] sns = storeIds[1].split("sn"); + String sn = sns[1]; + collection = storeId + "sn" + sn; + tagCode.setCollection(collection); + tagCodeService.updateById(tagCode); + } + if (ObjectUtils.isNotEmpty(tagCodeRecord.getStaffId())){ return getSuccessResult("该码牌已绑定员工,请先解绑员工!"); }else {