| @@ -205,7 +205,11 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| // check End | // check End | ||||
| coupon.setTenantId(user.getTenantId()); | coupon.setTenantId(user.getTenantId()); | ||||
| wxCouponService.saveOrUpdate(coupon); | |||||
| ResultData resultData = wxCouponService.saveOrUpdate(coupon); | |||||
| if (resultData.code != ResultData.SUCCESS){ | |||||
| return resultData; | |||||
| } | |||||
| // Save to wx_coupon_car | // Save to wx_coupon_car | ||||
| WxCouponCar couponCar = new WxCouponCar(); | WxCouponCar couponCar = new WxCouponCar(); | ||||
| @@ -30,7 +30,7 @@ public class GlobalDefultExceptionHandler { | |||||
| @ExceptionHandler(Exception.class) | @ExceptionHandler(Exception.class) | ||||
| @ResponseBody | @ResponseBody | ||||
| public String defultExcepitonHandler(HttpServletRequest request, Exception e) { | |||||
| public ResultData defultExcepitonHandler(HttpServletRequest request, Exception e) { | |||||
| log(e, request); | log(e, request); | ||||
| if(isFmException) { | if(isFmException) { | ||||
| @@ -39,7 +39,7 @@ public class GlobalDefultExceptionHandler { | |||||
| if(me.getErrorCode() == ErrorCode.NET_TOKEN_EMPTY.getCode() | if(me.getErrorCode() == ErrorCode.NET_TOKEN_EMPTY.getCode() | ||||
| || me.getErrorCode() == ErrorCode.NET_TOKEN_INVALID.getCode()) { | || me.getErrorCode() == ErrorCode.NET_TOKEN_INVALID.getCode()) { | ||||
| // token异常问题, 不发邮件 | // token异常问题, 不发邮件 | ||||
| return e.getMessage(); | |||||
| return new ResultData(me.getErrorCode(),me.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| StringWriter sw = new StringWriter(); | StringWriter sw = new StringWriter(); | ||||
| @@ -60,9 +60,10 @@ public class GlobalDefultExceptionHandler { | |||||
| } | } | ||||
| return e.getMessage(); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } | } | ||||
| private void log(Exception ex, HttpServletRequest request) { | private void log(Exception ex, HttpServletRequest request) { | ||||
| logger.error("************************异常开始*******************************"); | logger.error("************************异常开始*******************************"); | ||||
| logger.error("请求地址:" + request.getRequestURL()); | logger.error("请求地址:" + request.getRequestURL()); | ||||
| @@ -67,6 +67,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return wxCouponMapper.findVoDetail(id); | return wxCouponMapper.findVoDetail(id); | ||||
| } | } | ||||
| private Long parseMerchantId(JSONObject merchantParam){ | private Long parseMerchantId(JSONObject merchantParam){ | ||||
| return Long.valueOf(merchantParam.getString("id")); | return Long.valueOf(merchantParam.getString("id")); | ||||
| } | } | ||||
| @@ -78,7 +79,6 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData saveOrUpdate(WxCoupon record) { | public ResultData saveOrUpdate(WxCoupon record) { | ||||
| @@ -107,7 +107,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| if (!record.getMerchantParams().isEmpty()) | |||||
| if (record.getMerchantParams() != null) | |||||
| { | { | ||||
| List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | List<JSONObject> merchantParamList = JSONObject.parseArray(record.getMerchantParams(), JSONObject.class); | ||||
| List<Integer> businessList= new ArrayList<>(); | List<Integer> businessList= new ArrayList<>(); | ||||
| @@ -92,7 +92,6 @@ | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | <result column="sale_price" jdbcType="INTEGER" property="salePrice" /> | ||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | <result column="use_price" jdbcType="INTEGER" property="usePrice" /> | ||||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" /> | <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" /> | ||||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | <result column="send_type" jdbcType="INTEGER" property="sendType" /> | ||||
| <result column="valid_type" jdbcType="INTEGER" property="validType" /> | <result column="valid_type" jdbcType="INTEGER" property="validType" /> | ||||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | ||||
| @@ -114,10 +113,10 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="CouponCarColumns"> | <sql id="CouponCarColumns"> | ||||
| c.id,c.tenant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||||
| c.id,c.tenant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||||
| car.vendor_type, car.vendor_params | car.vendor_type, car.vendor_params | ||||
| </sql> | </sql> | ||||
| <select id="selectCouponCarDetail" parameterType="java.lang.Long" resultMap="CouponCarMap"> | |||||
| <select id="findVoDetail" parameterType="java.lang.Long" resultMap="CouponCarMap"> | |||||
| select <include refid="CouponCarColumns" /> | select <include refid="CouponCarColumns" /> | ||||
| from | from | ||||
| wx_coupon c,wx_coupon_car car | wx_coupon c,wx_coupon_car car | ||||