!21 🐛 Object的equals方法容易抛空指针异常,应使用常量或确定有值的对象来调用equals。
Merge pull request !21 from 徐晓伟/master-equals
This commit is contained in:
@@ -90,7 +90,7 @@ public class StoreProductController {
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestBody @PathVariable Integer id, @RequestParam(value = "type", required = false, defaultValue = "recycle")String type) {
|
||||
if (storeProductService.deleteProduct(id, type)) {
|
||||
if (type.equals("recycle")) {
|
||||
if ("recycle".equals(type)) {
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
} else {
|
||||
storeCartService.productDelete(id);
|
||||
|
||||
@@ -396,7 +396,7 @@ public class CrmebUtil {
|
||||
}
|
||||
|
||||
ip = request.getRemoteAddr();
|
||||
if(ip.equals("0:0:0:0:0:0:0:1")){
|
||||
if("0:0:0:0:0:0:0:1".equals(ip)){
|
||||
//本地 localhost访问 ipv6
|
||||
ip = "127.0.0.1";
|
||||
}
|
||||
@@ -419,11 +419,11 @@ public class CrmebUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ip.equals("unKnown")){
|
||||
if("unKnown".equals(ip)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ip.equals("unknown")){
|
||||
if("unknown".equals(ip)){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ImageMergeUtil {
|
||||
File file = new File(fileName);
|
||||
BufferedImage read = ImageIO.read(file);
|
||||
|
||||
if(bufferedImage == null || bufferedImage.equals("")){
|
||||
if(bufferedImage == null || "".equals(bufferedImage)){
|
||||
imageMergeUtilVo.setX(0);
|
||||
imageMergeUtilVo.setY(0);
|
||||
//创建新的画布,宽高以第一个图为准
|
||||
|
||||
@@ -41,7 +41,7 @@ public class UrlUtil {
|
||||
return entity;
|
||||
}
|
||||
url = url.trim();
|
||||
if (url.equals("")) {
|
||||
if ("".equals(url)) {
|
||||
return entity;
|
||||
}
|
||||
String[] urlParts = url.split("\\?");
|
||||
|
||||
@@ -40,37 +40,37 @@ public class ValidateFormUtil {
|
||||
List<String> val = CrmebUtil.stringToArrayStrRegex(value, ":");
|
||||
|
||||
////必填
|
||||
if(val.get(0).equals("required") && val.get(1).equals("true")){
|
||||
if("required".equals(val.get(0)) && "true".equals(val.get(1))){
|
||||
isRequire(systemConfig.getValue(), systemConfig.getTitle());
|
||||
continue;
|
||||
}
|
||||
|
||||
//数字
|
||||
if(val.get(0).equals("number") && val.get(1).equals("true")){
|
||||
if("number".equals(val.get(0)) && "true".equals(val.get(1))){
|
||||
isNumber(systemConfig.getValue(), systemConfig.getTitle());
|
||||
continue;
|
||||
}
|
||||
|
||||
//最大值
|
||||
if(val.get(0).equals("max")){
|
||||
if("max".equals(val.get(0))){
|
||||
isNumber(systemConfig.getValue(), systemConfig.getTitle());
|
||||
continue;
|
||||
}
|
||||
|
||||
//最小值
|
||||
if(val.get(0).equals("min")){
|
||||
if("min".equals(val.get(0))){
|
||||
isNumber(systemConfig.getValue(), systemConfig.getTitle());
|
||||
continue;
|
||||
}
|
||||
|
||||
//邮箱
|
||||
if(val.get(0).equals("email") && val.get(1).equals("true")){
|
||||
if("email".equals(val.get(0)) && "true".equals(val.get(1))){
|
||||
isEmail(systemConfig.getValue(), systemConfig.getTitle());
|
||||
continue;
|
||||
}
|
||||
|
||||
//手机
|
||||
if(val.get(0).equals("phone") && val.get(1).equals("true")){
|
||||
if("phone".equals(val.get(0)) && "true".equals(val.get(1))){
|
||||
isPhone(systemConfig.getValue(), systemConfig.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class WxUtil {
|
||||
if(ObjectUtil.isNull(result)){
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if(result.containsKey("errcode") && result.getString("errcode").equals("0")){
|
||||
if(result.containsKey("errcode") && "0".equals(result.getString("errcode"))){
|
||||
return result;
|
||||
}
|
||||
if(result.containsKey("errmsg")){
|
||||
|
||||
@@ -91,7 +91,7 @@ public class GenCodeUtils {
|
||||
columnEntity.setAttrType(attrType);
|
||||
|
||||
|
||||
if (!hasBigDecimal && attrType.equals("BigDecimal")) {
|
||||
if (!hasBigDecimal && "BigDecimal".equals(attrType)) {
|
||||
hasBigDecimal = true;
|
||||
}
|
||||
if (!hasList && "array".equals(columnEntity.getExtra())) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class QrCodeServiceImpl implements QrCodeService {
|
||||
Map<Object, Object> dataMap = JSONObject.toJavaObject(data, Map.class);
|
||||
|
||||
for (Map.Entry<Object, Object> m : dataMap.entrySet()) {
|
||||
if(m.getKey().equals("path")){
|
||||
if("path".equals(m.getKey())){
|
||||
//前端路由, 不需要拼参数
|
||||
page = m.getValue().toString();
|
||||
continue;
|
||||
|
||||
@@ -951,10 +951,10 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
* 绑定手机号数据校验
|
||||
*/
|
||||
private void checkBindingPhone(WxBindingPhoneRequest request) {
|
||||
if (!request.getType().equals("public") && !request.getType().equals("routine") && !request.getType().equals("iosWx") && !request.getType().equals("androidWx")) {
|
||||
if (!"public".equals(request.getType()) && !"routine".equals(request.getType()) && !"iosWx".equals(request.getType()) && !"androidWx".equals(request.getType())) {
|
||||
throw new CrmebException("未知的用户类型");
|
||||
}
|
||||
if (request.getType().equals("public")) {
|
||||
if ("public".equals(request.getType())) {
|
||||
if (StrUtil.isBlank(request.getCaptcha())) {
|
||||
throw new CrmebException("验证码不能为空");
|
||||
}
|
||||
|
||||
@@ -68,13 +68,13 @@ public class OrderUtils {
|
||||
payType = payType.toLowerCase();
|
||||
switch (payType){
|
||||
case PayConstants.PAY_TYPE_WE_CHAT:
|
||||
result = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_PAY_WEIXIN_OPEN).equals("1");
|
||||
result = "1".equals(systemConfigService.getValueByKey(SysConfigConstants.CONFIG_PAY_WEIXIN_OPEN));
|
||||
break;
|
||||
case PayConstants.PAY_TYPE_YUE:
|
||||
result = (systemConfigService.getValueByKey(SysConfigConstants.CONFIG_YUE_PAY_STATUS).equals("1"));
|
||||
result = ("1".equals(systemConfigService.getValueByKey(SysConfigConstants.CONFIG_YUE_PAY_STATUS)));
|
||||
break;
|
||||
case PayConstants.PAY_TYPE_ALI_PAY:
|
||||
result = (systemConfigService.getValueByKey(SysConfigConstants.CONFIG_ALI_PAY_STATUS).equals("1"));
|
||||
result = ("1".equals(systemConfigService.getValueByKey(SysConfigConstants.CONFIG_ALI_PAY_STATUS)));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -285,7 +285,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||
public String weChatRefund(String xmlInfo) {
|
||||
MyRecord notifyRecord = new MyRecord();
|
||||
MyRecord refundRecord = refundNotify(xmlInfo, notifyRecord);
|
||||
if (refundRecord.getStr("status").equals("fail")) {
|
||||
if ("fail".equals(refundRecord.getStr("status"))) {
|
||||
logger.error("微信退款回调失败==>" + refundRecord.getColumns() + ", rawData==>" + xmlInfo + ", data==>" + notifyRecord);
|
||||
return refundRecord.getStr("returnXml");
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
|
||||
public List<Express> findAll(String type) {
|
||||
LambdaQueryWrapper<Express> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(Express::getIsShow, true);
|
||||
if (type.equals("elec")) {
|
||||
if ("elec".equals(type)) {
|
||||
lqw.eq(Express::getStatus, true);
|
||||
}
|
||||
lqw.orderByDesc(Express::getSort);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class LogisticsServiceImpl implements LogisticService {
|
||||
return JSONObject.toJavaObject(result, LogisticsResultVo.class);
|
||||
}
|
||||
String logisticsType = systemConfigService.getValueByKeyException("logistics_type");
|
||||
if (logisticsType.equals("1")) {// 平台查询
|
||||
if ("1".equals(logisticsType)) {// 平台查询
|
||||
OnePassLogisticsQueryVo queryVo = onePassService.exprQuery(expressNo, com);
|
||||
if (ObjectUtil.isNull(queryVo)) {
|
||||
return resultVo;
|
||||
@@ -86,11 +86,11 @@ public class LogisticsServiceImpl implements LogisticService {
|
||||
String jsonString = JSONObject.toJSONString(resultVo);
|
||||
saveCache(JSONObject.parseObject(jsonString));
|
||||
}
|
||||
if (logisticsType.equals("2")) {// 阿里云查询
|
||||
if ("2".equals(logisticsType)) {// 阿里云查询
|
||||
String appCode = systemConfigService.getValueByKey(Constants.CONFIG_KEY_LOGISTICS_APP_CODE);
|
||||
|
||||
// 顺丰请输入单号 : 收件人或寄件人手机号后四位。例如:123456789:1234
|
||||
if (StrUtil.isNotBlank(com) && com.equals("shunfengkuaiyun")) {
|
||||
if (StrUtil.isNotBlank(com) && "shunfengkuaiyun".equals(com)) {
|
||||
expressNo = expressNo.concat(":").concat(StrUtil.sub(phone, 7, -1));
|
||||
}
|
||||
String url = Constants.LOGISTICS_API_URL + "?no=" + expressNo;
|
||||
@@ -162,7 +162,7 @@ public class LogisticsServiceImpl implements LogisticService {
|
||||
* @since 2020-07-06
|
||||
*/
|
||||
private void checkResult(JSONObject data) {
|
||||
if (!data.getString("status").equals("0")){
|
||||
if (!"0".equals(data.getString("status"))){
|
||||
throw new CrmebException(data.getString("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ public class OnePassServiceImpl implements OnePassService {
|
||||
params.add("num", expressNo);
|
||||
JSONObject post = onePassUtil.postFrom(OnePassConstants.ONE_PASS_API_URL + OnePassConstants.ONE_PASS_API_EXPRESS_QUEARY_URI, params, header);
|
||||
String dataStr = post.getString("data");
|
||||
if (StrUtil.isBlank(dataStr) || dataStr.equals("[]")) {
|
||||
if (StrUtil.isBlank(dataStr) || "[]".equals(dataStr)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject jsonObject = post.getJSONObject("data");
|
||||
|
||||
@@ -233,9 +233,9 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
// 分销员逻辑
|
||||
if (!user.getIsPromoter()) {
|
||||
String funcStatus = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_BROKERAGE_FUNC_STATUS);
|
||||
if (funcStatus.equals("1")) {
|
||||
if ("1".equals(funcStatus)) {
|
||||
String broQuota = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_STORE_BROKERAGE_QUOTA);
|
||||
if (!broQuota.equals("-1") && storeOrder.getPayPrice().compareTo(new BigDecimal(broQuota)) >= 0) {// -1 不成为分销员
|
||||
if (!"-1".equals(broQuota) && storeOrder.getPayPrice().compareTo(new BigDecimal(broQuota)) >= 0) {// -1 不成为分销员
|
||||
user.setIsPromoter(true);
|
||||
user.setPromoterTime(cn.hutool.core.date.DateUtil.date());
|
||||
}
|
||||
@@ -413,7 +413,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
private List<UserBrokerageRecord> assignCommission(StoreOrder storeOrder) {
|
||||
// 检测商城是否开启分销功能
|
||||
String isOpen = systemConfigService.getValueByKey(Constants.CONFIG_KEY_STORE_BROKERAGE_IS_OPEN);
|
||||
if(StrUtil.isBlank(isOpen) || isOpen.equals("0")){
|
||||
if(StrUtil.isBlank(isOpen) || "0".equals(isOpen)){
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 营销产品不参与
|
||||
@@ -535,7 +535,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
}
|
||||
// 判断分销模式
|
||||
String model = systemConfigService.getValueByKey(Constants.CONFIG_KEY_STORE_BROKERAGE_MODEL);
|
||||
if (StrUtil.isNotBlank(model) && model.equals("1") && !spreadUser.getIsPromoter()) {
|
||||
if (StrUtil.isNotBlank(model) && "1".equals(model) && !spreadUser.getIsPromoter()) {
|
||||
// 指定分销模式下:不是推广员不参与分销
|
||||
return recordList;
|
||||
}
|
||||
@@ -549,7 +549,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
if (ObjectUtil.isNull(spreadSpreadUser)) {
|
||||
return recordList;
|
||||
}
|
||||
if (StrUtil.isNotBlank(model) && model.equals("1") && !spreadSpreadUser.getIsPromoter()) {
|
||||
if (StrUtil.isNotBlank(model) && "1".equals(model) && !spreadSpreadUser.getIsPromoter()) {
|
||||
// 指定分销模式下:不是推广员不参与分销
|
||||
return recordList;
|
||||
}
|
||||
@@ -926,10 +926,10 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
integralRecord.setTitle(IntegralRecordConstants.BROKERAGE_RECORD_TITLE_ORDER);
|
||||
integralRecord.setIntegral(integral);
|
||||
integralRecord.setBalance(balance);
|
||||
if (type.equals("order")){
|
||||
if ("order".equals(type)){
|
||||
integralRecord.setMark(StrUtil.format("用户付款成功,订单增加{}积分", integral));
|
||||
}
|
||||
if (type.equals("product")) {
|
||||
if ("product".equals(type)) {
|
||||
integralRecord.setMark(StrUtil.format("用户付款成功,商品增加{}积分", integral));
|
||||
}
|
||||
integralRecord.setStatus(IntegralRecordConstants.INTEGRAL_RECORD_STATUS_CREATE);
|
||||
@@ -1002,7 +1002,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
for (int i = 0; i < couponsForGiveUser.size();) {
|
||||
StoreProductCoupon storeProductCoupon = couponsForGiveUser.get(i);
|
||||
MyRecord record = storeCouponUserService.paySuccessGiveAway(storeProductCoupon.getIssueCouponId(), storeOrder.getUid());
|
||||
if (record.getStr("status").equals("fail")) {
|
||||
if ("fail".equals(record.getStr("status"))) {
|
||||
logger.error(StrUtil.format("支付成功领取优惠券失败,失败原因:{}", record.getStr("errMsg")));
|
||||
couponsForGiveUser.remove(i);
|
||||
continue;
|
||||
|
||||
@@ -947,7 +947,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
// 自提开关是否打开
|
||||
String storeSelfMention = systemConfigService.getValueByKey(SysConfigConstants.CONFIG_KEY_STORE_SELF_MENTION);
|
||||
if (storeSelfMention.equals("false")) {
|
||||
if ("false".equals(storeSelfMention)) {
|
||||
throw new CrmebException("请先联系管理员开启门店自提");
|
||||
}
|
||||
SystemStore systemStore = systemStoreService.getById(request.getStoreId());
|
||||
@@ -1337,12 +1337,12 @@ public class OrderServiceImpl implements OrderService {
|
||||
private OrderInfoVo validatePreOrderRequest(PreOrderRequest request, User user) {
|
||||
OrderInfoVo orderInfoVo = new OrderInfoVo();
|
||||
List<OrderInfoDetailVo> detailVoList = CollUtil.newArrayList();
|
||||
if (request.getPreOrderType().equals("shoppingCart")) {// 购物车购买
|
||||
if ("shoppingCart".equals(request.getPreOrderType())) {// 购物车购买
|
||||
detailVoList = validatePreOrderShopping(request, user);
|
||||
List<Long> cartIdList = request.getOrderDetails().stream().map(PreOrderDetailRequest::getShoppingCartId).distinct().collect(Collectors.toList());
|
||||
orderInfoVo.setCartIdList(cartIdList);
|
||||
}
|
||||
if (request.getPreOrderType().equals("buyNow")) {// 立即购买
|
||||
if ("buyNow".equals(request.getPreOrderType())) {// 立即购买
|
||||
// 立即购买只会有一条详情
|
||||
PreOrderDetailRequest detailRequest = request.getOrderDetails().get(0);
|
||||
if (detailRequest.getSeckillId() > 0) {// 秒杀
|
||||
@@ -1414,7 +1414,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
detailVoList.add(detailVo);
|
||||
}
|
||||
}
|
||||
if (request.getPreOrderType().equals("again")) {// 再次购买
|
||||
if ("again".equals(request.getPreOrderType())) {// 再次购买
|
||||
PreOrderDetailRequest detailRequest = request.getOrderDetails().get(0);
|
||||
detailVoList = validatePreOrderAgain(detailRequest, user);
|
||||
}
|
||||
@@ -1896,7 +1896,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// 全场满额包邮金额
|
||||
String storeFreePostageString = systemConfigService.getValueByKey(SysConfigConstants.STORE_FEE_POSTAGE);
|
||||
BigDecimal storePostage = BigDecimal.ZERO;
|
||||
if (postageSwitchString.equals("true") && (storeFreePostageString.equals("0") || orderInfoVo.getProTotalFee().compareTo(new BigDecimal(storeFreePostageString)) >= 0)) {
|
||||
if ("true".equals(postageSwitchString) && ("0".equals(storeFreePostageString) || orderInfoVo.getProTotalFee().compareTo(new BigDecimal(storeFreePostageString)) >= 0)) {
|
||||
storePostage = BigDecimal.ZERO;
|
||||
} else if (ObjectUtil.isNull(userAddress) || userAddress.getCityId() <= 0) {
|
||||
// 用户地址不存在,默认运费为0元
|
||||
|
||||
@@ -282,7 +282,7 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
||||
// 根据订单状态表判断订单是否可以自动完成
|
||||
for (StoreOrder order : orderList) {
|
||||
StoreOrderStatus orderStatus = storeOrderStatusService.getLastByOrderId(order.getId());
|
||||
if (!orderStatus.getChangeType().equals("user_take_delivery")) {
|
||||
if (!"user_take_delivery".equals(orderStatus.getChangeType())) {
|
||||
logger.error("订单自动完成:订单记录最后一条不是收货状态,orderId = " + order.getId());
|
||||
continue ;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
||||
|
||||
for (ShippingTemplatesFreeRequest shippingTemplatesFreeRequest : shippingTemplatesFreeRequestList) {
|
||||
String uniqueKey = DigestUtils.md5Hex(shippingTemplatesFreeRequest.toString());
|
||||
if(shippingTemplatesFreeRequest.getCityId().equals("all") || shippingTemplatesFreeRequest.getCityId().equals("0")){
|
||||
if("all".equals(shippingTemplatesFreeRequest.getCityId()) || "0".equals(shippingTemplatesFreeRequest.getCityId())){
|
||||
cityIdList = getCityIdList();
|
||||
}else{
|
||||
cityIdList = CrmebUtil.stringToArray(shippingTemplatesFreeRequest.getCityId());
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
for (ShippingTemplatesRegionRequest shippingTemplatesRegionRequest : shippingTemplatesRegionRequestList) {
|
||||
String uniqueKey = DigestUtils.md5Hex(shippingTemplatesRegionRequest.toString());
|
||||
|
||||
if(shippingTemplatesRegionRequest.getCityId().equals("all") || shippingTemplatesRegionRequest.getCityId().equals("0")){
|
||||
if("all".equals(shippingTemplatesRegionRequest.getCityId()) || "0".equals(shippingTemplatesRegionRequest.getCityId())){
|
||||
cityIdList = getCityIdList();
|
||||
}else{
|
||||
cityIdList = CrmebUtil.stringToArray(shippingTemplatesRegionRequest.getCityId());
|
||||
|
||||
@@ -744,12 +744,12 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
@Override
|
||||
public Boolean operationStock(Integer id, Integer num, String type) {
|
||||
UpdateWrapper<StoreBargain> updateWrapper = new UpdateWrapper<>();
|
||||
if (type.equals("add")) {
|
||||
if ("add".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota + {}", num));
|
||||
}
|
||||
if (type.equals("sub")) {
|
||||
if ("sub".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota - {}", num));
|
||||
@@ -887,7 +887,7 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
}
|
||||
|
||||
// 回滚商品库存/销量 并更新
|
||||
boolean isPlus = storeProductStockRequest.getOperationType().equals("add");
|
||||
boolean isPlus = "add".equals(storeProductStockRequest.getOperationType());
|
||||
int productStock = isPlus ? existProduct.getStock() + storeProductStockRequest.getNum() : existProduct.getStock() - storeProductStockRequest.getNum();
|
||||
existProduct.setStock(productStock);
|
||||
existProduct.setSales(existProduct.getSales() - storeProductStockRequest.getNum());
|
||||
|
||||
@@ -154,7 +154,7 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
Integer userId = userService.getUserIdException();
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
int num;
|
||||
if (request.getType().equals("total")) {
|
||||
if ("total".equals(request.getType())) {
|
||||
num = getUserCountByStatus(userId, request.getNumType());
|
||||
} else {
|
||||
num = getUserSumByStatus(userId, request.getNumType());
|
||||
|
||||
@@ -966,12 +966,12 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
@Override
|
||||
public Boolean operationStock(Integer id, Integer num, String type) {
|
||||
UpdateWrapper<StoreCombination> updateWrapper = new UpdateWrapper<>();
|
||||
if (type.equals("add")) {
|
||||
if ("add".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota + {}", num));
|
||||
}
|
||||
if (type.equals("sub")) {
|
||||
if ("sub".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota - {}", num));
|
||||
@@ -1074,7 +1074,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
}
|
||||
|
||||
// 回滚商品库存/销量 并更新
|
||||
boolean isPlus = storeProductStockRequest.getOperationType().equals("add");
|
||||
boolean isPlus = "add".equals(storeProductStockRequest.getOperationType());
|
||||
int productStock = isPlus ? existCombination.getStock() + storeProductStockRequest.getNum() : existCombination.getStock() - storeProductStockRequest.getNum();
|
||||
existCombination.setStock(productStock);
|
||||
existCombination.setSales(existCombination.getSales() - storeProductStockRequest.getNum());
|
||||
|
||||
@@ -165,7 +165,7 @@ public class StoreCouponServiceImpl extends ServiceImpl<StoreCouponDao, StoreCou
|
||||
}
|
||||
|
||||
//看是否过期
|
||||
if (!(storeCoupon.getReceiveEndTime() == null || storeCoupon.getReceiveEndTime().equals(""))) {
|
||||
if (!(storeCoupon.getReceiveEndTime() == null || "".equals(storeCoupon.getReceiveEndTime()))) {
|
||||
//非永久可领取
|
||||
String date = DateUtil.nowDateTimeStr();
|
||||
int result = DateUtil.compareDate(date, DateUtil.dateToStr(storeCoupon.getReceiveEndTime(), Constants.DATE_FORMAT), Constants.DATE_FORMAT);
|
||||
|
||||
@@ -299,11 +299,11 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
LambdaQueryWrapper<StoreCouponUser> lqw = new LambdaQueryWrapper<>();
|
||||
|
||||
lqw.eq(StoreCouponUser::getUid, userId);
|
||||
if (type.equals("usable")) {
|
||||
if ("usable".equals(type)) {
|
||||
lqw.eq(StoreCouponUser::getStatus, CouponConstants.STORE_COUPON_USER_STATUS_USABLE);
|
||||
lqw.orderByDesc(StoreCouponUser::getId);
|
||||
}
|
||||
if (type.equals("unusable")) {
|
||||
if ("unusable".equals(type)) {
|
||||
lqw.gt(StoreCouponUser::getStatus, CouponConstants.STORE_COUPON_USER_STATUS_USABLE);
|
||||
lqw.last(StrUtil.format(" order by case `status` when {} then {} when {} then {} when {} then {} end", 0, 1, 1, 2, 2, 3));
|
||||
}
|
||||
|
||||
@@ -126,14 +126,14 @@ public class StoreProductAttrValueServiceImpl extends ServiceImpl<StoreProductAt
|
||||
@Override
|
||||
public Boolean operationStock(Integer id, Integer num, String operationType, Integer type) {
|
||||
UpdateWrapper<StoreProductAttrValue> updateWrapper = new UpdateWrapper<>();
|
||||
if (operationType.equals("add")) {
|
||||
if ("add".equals(operationType)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales - {}", num));
|
||||
if (type > 0) {
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota + {}", num));
|
||||
}
|
||||
}
|
||||
if (operationType.equals("sub")) {
|
||||
if ("sub".equals(operationType)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
if (type > 0) {
|
||||
|
||||
@@ -688,7 +688,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
*/
|
||||
private List<String> getProductActivityList(String activityStr) {
|
||||
List<String> activityList = CollUtil.newArrayList();
|
||||
if (activityStr.equals("0, 1, 2, 3")) {
|
||||
if ("0, 1, 2, 3".equals(activityStr)) {
|
||||
activityList.add(Constants.PRODUCT_TYPE_NORMAL_STR);
|
||||
activityList.add(Constants.PRODUCT_TYPE_SECKILL_STR);
|
||||
activityList.add(Constants.PRODUCT_TYPE_BARGAIN_STR);
|
||||
@@ -975,7 +975,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
}
|
||||
|
||||
// 回滚商品库存/销量 并更新
|
||||
boolean isPlus = storeProductStockRequest.getOperationType().equals("add");
|
||||
boolean isPlus = "add".equals(storeProductStockRequest.getOperationType());
|
||||
int productStock = isPlus ? existProduct.getStock() + storeProductStockRequest.getNum() : existProduct.getStock() - storeProductStockRequest.getNum();
|
||||
existProduct.setStock(productStock);
|
||||
existProduct.setSales(existProduct.getSales() - storeProductStockRequest.getNum());
|
||||
@@ -1003,7 +1003,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
throw new CrmebException("请先进行采集商品配置");
|
||||
}
|
||||
int copyNum = 0;
|
||||
if (copyType.equals("1")) {// 一号通
|
||||
if ("1".equals(copyType)) {// 一号通
|
||||
JSONObject info = onePassService.info();
|
||||
copyNum = Optional.ofNullable(info.getJSONObject("copy").getInteger("num")).orElse(0);
|
||||
}
|
||||
@@ -1035,11 +1035,11 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
@Override
|
||||
public Boolean operationStock(Integer id, Integer num, String type) {
|
||||
UpdateWrapper<StoreProduct> updateWrapper = new UpdateWrapper<>();
|
||||
if (type.equals("add")) {
|
||||
if ("add".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales - {}", num));
|
||||
}
|
||||
if (type.equals("sub")) {
|
||||
if ("sub".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
// 扣减时加乐观锁保证库存不为负
|
||||
|
||||
@@ -829,12 +829,12 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
@Override
|
||||
public Boolean operationStock(Integer id, Integer num, String type) {
|
||||
UpdateWrapper<StoreSeckill> updateWrapper = new UpdateWrapper<>();
|
||||
if (type.equals("add")) {
|
||||
if ("add".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota + {}", num));
|
||||
}
|
||||
if (type.equals("sub")) {
|
||||
if ("sub".equals(type)) {
|
||||
updateWrapper.setSql(StrUtil.format("stock = stock - {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota - {}", num));
|
||||
@@ -916,7 +916,7 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
}
|
||||
|
||||
// 回滚商品库存/销量 并更新
|
||||
boolean isPlus = storeProductStockRequest.getOperationType().equals("add");
|
||||
boolean isPlus = "add".equals(storeProductStockRequest.getOperationType());
|
||||
int productStock = isPlus ? existProduct.getStock() + storeProductStockRequest.getNum() : existProduct.getStock() - storeProductStockRequest.getNum();
|
||||
existProduct.setStock(productStock);
|
||||
existProduct.setSales(existProduct.getSales() - storeProductStockRequest.getNum());
|
||||
|
||||
@@ -129,7 +129,7 @@ public class SystemCityServiceImpl extends ServiceImpl<SystemCityDao, SystemCity
|
||||
public List<Integer> getCityIdList() {
|
||||
Object data = redisUtil.get(Constants.CITY_LIST_LEVEL_1);
|
||||
List<Integer> collect;
|
||||
if (data == null || data.equals("")) {
|
||||
if (data == null || "".equals(data)) {
|
||||
LambdaQueryWrapper<SystemCity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(SystemCity::getCityId);
|
||||
lambdaQueryWrapper.eq(SystemCity::getLevel, 1);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class SystemFormTempServiceImpl extends ServiceImpl<SystemFormTempDao, Sy
|
||||
systemConfigFormItemVo = JSONObject.parseObject(item, SystemConfigFormItemVo.class);
|
||||
String model = systemConfigFormItemVo.get__vModel__(); //字段 name
|
||||
|
||||
if(systemConfigFormItemVo.get__config__().getRequired() && map.get(model).equals("")) {
|
||||
if(systemConfigFormItemVo.get__config__().getRequired() && "".equals(map.get(model))) {
|
||||
throw new CrmebException(systemConfigFormItemVo.get__config__().getLabel() + "不能为空!");
|
||||
}
|
||||
//正则验证
|
||||
|
||||
@@ -100,10 +100,10 @@ public class SystemMenuServiceImpl extends ServiceImpl<SystemMenuDao, SystemMenu
|
||||
*/
|
||||
@Override
|
||||
public Boolean add(SystemMenuRequest request) {
|
||||
if (request.getMenuType().equals("C") && StrUtil.isEmpty(request.getComponent())) {
|
||||
if ("C".equals(request.getMenuType()) && StrUtil.isEmpty(request.getComponent())) {
|
||||
throw new CrmebException("菜单类型的组件路径不能为空");
|
||||
}
|
||||
if (request.getMenuType().equals("A") && StrUtil.isEmpty(request.getPerms())) {
|
||||
if ("A".equals(request.getMenuType()) && StrUtil.isEmpty(request.getPerms())) {
|
||||
throw new CrmebException("按钮类型的权限表示不能为空");
|
||||
}
|
||||
SystemMenu systemMenu = new SystemMenu();
|
||||
@@ -125,7 +125,7 @@ public class SystemMenuServiceImpl extends ServiceImpl<SystemMenuDao, SystemMenu
|
||||
public Boolean deleteById(Integer id) {
|
||||
SystemMenu systemMenu = getInfoById(id);
|
||||
systemMenu.setIsDelte(true);
|
||||
if (systemMenu.getMenuType().equals("A")) {
|
||||
if ("A".equals(systemMenu.getMenuType())) {
|
||||
boolean update = updateById(systemMenu);
|
||||
if (update) {
|
||||
redisUtil.delete(CACHE_LIST_KEY);
|
||||
@@ -159,10 +159,10 @@ public class SystemMenuServiceImpl extends ServiceImpl<SystemMenuDao, SystemMenu
|
||||
if (ObjectUtil.isNull(request.getId())) {
|
||||
throw new CrmebException("系统菜单id不能为空");
|
||||
}
|
||||
if (request.getMenuType().equals("C") && StrUtil.isEmpty(request.getComponent())) {
|
||||
if ("C".equals(request.getMenuType()) && StrUtil.isEmpty(request.getComponent())) {
|
||||
throw new CrmebException("菜单类型的组件路径不能为空");
|
||||
}
|
||||
if (request.getMenuType().equals("A") && StrUtil.isEmpty(request.getPerms())) {
|
||||
if ("A".equals(request.getMenuType()) && StrUtil.isEmpty(request.getPerms())) {
|
||||
throw new CrmebException("按钮类型的权限表示不能为空");
|
||||
}
|
||||
SystemMenu systemMenu = new SystemMenu();
|
||||
|
||||
@@ -131,7 +131,7 @@ public class SystemNotificationServiceImpl extends ServiceImpl<SystemNotificatio
|
||||
public NotificationInfoResponse getDetail(NotificationInfoRequest request) {
|
||||
SystemNotification notification = getByIdException(request.getId());
|
||||
NotificationInfoResponse response = new NotificationInfoResponse();
|
||||
if (request.getDetailType().equals("wechat")) {
|
||||
if ("wechat".equals(request.getDetailType())) {
|
||||
if (notification.getIsWechat().equals(0)) {
|
||||
throw new CrmebException("请先配置公众号模板消息");
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public class SystemNotificationServiceImpl extends ServiceImpl<SystemNotificatio
|
||||
BeanUtils.copyProperties(templateMessage, response);
|
||||
response.setStatus(notification.getIsWechat());
|
||||
}
|
||||
if (request.getDetailType().equals("routine")) {
|
||||
if ("routine".equals(request.getDetailType())) {
|
||||
if (notification.getIsRoutine().equals(0)) {
|
||||
throw new CrmebException("请先配置小程序订阅消息");
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public class SystemNotificationServiceImpl extends ServiceImpl<SystemNotificatio
|
||||
BeanUtils.copyProperties(templateMessage, response);
|
||||
response.setStatus(notification.getIsRoutine());
|
||||
}
|
||||
if (request.getDetailType().equals("sms")) {
|
||||
if ("sms".equals(request.getDetailType())) {
|
||||
if (notification.getIsSms().equals(0)) {
|
||||
throw new CrmebException("请先配置短信模板");
|
||||
}
|
||||
@@ -193,11 +193,11 @@ public class SystemNotificationServiceImpl extends ServiceImpl<SystemNotificatio
|
||||
*/
|
||||
@Override
|
||||
public Boolean modify(NotificationUpdateRequest request) {
|
||||
if (!request.getDetailType().equals("sms") && StrUtil.isEmpty(request.getTempId())) {
|
||||
if (!"sms".equals(request.getDetailType()) && StrUtil.isEmpty(request.getTempId())) {
|
||||
throw new CrmebException("模板id不能为空");
|
||||
}
|
||||
SystemNotification notification = getByIdException(request.getId());
|
||||
if (request.getDetailType().equals("wechat")) {
|
||||
if ("wechat".equals(request.getDetailType())) {
|
||||
if (notification.getIsWechat().equals(0)) {
|
||||
throw new CrmebException("请先为通知配置公众号模板");
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class SystemNotificationServiceImpl extends ServiceImpl<SystemNotificatio
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
}
|
||||
if (request.getDetailType().equals("routine")) {
|
||||
if ("routine".equals(request.getDetailType())) {
|
||||
if (notification.getIsRoutine().equals(0)) {
|
||||
throw new CrmebException("请先为通知配置小程序订阅模板");
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public class SystemNotificationServiceImpl extends ServiceImpl<SystemNotificatio
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
}
|
||||
if (request.getDetailType().equals("sms") && !notification.getIsSms().equals(request.getStatus())) {
|
||||
if ("sms".equals(request.getDetailType()) && !notification.getIsSms().equals(request.getStatus())) {
|
||||
notification.setIsSms(request.getStatus());
|
||||
return updateById(notification);
|
||||
}
|
||||
|
||||
@@ -193,16 +193,16 @@ public class UploadServiceImpl implements UploadService {
|
||||
try{
|
||||
// 构造一个带指定Zone对象的配置类, 默认华东
|
||||
Configuration cfg = new Configuration(Region.huadong());
|
||||
if(cloudVo.getRegion().equals("huabei")){
|
||||
if("huabei".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.huabei());
|
||||
}
|
||||
if(cloudVo.getRegion().equals("huanan")){
|
||||
if("huanan".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.huanan());
|
||||
}
|
||||
if(cloudVo.getRegion().equals("beimei")){
|
||||
if("beimei".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.beimei());
|
||||
}
|
||||
if(cloudVo.getRegion().equals("dongnanya")){
|
||||
if("dongnanya".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.xinjiapo());
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ public class UploadServiceImpl implements UploadService {
|
||||
break;
|
||||
}
|
||||
systemAttachmentService.save(systemAttachment);
|
||||
if (!fileIsSave.equals("1")) {
|
||||
if (!"1".equals(fileIsSave)) {
|
||||
// 删除本地文件
|
||||
file.delete();
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public class UploadServiceImpl implements UploadService {
|
||||
}
|
||||
// 判断是否保存本地
|
||||
String fileIsSave = systemConfigService.getValueByKeyException("file_is_save");
|
||||
if (fileIsSave.equals("1")) {
|
||||
if ("1".equals(fileIsSave)) {
|
||||
multipartFile.transferTo(file);
|
||||
}
|
||||
|
||||
@@ -401,16 +401,16 @@ public class UploadServiceImpl implements UploadService {
|
||||
try{
|
||||
// 构造一个带指定Zone对象的配置类, 默认华东
|
||||
Configuration cfg = new Configuration(Region.huadong());
|
||||
if(cloudVo.getRegion().equals("huabei")){
|
||||
if("huabei".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.huabei());
|
||||
}
|
||||
if(cloudVo.getRegion().equals("huanan")){
|
||||
if("huanan".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.huanan());
|
||||
}
|
||||
if(cloudVo.getRegion().equals("beimei")){
|
||||
if("beimei".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.beimei());
|
||||
}
|
||||
if(cloudVo.getRegion().equals("dongnanya")){
|
||||
if("dongnanya".equals(cloudVo.getRegion())){
|
||||
cfg = new Configuration(Region.xinjiapo());
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class UserBillServiceImpl extends ServiceImpl<UserBillDao, UserBill> impl
|
||||
if (request.getSort() == null) {
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
}else{
|
||||
if (request.getSort().equals("asc")) {
|
||||
if ("asc".equals(request.getSort())) {
|
||||
queryWrapper.orderByAsc("number");
|
||||
}else{
|
||||
queryWrapper.orderByDesc("number");
|
||||
@@ -123,7 +123,7 @@ public class UserBillServiceImpl extends ServiceImpl<UserBillDao, UserBill> impl
|
||||
|
||||
//关联id
|
||||
if (StringUtils.isNotBlank(request.getLinkId())) {
|
||||
if (request.getLinkId().equals("gt")) {
|
||||
if ("gt".equals(request.getLinkId())) {
|
||||
queryWrapper.ne("link_id", 0);
|
||||
}else{
|
||||
queryWrapper.eq("link_id", request.getLinkId());
|
||||
|
||||
@@ -108,7 +108,7 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
}
|
||||
// 切割字符串,判断是支付订单还是充值订单
|
||||
String pre = StrUtil.subPre(orderNo, 5);
|
||||
if (pre.equals("order")) {// 支付订单
|
||||
if ("order".equals(pre)) {// 支付订单
|
||||
StoreOrder storeOrder = storeOrderService.getByOderId(orderNo);
|
||||
if (ObjectUtil.isNull(storeOrder)) {
|
||||
throw new CrmebException("订单不存在");
|
||||
@@ -253,12 +253,12 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
String appId = "";
|
||||
String mchId = "";
|
||||
String signKey = "";
|
||||
if (userRecharge.getRechargeType().equals("public")) {// 公众号
|
||||
if ("public".equals(userRecharge.getRechargeType())) {// 公众号
|
||||
appId = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_WE_CHAT_APP_ID);
|
||||
mchId = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_WE_CHAT_MCH_ID);
|
||||
signKey = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_WE_CHAT_APP_KEY);
|
||||
}
|
||||
if (userRecharge.getRechargeType().equals("routine")) {// 小程序
|
||||
if ("routine".equals(userRecharge.getRechargeType())) {// 小程序
|
||||
appId = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_ROUTINE_APP_ID);
|
||||
mchId = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_ROUTINE_MCH_ID);
|
||||
signKey = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_ROUTINE_APP_KEY);
|
||||
@@ -423,11 +423,11 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
throw new CrmebException("微信下单失败!");
|
||||
}
|
||||
CreateOrderResponseVo responseVo = CrmebUtil.mapToObj(map, CreateOrderResponseVo.class);
|
||||
if (responseVo.getReturnCode().toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(responseVo.getReturnCode().toUpperCase())) {
|
||||
throw new CrmebException("微信下单失败1!" + responseVo.getReturnMsg());
|
||||
}
|
||||
|
||||
if (responseVo.getResultCode().toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(responseVo.getResultCode().toUpperCase())) {
|
||||
throw new CrmebException("微信下单失败2!" + responseVo.getErrCodeDes());
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(data, "微信获取开放平台access_token异常");
|
||||
@@ -169,7 +169,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(data, "微信获取开放平台用户信息异常");
|
||||
@@ -198,7 +198,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(data, "微信小程序登录凭证校验异常");
|
||||
@@ -261,7 +261,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
JSONObject data = JSONObject.parseObject(response);
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(data, "微信小程序生成小程序码异常");
|
||||
if (data.getString("errcode").equals("40001")) {
|
||||
if ("40001".equals(data.getString("errcode"))) {
|
||||
redisUtil.delete(WeChatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY);
|
||||
miniAccessToken = getMiniAccessToken();
|
||||
url = StrUtil.format(WeChatConstants.WECHAT_MINI_QRCODE_UNLIMITED_URL, miniAccessToken);
|
||||
@@ -310,7 +310,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
WechatPayInfo wechatPayInfo = createWechatPayInfo(unifiedorderVo);
|
||||
|
||||
CreateOrderResponseVo responseVo = CrmebUtil.mapToObj(map, CreateOrderResponseVo.class);
|
||||
if (responseVo.getReturnCode().toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(responseVo.getReturnCode().toUpperCase())) {
|
||||
// 保存到微信异常表
|
||||
wxPayExceptionDispose(map, "微信支付预下单异常");
|
||||
wechatPayInfo.setErrCode(map.get("return_code").toString());
|
||||
@@ -318,7 +318,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
throw new CrmebException("微信下单失败1!" + responseVo.getReturnMsg());
|
||||
}
|
||||
|
||||
if (responseVo.getResultCode().toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(responseVo.getResultCode().toUpperCase())) {
|
||||
wxPayExceptionDispose(map, "微信支付预下单业务异常");
|
||||
wechatPayInfo.setErrCode(map.get("err_code").toString());
|
||||
wechatPayInfoService.save(wechatPayInfo);
|
||||
@@ -381,16 +381,16 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
throw new CrmebException("微信订单查询失败!");
|
||||
}
|
||||
record.setColums(map);
|
||||
if (record.getStr("return_code").toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(record.getStr("return_code").toUpperCase())) {
|
||||
wxPayQueryExceptionDispose(record, "微信支付查询订单通信异常");
|
||||
throw new CrmebException("微信订单查询失败1!" + record.getStr("return_msg"));
|
||||
}
|
||||
|
||||
if (record.getStr("result_code").toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(record.getStr("result_code").toUpperCase())) {
|
||||
wxPayQueryExceptionDispose(record, "微信支付查询订单结果异常");
|
||||
throw new CrmebException("微信订单查询失败2!" + record.getStr("err_code") + record.getStr("err_code_des"));
|
||||
}
|
||||
if (!record.getStr("trade_state").toUpperCase().equals("SUCCESS")) {
|
||||
if (!"SUCCESS".equals(record.getStr("trade_state").toUpperCase())) {
|
||||
wxPayQueryExceptionDispose(record, "微信支付查询订单状态异常");
|
||||
throw new CrmebException("微信订单支付失败3!" + record.getStr("trade_state"));
|
||||
}
|
||||
@@ -417,7 +417,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
wxExceptionDispose(data, "微信公众号发送模板消息异常");
|
||||
throw new CrmebException("微信接口调用失败:" + data.getString("errcode") + data.getString("errmsg"));
|
||||
@@ -441,15 +441,15 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.getString("errcode").equals("40001")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if ("40001".equals(data.getString("errcode"))) {
|
||||
wxExceptionDispose(data, "微信小程序发送订阅消息异常");
|
||||
redisUtil.delete(WeChatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY);
|
||||
accessToken = getMiniAccessToken();
|
||||
url = StrUtil.format(WeChatConstants.WECHAT_MINI_SEND_SUBSCRIBE_URL, accessToken);
|
||||
result = restTemplateUtil.postJsonData(url, messAge);
|
||||
JSONObject data2 = JSONObject.parseObject(result);
|
||||
if (data2.containsKey("errcode") && !data2.getString("errcode").equals("0")) {
|
||||
if (data2.containsKey("errcode") && !"0".equals(data2.getString("errcode"))) {
|
||||
if (data2.containsKey("errmsg")) {
|
||||
wxExceptionDispose(data2, "微信小程序发送订阅消息重试异常");
|
||||
throw new CrmebException("微信接口调用失败:" + data2.getString("errcode") + data2.getString("errmsg"));
|
||||
@@ -479,7 +479,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(result)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (result.containsKey("errcode") && result.getString("errcode").equals("0")) {
|
||||
if (result.containsKey("errcode") && "0".equals(result.getString("errcode"))) {
|
||||
return result;
|
||||
}
|
||||
if (result.containsKey("errmsg")) {
|
||||
@@ -504,7 +504,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(jsonObject)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (jsonObject.containsKey("errcode") && jsonObject.getString("errcode").equals("0")) {
|
||||
if (jsonObject.containsKey("errcode") && "0".equals(jsonObject.getString("errcode"))) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (jsonObject.containsKey("errmsg")) {
|
||||
@@ -526,7 +526,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(result)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (result.containsKey("errcode") && result.getString("errcode").equals("0")) {
|
||||
if (result.containsKey("errcode") && "0".equals(result.getString("errcode"))) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
if (result.containsKey("errmsg")) {
|
||||
@@ -571,12 +571,12 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
}
|
||||
|
||||
WxRefundResponseVo responseVo = CrmebUtil.mapToObj(map, WxRefundResponseVo.class);
|
||||
if (responseVo.getReturnCode().toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(responseVo.getReturnCode().toUpperCase())) {
|
||||
wxPayExceptionDispose(map, "微信申请退款异常1");
|
||||
throw new CrmebException("微信申请退款失败1!" + responseVo.getReturnMsg());
|
||||
}
|
||||
|
||||
if (responseVo.getResultCode().toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(responseVo.getResultCode().toUpperCase())) {
|
||||
wxPayExceptionDispose(map, "微信申请退款业务异常");
|
||||
throw new CrmebException("微信申请退款失败2!" + responseVo.getErrCodeDes());
|
||||
}
|
||||
@@ -596,7 +596,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(jsonObject)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (jsonObject.containsKey("errcode") && !jsonObject.getString("errcode").equals("0")) {
|
||||
if (jsonObject.containsKey("errcode") && !"0".equals(jsonObject.getString("errcode"))) {
|
||||
if (jsonObject.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(jsonObject, StrUtil.format("获取我的公众号模板消息列表异常"));
|
||||
@@ -625,7 +625,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
wxExceptionDispose(data, "删除微信公众号模板消息异常");
|
||||
throw new CrmebException("微信接口调用失败:" + data.getString("errcode") + data.getString("errmsg"));
|
||||
@@ -651,7 +651,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
wxExceptionDispose(data, "添加公众号模板消息异常");
|
||||
throw new CrmebException("微信接口调用失败:" + data.getString("errcode") + data.getString("errmsg"));
|
||||
@@ -672,7 +672,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(jsonObject)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (jsonObject.containsKey("errcode") && !jsonObject.getString("errcode").equals("0")) {
|
||||
if (jsonObject.containsKey("errcode") && !"0".equals(jsonObject.getString("errcode"))) {
|
||||
if (jsonObject.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(jsonObject, StrUtil.format("获取小程序当前帐号下的个人模板列表异常"));
|
||||
@@ -700,7 +700,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
wxExceptionDispose(data, "删除微信小程序订阅消息异常");
|
||||
throw new CrmebException("微信接口调用失败:" + data.getString("errcode") + data.getString("errmsg"));
|
||||
@@ -722,7 +722,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(jsonObject)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (jsonObject.containsKey("errcode") && !jsonObject.getString("errcode").equals("0")) {
|
||||
if (jsonObject.containsKey("errcode") && !"0".equals(jsonObject.getString("errcode"))) {
|
||||
if (jsonObject.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(jsonObject, "获取小程序平台上的标准模板异常");
|
||||
@@ -754,7 +754,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
wxExceptionDispose(data, "添加小程序订阅消息异常");
|
||||
throw new CrmebException("微信接口调用失败:" + data.getString("errcode") + data.getString("errmsg"));
|
||||
@@ -794,7 +794,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(data, "微信获取JS-SDK的ticket异常");
|
||||
@@ -819,7 +819,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
if (ObjectUtil.isNull(data)) {
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if (data.containsKey("errcode") && !data.getString("errcode").equals("0")) {
|
||||
if (data.containsKey("errcode") && !"0".equals(data.getString("errcode"))) {
|
||||
if (data.containsKey("errmsg")) {
|
||||
// 保存到微信异常表
|
||||
wxExceptionDispose(data, StrUtil.format("微信获取accessToken异常,{}端", type));
|
||||
@@ -853,7 +853,7 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
private void wxPayExceptionDispose(HashMap<String, Object> map, String remark) {
|
||||
WechatExceptions wechatExceptions = new WechatExceptions();
|
||||
String returnCode = (String) map.get("return_code");
|
||||
if (returnCode.toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(returnCode.toUpperCase())) {
|
||||
wechatExceptions.setErrcode("-100");
|
||||
wechatExceptions.setErrmsg(map.get("return_msg").toString());
|
||||
} else {
|
||||
@@ -874,13 +874,13 @@ public class WechatNewServiceImpl implements WechatNewService {
|
||||
*/
|
||||
private void wxPayQueryExceptionDispose(MyRecord record, String remark) {
|
||||
WechatExceptions wechatExceptions = new WechatExceptions();
|
||||
if (record.getStr("return_code").toUpperCase().equals("FAIL")) {
|
||||
if ("FAIL".equals(record.getStr("return_code").toUpperCase())) {
|
||||
wechatExceptions.setErrcode("-200");
|
||||
wechatExceptions.setErrmsg(record.getStr("return_msg"));
|
||||
} else if (record.getStr("result_code").toUpperCase().equals("FAIL")) {
|
||||
} else if ("FAIL".equals(record.getStr("result_code").toUpperCase())) {
|
||||
wechatExceptions.setErrcode(record.getStr("err_code"));
|
||||
wechatExceptions.setErrmsg(record.getStr("err_code_des"));
|
||||
} else if (!record.getStr("trade_state").toUpperCase().equals("SUCCESS")) {
|
||||
} else if (!"SUCCESS".equals(record.getStr("trade_state").toUpperCase())) {
|
||||
wechatExceptions.setErrcode("-201");
|
||||
wechatExceptions.setErrmsg(record.getStr("trade_state"));
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WechatPublicServiceImpl implements WechatPublicService {
|
||||
@Override
|
||||
public Object getCustomizeMenus() {
|
||||
Object list = redisUtil.get(WeChatConstants.REDIS_PUBLIC_MENU_KEY);
|
||||
if (list == null || list.equals("")) {
|
||||
if (list == null || "".equals(list)) {
|
||||
//如果没有, 去读取
|
||||
JSONObject tagsList = wechatNewService.getPublicCustomMenu();
|
||||
redisUtil.set(WeChatConstants.REDIS_PUBLIC_MENU_KEY, tagsList);
|
||||
|
||||
@@ -24,13 +24,13 @@ public class RequestMethod {
|
||||
}
|
||||
|
||||
private static boolean CCIsNull(String client_id, String client_secret) {
|
||||
if (ClientId != null && ClientSecret != null && !ClientId.equals("") && !ClientSecret.equals(""))
|
||||
if (ClientId != null && ClientSecret != null && !"".equals(ClientId) && !"".equals(ClientSecret))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCodeOpen(String redirect_uri) {
|
||||
if (ClientId != null && !ClientId.equals(""))
|
||||
if (ClientId != null && !"".equals(ClientId))
|
||||
return UtilUrl.openType + "?response_type=code&client_id=" + ClientId + "&redirect_uri=" + redirect_uri + "&state=1";
|
||||
return example;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static boolean isNull(String content) {
|
||||
if (content != null && !content.equals(""))
|
||||
if (content != null && !"".equals(content))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user