Browse Source

门店提交轮胎保时查询门店最新信息

liyuan 5 days ago
parent
commit
5319ed1e2d

+ 1 - 0
blade-service/gubersail-dealer-app/src/main/java/com/gubersail/app/util/WechatQRCodeUtil.java

@@ -111,6 +111,7 @@ public class WechatQRCodeUtil {
 			paramJson.put("page", page);
 			//这是设置扫描二维码后跳转的页面
 			paramJson.put("width", 200);
+			// paramJson.put("env_version", "trial");
 			paramJson.put("is_hyaline", true);
 			paramJson.put("auto_color", true);
 			printWriter.write(paramJson.toString());

+ 8 - 0
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/corp/mapper/ShopAppCorpsDescMapper.java

@@ -87,4 +87,12 @@ public interface ShopAppCorpsDescMapper extends BaseMapper<ShopAppPjCorpsDesc> {
 	int insertCorps(ShopAppPjCorpsDesc corpsDesc);
 
 	List<ShopAppPjCorpsDesc> appCustomerAnalysis(IPage<ShopAppPjCorpsDesc> page, @Param("CorpsDesc") ShopAppPjCorpsDesc corpsDescDto);
+
+	/**
+	 * 根据用户id查询客户信息
+	 *
+	 * @param storeId 门店id
+	 * @return 结果
+	 */
+	ShopAppPjCorpsDesc selectCorpsByAttnUserId(@Param("storeId") Long storeId);
 }

+ 9 - 0
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/corp/mapper/ShopAppCorpsDescMapper.xml

@@ -426,4 +426,13 @@
             , allCunstomer.businesDate ASC
         </if>
     </select>
+    <select id="selectCorpsByAttnUserId" resultType="com.gubersail.shop.app.api.corps.entity.ShopAppPjCorpsDesc"
+            parameterType="java.lang.Long">
+        SELECT
+            pcd.*
+        FROM
+            pjpf_corps_desc pcd
+                INNER JOIN pjpf_corps_attn pca ON pcd.id = pca.pid
+        WHERE pca.user_id = #{storeId} and pca.is_deleted = 0
+    </select>
 </mapper>

+ 10 - 5
blade-service/gubersail-shop-app/src/main/java/com/gubersail/shop/app/insurance/service/impl/ShopAppTireInsuranceRegisterServiceImpl.java

@@ -22,12 +22,14 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gubersail.shop.app.api.claim.entity.ShopAppClaim;
 import com.gubersail.shop.app.api.claim.entity.ShopAppClaimAttachment;
+import com.gubersail.shop.app.api.corps.entity.ShopAppPjCorpsDesc;
 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.ShopAppTireInsuranceRegisterVO;
 import com.gubersail.shop.app.claim.service.IShopAppClaimAttachmentService;
 import com.gubersail.shop.app.claim.service.IShopAppClaimService;
+import com.gubersail.shop.app.corp.mapper.ShopAppCorpsDescMapper;
 import com.gubersail.shop.app.insurance.mapper.ShopAppTireInsuranceRegisterMapper;
 import com.gubersail.shop.app.insurance.service.IShopAppTireInsuranceFilesService;
 import com.gubersail.shop.app.insurance.service.IShopAppTireInsuranceRecordService;
@@ -74,8 +76,6 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
 
 	private final IUserClient userClient;
 
-	private final ISysClient sysClient;
-
 	private final IShopAppClaimService bladeClaimService;
 
 	private final IShopAppClaimAttachmentService bladeClaimAttachmentService;
@@ -84,6 +84,9 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
 
 	private final IOssClient ossClient;
 
+	private final ShopAppCorpsDescMapper corpDescMapper;
+
+
 	@Override
 	public IPage<ShopAppTireInsuranceRegisterVO> selectTireInsuranceRegisterPage(IPage<ShopAppTireInsuranceRegisterVO> page, ShopAppTireInsuranceRegisterVO tireInsuranceRegister) {
 		return page.setRecords(baseMapper.selectTireInsuranceRegisterPage(page, tireInsuranceRegister));
@@ -156,7 +159,7 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
 		if (carOwner == null) {
 			throw new RuntimeException("未查手机号:" + tireInsuranceRegister.getConsumerPhone() + "对应车主用户信息");
 		}
-		tireInsuranceRegister.setVersion(tireInsuranceRegister.getVersion() + 1);
+		tireInsuranceRegister.setVersion(Objects.isNull(tireInsuranceRegister.getVersion()) ? 1:  tireInsuranceRegister.getVersion() + 1);
 		//判断是否是第一次保存
 		if (tireInsuranceRegister.getId() == null) {
 			// 获取 流水号
@@ -164,6 +167,8 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
 			if (!StringUtils.hasText(billNo) || billNo.length() < NumberEnum.FIFTEEN.number) {
 				return R.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), "生成系统编号失败");
 			}
+			// carOwner.getStoreId() 这是个用户id
+			ShopAppPjCorpsDesc appPjCorpsDesc = corpDescMapper.selectCorpsByAttnUserId(carOwner.getStoreId());
 			tireInsuranceRegister.setInsuranceTime(Date.from(currentDate.plusYears(1).atZone(ZoneId.systemDefault()).toInstant()));
 			tireInsuranceRegister.setInsuranceNo(billNo);
 			tireInsuranceRegister.setCreateTime(new Date());
@@ -171,8 +176,8 @@ public class ShopAppTireInsuranceRegisterServiceImpl extends ServiceImpl<ShopApp
 			tireInsuranceRegister.setCreateDept(Long.parseLong(AuthUtil.getDeptId()));
 			tireInsuranceRegister.setCreateUser(carOwner.getUserId());
 			tireInsuranceRegister.setStoreId(carOwner.getStoreId());
-			tireInsuranceRegister.setStoreName(carOwner.getStoreName());
-			tireInsuranceRegister.setStorePhone(carOwner.getStorePhone());
+			tireInsuranceRegister.setStoreName(Objects.isNull(appPjCorpsDesc) ? carOwner.getStoreName() : appPjCorpsDesc.getCname());
+			tireInsuranceRegister.setStorePhone(Objects.isNull(appPjCorpsDesc) ? carOwner.getStorePhone() : appPjCorpsDesc.getTel());
 			tireInsuranceRegister.setStoreAddress(carOwner.getStoreAddress());
 			tireInsuranceRegister.setStoreContact(carOwner.getStoreContact());
 			tireInsuranceRegister.setDealerId(carOwner.getDealerId());