|
@@ -49,9 +49,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 轮胎保险注册表 服务实现类
|
|
@@ -124,11 +122,12 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 提交轮胎保险申请
|
|
|
- * @param appTireInsuranceRegister 轮胎保险申请表单数据
|
|
|
- * @return 操作结果响应对象
|
|
|
- * @throws RuntimeException 当查询门店信息失败时抛出异常
|
|
|
- */
|
|
|
+ * 提交轮胎保险申请
|
|
|
+ *
|
|
|
+ * @param appTireInsuranceRegister 轮胎保险申请表单数据
|
|
|
+ * @return 操作结果响应对象
|
|
|
+ * @throws RuntimeException 当查询门店信息失败时抛出异常
|
|
|
+ */
|
|
|
@Override
|
|
|
public R submitTireInsurance(ShopAppTireInsuranceRegisterVO appTireInsuranceRegister) {
|
|
|
// 1. 创建轮胎保险注册实体并复制属性
|
|
@@ -154,17 +153,23 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
|
|
|
claim.setClaimNo(billNo); // 设置理赔单号
|
|
|
|
|
|
// 6. 设置理赔基本信息
|
|
|
- claim.setCreateTime(new Date()); // 创建时间
|
|
|
- claim.setCreateUser(AuthUtil.getUserId()); // 创建人ID
|
|
|
- claim.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); // 创建部门ID
|
|
|
- claim.setClaimSourceType(2); // 理赔来源类型
|
|
|
-
|
|
|
+ claim.setCreateTime(new Date()); // 创建时间
|
|
|
+ claim.setCreateUser(AuthUtil.getUserId()); // 创建人ID
|
|
|
+ claim.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); // 创建部门ID
|
|
|
+ claim.setClaimSourceType(2); // 理赔来源类型
|
|
|
+ claim.setVehicleNumber(tireInsuranceRegister.getVehicleNumber()); // 车牌号
|
|
|
+ claim.setTireQuantity(tireInsuranceRegister.getTireQuantity()); // 轮胎数量
|
|
|
+ claim.setTyreNo(tireInsuranceRegister.getInsuranceNo()); // 胎号/轮胎宝编号
|
|
|
+ claim.setTyreSpecs(tireInsuranceRegister.getTyreSpecs()); // 规格型号
|
|
|
+ claim.setAuditStatus(0); // 审核状态
|
|
|
+ claim.setSubmitTime(new Date()); // 提交时间
|
|
|
// 7. 设置理赔来源信息(区分管理员和普通用户)
|
|
|
if (AuthUtil.getUserRole().contains("admin")) {
|
|
|
// 管理员直接使用用户信息
|
|
|
claim.setSourceId(AuthUtil.getUserId());
|
|
|
claim.setSourceCode("");
|
|
|
claim.setSourceName(AuthUtil.getUserName());
|
|
|
+ claim.setConsumerName(AuthUtil.getUserName());
|
|
|
} else {
|
|
|
// 普通用户需要查询关联的门店信息
|
|
|
// 7.1 查询门店联系人信息
|
|
@@ -187,6 +192,8 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
|
|
|
// 7.3 设置门店信息作为来源
|
|
|
claim.setSourceId(corpsDesc.getId());
|
|
|
claim.setSourceName(corpsDesc.getCname());
|
|
|
+ claim.setConsumerName(attn.getCname());
|
|
|
+ claim.setConsumerPhone(attn.getTel());
|
|
|
}
|
|
|
|
|
|
// 8. 保存理赔申请信息
|
|
@@ -230,6 +237,34 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
|
|
|
return R.data(appTireInsuranceRegister);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R revokeTireInsurance(Long id) {
|
|
|
+ ShopAppTireInsuranceRegister tireInsuranceRegister = baseMapper.selectById(id);
|
|
|
+
|
|
|
+ // 2. 设置更新信息
|
|
|
+ tireInsuranceRegister.setUpdateUser(AuthUtil.getUserId()); // 设置更新人ID
|
|
|
+ tireInsuranceRegister.setUpdateTime(new Date()); // 设置更新时间
|
|
|
+ if (1 != tireInsuranceRegister.getStatus()) {
|
|
|
+ throw new RuntimeException("工厂已受理/审核通过,撤销失败!");
|
|
|
+ }
|
|
|
+ tireInsuranceRegister.setStatus(0); // 设置状态为1(已提交)
|
|
|
+
|
|
|
+ // 3. 更新轮胎保险注册信息
|
|
|
+ this.updateById(tireInsuranceRegister);
|
|
|
+
|
|
|
+ ShopAppClaim claim = bladeClaimService.getOne(new LambdaQueryWrapper<ShopAppClaim>()
|
|
|
+ .eq(ShopAppClaim::getTyreNo, tireInsuranceRegister.getInsuranceNo())
|
|
|
+ .eq(ShopAppClaim::getIsDeleted, 0)
|
|
|
+ .eq(ShopAppClaim::getAuditStatus, 0)
|
|
|
+ .last("LIMIT 1"));
|
|
|
+ bladeClaimService.removeById(claim.getId());
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("claim_id",claim.getId());
|
|
|
+ bladeClaimAttachmentService.removeByMap(map);
|
|
|
+
|
|
|
+ return R.data(tireInsuranceRegister);
|
|
|
+ }
|
|
|
+
|
|
|
private ShopAppClaimAttachment saveClaimAttachment(String url, Long claimId, int type) {
|
|
|
ShopAppClaimAttachment shopAppClaimAttachment = new ShopAppClaimAttachment();
|
|
|
shopAppClaimAttachment.setClaimId(claimId);
|