Browse Source

胎号不允许重复注册

liyuan 1 month ago
parent
commit
2363a3bedf

+ 1 - 1
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/corp/service/impl/ShopAppCorpsDescServiceImpl.java

@@ -268,7 +268,7 @@ public class ShopAppCorpsDescServiceImpl extends ServiceImpl<ShopAppCorpsDescMap
 		BladeUser bladeUser = AuthUtil.getUser();
 		ShopAppPjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<ShopAppPjCorpsAttn>().eq(ShopAppPjCorpsAttn::getIsDeleted, 0)
 			.eq(ShopAppPjCorpsAttn::getTenantId, bladeUser.getTenantId())
-			.eq(ShopAppPjCorpsAttn::getUserId, bladeUser.getUserId()));
+			.eq(ShopAppPjCorpsAttn::getUserId, bladeUser.getUserId()).last("LIMIT 1"));
 
 		if (ObjectUtils.isNull(corpsAttn)) {
 			throw new RuntimeException("未查到对应门店信息");

+ 6 - 0
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/insurance/controller/ShopAppTireInsuranceRegisterController.java

@@ -24,6 +24,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.gubersail.shop.app.annotation.VersionControl;
 import com.gubersail.shop.app.api.claim.entity.ShopAppClaim;
 import com.gubersail.shop.app.api.corps.entity.ShopAppPjCorpsAttn;
+import com.gubersail.shop.app.api.insurance.entity.ShopAppTireInsuranceFiles;
 import com.gubersail.shop.app.api.insurance.entity.ShopAppTireInsuranceRecord;
 import com.gubersail.shop.app.api.insurance.entity.ShopAppTireInsuranceRegister;
 import com.gubersail.shop.app.api.insurance.vo.ShopAppTireInsuranceRecordVO;
@@ -315,6 +316,11 @@ public class ShopAppTireInsuranceRegisterController extends BladeController {
 	 */
 	@GetMapping("/getMaterialDetail")
 	public R getMaterialDetail(@RequestParam("tireNumber") String tireNumber) {
+		long count = tireInsuranceFilesService.count(new LambdaQueryWrapper<ShopAppTireInsuranceFiles>()
+			.eq(ShopAppTireInsuranceFiles::getTyreNo, tireNumber).eq(ShopAppTireInsuranceFiles::getIsDeleted, 0));
+		if (count > 0) {
+			return R.fail("该胎号:" + tireNumber + "已被注册,请勿重复注册");
+		}
 		TeHbbTob teHbbTob = U9DateUtils.getMaterialDetail(tireNumber);
 		return R.data(teHbbTob);
 	}