Commit 0913f2f7 authored by tangwei's avatar tangwei

修改抛出异常

parent ac51888c
...@@ -36,6 +36,7 @@ import java.util.stream.Collectors; ...@@ -36,6 +36,7 @@ import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -241,7 +242,7 @@ public class HouseholdContractController extends BaseController { ...@@ -241,7 +242,7 @@ public class HouseholdContractController extends BaseController {
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常"); throw new BadRequest("系统异常");
} }
return householdContractServiceImpl.updateById(householdContrac); return householdContractServiceImpl.updateById(householdContrac);
...@@ -279,7 +280,7 @@ public class HouseholdContractController extends BaseController { ...@@ -279,7 +280,7 @@ public class HouseholdContractController extends BaseController {
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常"); throw new BadRequest("系统异常");
} }
return householdContractServiceImpl.updateById(householdContrac); return householdContractServiceImpl.updateById(householdContrac);
......
...@@ -43,6 +43,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -43,6 +43,7 @@ import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -192,7 +193,7 @@ public class QiyuesuoController extends BaseController { ...@@ -192,7 +193,7 @@ public class QiyuesuoController extends BaseController {
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("契约锁回调失败"); throw new BadRequest("契约锁回调失败");
} }
return "success"; return "success";
} }
...@@ -213,7 +214,7 @@ public class QiyuesuoController extends BaseController { ...@@ -213,7 +214,7 @@ public class QiyuesuoController extends BaseController {
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("解密失败"); throw new BadRequest("解密失败");
} }
return decryptStr; return decryptStr;
} }
......
...@@ -390,6 +390,7 @@ public class UnitInfoController extends BaseController { ...@@ -390,6 +390,7 @@ public class UnitInfoController extends BaseController {
// code 保存到缓存中 // code 保存到缓存中
redisUtil.set(HYGF_USER_TEL + tel, code, time); redisUtil.set(HYGF_USER_TEL + tel, code, time);
} catch (Exception e) { } catch (Exception e) {
throw new BadRequest("发送短信失败:" + e.getMessage()); throw new BadRequest("发送短信失败:" + e.getMessage());
} }
return ResponseHelper.buildResponse(flag); return ResponseHelper.buildResponse(flag);
......
...@@ -13,6 +13,7 @@ import org.springframework.util.CollectionUtils; ...@@ -13,6 +13,7 @@ import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -142,10 +143,10 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB ...@@ -142,10 +143,10 @@ public class DocumentBomServiceImpl extends BaseService<DocumentBomDto,DocumentB
Integer demandNumber = json.getInteger("pzsl");//配置数量 Integer demandNumber = json.getInteger("pzsl");//配置数量
Double price = json.getDouble("price");//价格 Double price = json.getDouble("price");//价格
if (StringUtils.isAnyBlank(materialNum, materialName)) { if (StringUtils.isAnyBlank(materialNum, materialName)) {
throw new RuntimeException("物料编码和物料名称不能为空"); throw new BadRequest("物料编码和物料名称不能为空");
} }
if (null == demandNumber || null == price) { if (null == demandNumber || null == price) {
throw new RuntimeException("价格和配置数量不能为空"); throw new BadRequest("价格和配置数量不能为空");
} }
Double power = Double.valueOf(Optional.ofNullable(json.getString("gl")).orElse("0").replace("W", ""));// 去掉功率的单位 Double power = Double.valueOf(Optional.ofNullable(json.getString("gl")).orElse("0").replace("W", ""));// 去掉功率的单位
documentBom.setMaterialNum(materialNum);//物料编码 documentBom.setMaterialNum(materialNum);//物料编码
......
...@@ -16,6 +16,7 @@ import org.springframework.scheduling.annotation.Async; ...@@ -16,6 +16,7 @@ import org.springframework.scheduling.annotation.Async;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -100,7 +101,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -100,7 +101,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常!"); throw new BadRequest("系统异常!");
} }
return map; return map;
...@@ -142,7 +143,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -142,7 +143,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
map.put("y",listy); map.put("y",listy);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常!"); throw new BadRequest("系统异常!");
} }
return map; return map;
} }
...@@ -196,7 +197,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -196,7 +197,7 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常!"); throw new BadRequest("系统异常!");
} }
map.put("x",listx); map.put("x",listx);
map.put("y",listy); map.put("y",listy);
......
...@@ -350,7 +350,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -350,7 +350,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
if (e instanceof BadRequest || e.getCause() instanceof BadRequest) { if (e instanceof BadRequest || e.getCause() instanceof BadRequest) {
throw new BadRequest(e.getMessage()); throw new BadRequest(e.getMessage());
} }
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
} }
...@@ -442,7 +442,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -442,7 +442,7 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
if (loginResult == null || loginResult.getStatus() != 200) { if (loginResult == null || loginResult.getStatus() != 200) {
log.error("手机号码 => " + phoneNo + " 登录失败: " + loginResult.getDevMessage()); log.error("手机号码 => " + phoneNo + " 登录失败: " + loginResult.getDevMessage());
String message = StringUtils.isEmpty(loginResult.getMessage()) ? "账号或密码错误" : loginResult.getMessage(); String message = StringUtils.isEmpty(loginResult.getMessage()) ? "账号或密码错误" : loginResult.getMessage();
throw new RuntimeException(message); throw new BadRequest(message);
} }
HashMap resultMap = (HashMap) loginResult.getResult(); HashMap resultMap = (HashMap) loginResult.getResult();
String token = resultMap.get("token").toString(); String token = resultMap.get("token").toString();
......
...@@ -174,7 +174,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD ...@@ -174,7 +174,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId()); Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
} }
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
} }
...@@ -270,7 +270,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD ...@@ -270,7 +270,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
}catch (Exception e){ }catch (Exception e){
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
} }
......
...@@ -27,6 +27,7 @@ import org.springframework.util.CollectionUtils; ...@@ -27,6 +27,7 @@ import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -154,7 +155,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -154,7 +155,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
// update // update
PreparationMoney entity = this.getById(model); PreparationMoney entity = this.getById(model);
if (entity == null) { if (entity == null) {
throw new RuntimeException("发货单不存在"); throw new BadRequest("发货单不存在");
} }
isUpdate = true; isUpdate = true;
} }
...@@ -166,7 +167,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -166,7 +167,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
if (CollectionUtils.isEmpty(documentBoms)) { if (CollectionUtils.isEmpty(documentBoms)) {
// throw new BaseException("BOM清单为空", "400", "BOM清单为空");// 这里阻塞前端接口 // throw new BaseException("BOM清单为空", "400", "BOM清单为空");// 这里阻塞前端接口
// 根据发货电站信息无法组装成BOM清单 // 根据发货电站信息无法组装成BOM清单
throw new RuntimeException("BOM清单为空"); throw new BadRequest("BOM清单为空");
} }
// 根据BOM清单计算当前发货单的价格 // 根据BOM清单计算当前发货单的价格
PreparationMoneyDto pmd = caculateShippingPrice(documentBoms); PreparationMoneyDto pmd = caculateShippingPrice(documentBoms);
...@@ -228,7 +229,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -228,7 +229,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
public Boolean updatePreparationMoneyStatus(Long sequenceNbr, String operationType) { public Boolean updatePreparationMoneyStatus(Long sequenceNbr, String operationType) {
PreparationMoney preparationMoney = preparationMoneyMapper.selectById(sequenceNbr); PreparationMoney preparationMoney = preparationMoneyMapper.selectById(sequenceNbr);
if (preparationMoney == null) { if (preparationMoney == null) {
throw new RuntimeException("订单不存在"); throw new BadRequest("订单不存在");
} }
PreparationMoneyLog preparationMoneyLog = new PreparationMoneyLog(); PreparationMoneyLog preparationMoneyLog = new PreparationMoneyLog();
preparationMoneyLog.setPreparationMoneyId(preparationMoney.getSequenceNbr()); preparationMoneyLog.setPreparationMoneyId(preparationMoney.getSequenceNbr());
...@@ -236,7 +237,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -236,7 +237,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
case "RECEIPT": case "RECEIPT":
// 确认收货 -> 到货状态 -> 已到货 -> 订单状态改为 已完成 // 确认收货 -> 到货状态 -> 已到货 -> 订单状态改为 已完成
if (!PreparationMoneyEnum.SHIPMENT_STATUS.已发货.getName().equals(preparationMoney.getShipmentStatus())) { if (!PreparationMoneyEnum.SHIPMENT_STATUS.已发货.getName().equals(preparationMoney.getShipmentStatus())) {
throw new RuntimeException("订单未发货, 无法确认收货"); throw new BadRequest("订单未发货, 无法确认收货");
} }
preparationMoney.setReceivingStatus(PreparationMoneyEnum.RECEIVING_STATUS.已到货.getName()); preparationMoney.setReceivingStatus(PreparationMoneyEnum.RECEIVING_STATUS.已到货.getName());
preparationMoney.setDocumentState(PreparationMoneyEnum.DOCUMENT_STATE.已完成.getName()); preparationMoney.setDocumentState(PreparationMoneyEnum.DOCUMENT_STATE.已完成.getName());
...@@ -252,7 +253,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto ...@@ -252,7 +253,7 @@ public class PreparationMoneyServiceImpl extends BaseService<PreparationMoneyDto
// 作废 // 作废
// 订单状态 -> 已废弃 // 订单状态 -> 已废弃
if (PreparationMoneyEnum.RECEIVING_STATUS.已到货.getName().equals(preparationMoney.getReceivingStatus())) { if (PreparationMoneyEnum.RECEIVING_STATUS.已到货.getName().equals(preparationMoney.getReceivingStatus())) {
throw new RuntimeException("订单已到货, 无法作废"); throw new BadRequest("订单已到货, 无法作废");
} }
preparationMoney.setDocumentState(PreparationMoneyEnum.DOCUMENT_STATE.作废.getName()); preparationMoney.setDocumentState(PreparationMoneyEnum.DOCUMENT_STATE.作废.getName());
preparationMoneyLog.setOperationContent(String.format("备货单作废【备货单号:%s】", preparationMoney.getOddNumbers())); preparationMoneyLog.setOperationContent(String.format("备货单作废【备货单号:%s】", preparationMoney.getOddNumbers()));
......
...@@ -14,6 +14,7 @@ import org.slf4j.Logger; ...@@ -14,6 +14,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -148,7 +149,7 @@ public class QiyuesuoServiceImpl { ...@@ -148,7 +149,7 @@ public class QiyuesuoServiceImpl {
logger.info("创建草稿合同调用后"+JSON.toJSONString(responseObj)); logger.info("创建草稿合同调用后"+JSON.toJSONString(responseObj));
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("创建草稿合同失败"); throw new BadRequest("创建草稿合同失败");
} }
if(responseObj.getCode() == 0) { if(responseObj.getCode() == 0) {
result = responseObj.getResult(); result = responseObj.getResult();
...@@ -214,13 +215,13 @@ public class QiyuesuoServiceImpl { ...@@ -214,13 +215,13 @@ public class QiyuesuoServiceImpl {
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("添加合同文档失败"); throw new BadRequest("添加合同文档失败");
} }
if (responseObj!=null&&responseObj.getCode() == 0) { if (responseObj!=null&&responseObj.getCode() == 0) {
result = responseObj.getResult(); result = responseObj.getResult();
logger.info("添加合同文档成功,文档ID:{}", JSON.toJSONString(result)); logger.info("添加合同文档成功,文档ID:{}", JSON.toJSONString(result));
} else { } else {
throw new RuntimeException("添加合同文档"+responseObj.getMessage()); throw new BadRequest("添加合同文档"+responseObj.getMessage());
} }
return result; return result;
} }
...@@ -238,13 +239,13 @@ public class QiyuesuoServiceImpl { ...@@ -238,13 +239,13 @@ public class QiyuesuoServiceImpl {
responseObj = JSONUtils.toQysResponse(response); responseObj = JSONUtils.toQysResponse(response);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("请求契约锁发起合同接口失败"); throw new BadRequest("请求契约锁发起合同接口失败");
} }
logger.info("请求契约锁发起合同后", JSON.toJSONString(responseObj)); logger.info("请求契约锁发起合同后", JSON.toJSONString(responseObj));
if(responseObj!=null&&responseObj.getCode() == 0) { if(responseObj!=null&&responseObj.getCode() == 0) {
logger.info("请求契约锁发起合同成功"); logger.info("请求契约锁发起合同成功");
} else { } else {
throw new RuntimeException("请求契约锁发起合同失败"+responseObj.getMessage()); throw new BadRequest("请求契约锁发起合同失败"+responseObj.getMessage());
} }
return responseObj; return responseObj;
...@@ -267,7 +268,7 @@ public class QiyuesuoServiceImpl { ...@@ -267,7 +268,7 @@ public class QiyuesuoServiceImpl {
} }
} }
} else { } else {
throw new RuntimeException("请求失败"); throw new BadRequest("请求失败");
} }
return url; return url;
} }
......
...@@ -39,6 +39,7 @@ import org.typroject.tyboot.core.foundation.exception.BaseException; ...@@ -39,6 +39,7 @@ import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -223,7 +224,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD ...@@ -223,7 +224,7 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("系统异常"); throw new BadRequest("系统异常");
} }
return surveyInfoAllDto; return surveyInfoAllDto;
......
...@@ -26,6 +26,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper; ...@@ -26,6 +26,7 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -110,7 +111,7 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD ...@@ -110,7 +111,7 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
userMessageMapper.insert(userMessage); userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false); emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}catch (Exception e){ }catch (Exception e){
throw new RuntimeException("任务添加失败!"); throw new BadRequest("任务添加失败!");
} }
} }
......
...@@ -216,7 +216,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -216,7 +216,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
// Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId()); // Privilege.agencyUserClient.multDeleteUser(regUnitInfo.getAdminUserId());
// } // }
// } // }
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
return model; return model;
} }
...@@ -367,7 +367,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -367,7 +367,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId()); Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
} }
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
} }
...@@ -449,7 +449,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -449,7 +449,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId()); Privilege.agencyUserClient.multDeleteUser(userResult.getResult().getUserId());
} }
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
} }
......
...@@ -111,12 +111,12 @@ public class WxServiceImpl implements IWxService { ...@@ -111,12 +111,12 @@ public class WxServiceImpl implements IWxService {
log.info("获取access_token返回值 => {}", resultStr); log.info("获取access_token返回值 => {}", resultStr);
AccessTokenDto accessToken = JSON.parseObject(resultStr, AccessTokenDto.class); AccessTokenDto accessToken = JSON.parseObject(resultStr, AccessTokenDto.class);
if (accessToken.getErrcode() != null && 0 != accessToken.getErrcode()) { if (accessToken.getErrcode() != null && 0 != accessToken.getErrcode()) {
throw new RuntimeException(accessToken.getErrmsg()); throw new BadRequest(accessToken.getErrmsg());
} }
return accessToken; return accessToken;
} catch (Exception e) { } catch (Exception e) {
log.error("获取access_token is error url:{}", buildUrl.toString()); log.error("获取access_token is error url:{}", buildUrl.toString());
throw new RuntimeException(e.getMessage()); throw new BadRequest(e.getMessage());
} }
} }
...@@ -255,7 +255,7 @@ public class WxServiceImpl implements IWxService { ...@@ -255,7 +255,7 @@ public class WxServiceImpl implements IWxService {
log.info("微信 code2Session, code =>{}, 结果 => {}", code, resultStr); log.info("微信 code2Session, code =>{}, 结果 => {}", code, resultStr);
JSONObject jsonObject = JSONObject.parseObject(resultStr); JSONObject jsonObject = JSONObject.parseObject(resultStr);
if (jsonObject == null || jsonObject.getIntValue("errcode") != 0) { if (jsonObject == null || jsonObject.getIntValue("errcode") != 0) {
throw new RuntimeException("微信授权失败, 请重新授权"); throw new BadRequest("微信授权失败, 请重新授权");
} }
return jsonObject; return jsonObject;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment