Merge branch 'api' of http://120.27.238.55:7000/r/beauty-erp into api
| | |
| | | import com.matrix.component.wechat.externalInterface.service.RefundService; |
| | | import com.matrix.component.wechat.externalInterface.service.ScanPayQueryService; |
| | | import org.apache.log4j.Logger; |
| | | import org.springframework.beans.BeanUtils; |
| | | |
| | | /** |
| | | * User: rizenguo Date: 2014/12/1 Time: 17:05 |
| | |
| | | log.info("------------------request createPrapareOrder taking :" + totalTimeCost + "ms"+"--response="+payServiceResponseString); |
| | | |
| | | // 将从API返回的XML数据映射到Java对象 |
| | | JsApiPayResData jsApiPayResData = (JsApiPayResData) Util.getObjectFromXML(payServiceResponseString, |
| | | Object data = Util.getObjectFromXML(payServiceResponseString, |
| | | JsApiPayResData.class); |
| | | |
| | | JsApiPayResData jsApiPayResData=new JsApiPayResData(); |
| | | BeanUtils.copyProperties(data,jsApiPayResData); |
| | | return jsApiPayResData; |
| | | } |
| | | |
| | |
| | | public static Object getObjectFromXML(String xml, Class<?> tClass) { |
| | | //将从API返回的XML数据映射到Java对象 |
| | | XStream xStreamForResponseData = new XStream(); |
| | | XStream.setupDefaultSecurity(xStreamForResponseData); |
| | | xStreamForResponseData.allowTypes(new Class[]{tClass}); |
| | | xStreamForResponseData.alias("xml", tClass); |
| | | xStreamForResponseData.ignoreUnknownElements();//暂时忽略掉一些新增的字段 |
| | | return xStreamForResponseData.fromXML(xml); |
| | |
| | | // url权限拦截 |
| | | registry.addInterceptor(suAuthorityInterceptor).addPathPatterns("/**/su/**"); |
| | | //小程序公司与域名对应关系拦截 |
| | | registry.addInterceptor(hostInterceptor).addPathPatterns("/**/wxapi/**"); |
| | | registry.addInterceptor(hostInterceptor).addPathPatterns("/**/wxapi/**") |
| | | .excludePathPatterns("/wxCommon/wxapi/wxpayCallback"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // =====================================订单包裹相关 |
| | | |
| | | /** |
| | | * 省内包裹 |
| | | */ |
| | | public static final String IN_PROVINCE_PACKAGE = "IN_PROVINCE_PACKAGE"; |
| | | |
| | | /** |
| | | * 外省包裹 |
| | | */ |
| | | public static final String OUT_PROVINCE_PACKAGE = "OUT_PROVINCE_PACKAGE"; |
| | | |
| | | /** |
| | | * 省内免邮费包裹 |
| | | */ |
| | | public static final String PROVINCE_OVER_FREE_PACKAGE = "PROVINCE_OVER_FREE_PACKAGE"; |
| | | |
| | | // =====================================订单短信提醒相关 |
| | | /** |
| | | * 短信提醒 |
| | | */ |
| | | public static final String MSG_ALERT = "MSG_ALERT"; |
| | | |
| | | /** |
| | | * 短信提醒号码(多个以",分割") |
| | | */ |
| | | public static final String MSG_ALERT_MOBILE = "MSG_ALERT_MOBILE"; |
| | | |
| | | /** |
| | | * 短信提醒内容 |
| | | */ |
| | | public static final String MSG_ALERT_CONTENT = "MSG_ALERT_CONTENT"; |
| | | |
| | | /** |
| | | * 商户余额不足短信提醒内容 |
| | | */ |
| | | public static final String MSG_ALERT_NSF = "MSG_ALERT_NSF"; |
| | | |
| | | /** |
| | | * 待开票 |
| | |
| | | public static final String REFUND_FAIL_NOTENOUGH = "NOTENOUGH"; |
| | | |
| | | |
| | | // =====================================分销相关 |
| | | /** |
| | | * 成为分销商最低额度(查询数据字典时使用) |
| | | * 运费 |
| | | */ |
| | | public static final String BECOMING_DISTRIBUTOR_CONDITION = "BECOMING_DISTRIBUTOR_CONDITION"; |
| | | |
| | | public static final String PACKAGE_PRICE = "PACKAGE_PRICE"; |
| | | /** |
| | | * 用户等级-分销商 |
| | | * 免免邮金额 |
| | | */ |
| | | public static final Integer USER_VIP_DISTRIBUTOR = 1; |
| | | |
| | | /** |
| | | * 积分业务类型-获得 |
| | | */ |
| | | public static final Integer SCORE_BUSINESS_TYPE_GET = 1; |
| | | |
| | | /** |
| | | * 积分业务类型-兑换 |
| | | */ |
| | | public static final Integer SCORE_BUSINESS_TYPE_EXCHANGE = 2; |
| | | |
| | | /** |
| | | * 免费配送距离 |
| | | */ |
| | | public static final String DELIVERY_DISTANCE = "delivery_distance"; |
| | | /** |
| | | * 支持学校列表 |
| | | */ |
| | | public static final String SCHOOL = "SCHOOL"; |
| | | |
| | | |
| | | /** |
| | | * 省运费关系 |
| | | */ |
| | | public static final String IN_PROVINCE_PACKAGE_PRICE = "IN_PROVINCE_PACKAGE_PRICE"; |
| | | public static final String FIRST_OUT_PROVINCE_PACKAGE_PRICE = "FIRST_OUT_PROVINCE_PACKAGE_PRICE"; |
| | | public static final String SECOND_OUT_PROVINCE_PACKAGE_PRICE = "SECOND_OUT_PROVINCE_PACKAGE_PRICE"; |
| | | |
| | | public static final String IN_PROVINCE_PACKAGE_LIST = "IN_PROVINCE_PACKAGE_LIST"; |
| | | public static final String FIRST_PROVINCE_PACKAGE_LIST = "FIRST_PROVINCE_PACKAGE_LIST"; |
| | | public static final String SECOND_PROVINCE_PACKAGE_LIST = "SECOND_PROVINCE_PACKAGE_LIST"; |
| | | /** |
| | | * 起送费 |
| | | */ |
| | | public static final String QSFY = "QSFY"; |
| | | public static final String FREE_PACKAGE_PRICE = "FREE_PACKAGE_PRICE"; |
| | | |
| | | |
| | | /** |
| | |
| | | public @ResponseBody |
| | | AjaxResult modifyShopAdvertisType(@RequestBody ShopAdvertisType newShopAdvertisType) { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | if (StringUtils.isNotBlank(newShopAdvertisType.getNodeStyle())) { |
| | | String style = newShopAdvertisType.getNodeStyle(); |
| | | style = style.replaceAll("px", "rpx") |
| | |
| | | |
| | | newShopAdvertisType.setCreateBy(user.getSuName()); |
| | | newShopAdvertisType.setUpdateBy(user.getSuName()); |
| | | |
| | | newShopAdvertisType.setCompanyId(user.getCompanyId()); |
| | | shopAdvertisTypeDao.insert(newShopAdvertisType); |
| | | } else { |
| | | shopAdvertisTypeDao.updateByModel(newShopAdvertisType); |
| | |
| | | collect.forEach(ad -> { |
| | | ad.setCreateBy(user.getSuName()); |
| | | ad.setUpdateBy(user.getSuName()); |
| | | ad.setCompanyId(user.getCompanyId()); |
| | | ad.setTypeId(newShopAdvertisType.getAdtId()); |
| | | }); |
| | | |
| | |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.shopXcx.bean.ShopCoupon; |
| | | import com.matrix.system.shopXcx.bean.ShopProduct; |
| | | import com.matrix.system.shopXcx.dao.ShopCouponDao; |
| | |
| | | * @param shopCoupon |
| | | */ |
| | | private void productLabeling(ShopCoupon shopCoupon) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | Date now = new Date(); |
| | | Boolean needUpdate = false; |
| | | //优惠券处于可用状态 |
| | |
| | | if (shopCoupon.getIsAll() == 1) { |
| | | ShopProduct productQuery = new ShopProduct(); |
| | | productQuery.setDelFlag(2); |
| | | productQuery.setCompanyId(user.getCompanyId()); |
| | | shopProductList = shopProductDao.selectByModel(productQuery); |
| | | } else { |
| | | if (StringUtils.isNotBlank(shopCoupon.getProductIds())) { |
| | |
| | | package com.matrix.system.shopXcx.action; |
| | | |
| | | import com.matrix.core.anotations.RemoveRequestToken; |
| | | import com.matrix.core.anotations.SaveRequestToken; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.constance.SystemErrorCode; |
| | | import com.matrix.core.constance.SystemMessageCode; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | import com.matrix.core.tools.ModelUtils; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.web.BaseAction; |
| | | import com.matrix.core.constance.SystemErrorCode; |
| | | import com.matrix.core.anotations.RemoveRequestToken; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.common.tools.ServiceUtil; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.shopXcx.bean.ShopPage; |
| | | import com.matrix.system.shopXcx.dao.ShopPageDao; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import com.matrix.core.anotations.SaveRequestToken; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import com.matrix.system.shopXcx.bean.ShopPage; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | /** |
| | | * @description 小程序页面 |
| | |
| | | @RemoveRequestToken |
| | | @RequestMapping(value = "/addShopPage") |
| | | public @ResponseBody AjaxResult addShopPage(ShopPage shopPage) { |
| | | if (serviceUtil.addCheckRepeat("shop_page", "code", shopPage.getCode())) { |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | if (serviceUtil.addCheckRepeatTowColumn("shop_page", "code", shopPage.getCode(),"company_id", user.getCompanyId())) { |
| | | throw new GlobleException("code重复"); |
| | | } |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | shopPage.setCreateBy(user.getSuName()); |
| | | shopPage.setUpdateBy(user.getSuName()); |
| | | shopPage.setCompanyId(user.getCompanyId()); |
| | |
| | | @RequestMapping(value = "/modifyShopPage") |
| | | public @ResponseBody AjaxResult modifyShopPage(ShopPage newShopPage) { |
| | | ShopPage oldShopPage = WebUtil.getSessionAttribute(BEV); |
| | | |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | // 校验去重 |
| | | if (serviceUtil.updateCheckRepeat("shop_page", |
| | | if (serviceUtil.updateCheckRepeatTowColumn("shop_page", |
| | | "company_id", user.getCompanyId(), |
| | | "code", newShopPage.getCode(), |
| | | "id",newShopPage.getId())) { |
| | | throw new GlobleException("编号" + newShopPage.getCode() + "重复"); |
| | |
| | | bizUser.setOpenId(openId); |
| | | bizUser.setLastLoginTime(new Date()); |
| | | bizUser.setUserType(AppConstance.USER_TYPE_CUSTOMER); |
| | | bizUser.setCompanyId(HostInterceptor.getCompanyId()); |
| | | bizUserService.add(bizUser); |
| | | |
| | | } else { |
| | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.ShoppingGoods; |
| | | import com.matrix.system.hive.dao.ShoppingGoodsDao; |
| | |
| | | } |
| | | } |
| | | //获取当前购物车产品可用的优惠券 |
| | | List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(addShopOrderPOJO.getShopId(),notCouponuyCart); |
| | | List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(bizUser.getCompanyId(),notCouponuyCart); |
| | | |
| | | //获取用户使用的优惠券 |
| | | CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO(); |
| | |
| | | |
| | | } |
| | | |
| | | Integer addrId = null; |
| | | if (shopReceiveAddress != null) { |
| | | addrId = shopReceiveAddress.getAddrId(); |
| | | } |
| | | |
| | | //得到订单计价说明 |
| | | DiscountExplain discountExplain = shopOrderService.buildDiscountExplain(cartList, shopCoupon.getReceiveId(), addrId); |
| | | DiscountExplain discountExplain = shopOrderService.buildDiscountExplain(cartList, shopCoupon.getReceiveId(), bizUser.getCompanyId()); |
| | | |
| | | AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, buyCart, buyCart.size()); |
| | | //结算金额信息 |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.biz.dao.BizUserDao; |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.component.wechat.externalInterface.common.Signature; |
| | | import com.matrix.component.wechat.externalInterface.common.Util; |
| | | import com.matrix.component.wechat.externalInterface.protocol.queryProtocol.NotifyData; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.shopXcx.bean.ShopActivitiesGroupJoin; |
| | |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDao; |
| | | import com.matrix.system.shopXcx.dao.ShopPayLogDao; |
| | | import com.matrix.system.shopXcx.mqTask.MQTaskRouting; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.xml.sax.SAXException; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.xml.parsers.ParserConfigurationException; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | |
| | | notityXml.append(inputLine); |
| | | } |
| | | request.getReader().close(); |
| | | // XMl转对象 |
| | | NotifyData data = (NotifyData) Util.getObjectFromXML(notityXml.toString(), NotifyData.class); |
| | | LogUtil.info(data.toString()); |
| | | LogUtil.info("notityXml ---- :{} ", notityXml); |
| | | |
| | | |
| | | // XMl转对象 |
| | | Object bb = Util.getObjectFromXML(notityXml.toString(), NotifyData.class); |
| | | NotifyData data = new NotifyData(); |
| | | BeanUtils.copyProperties(bb,data); |
| | | LogUtil.info("----return_code = {}", data.getReturn_code()); |
| | | |
| | | |
| | | // 返回状态码 SUCCESS/FAIL |
| | | if (AppConstance.CODE_SUCCESS.equals(data.getReturn_code())) { |
| | | |
| | | orderId = data.getAttach(); |
| | | // 检验订单状态 |
| | | ShopOrder order = shopOrderDao.selectById(Integer.valueOf(orderId)); |
| | | |
| | | // 校验签名 |
| | | BusParameterSettings paySecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_SECRET, HostInterceptor.getCompanyId()); |
| | | BusParameterSettings paySecret = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WECHARPAY_SECRET, order.getCompanyId()); |
| | | if (Signature.checkIsSignValidFromResponseString(notityXml.toString(),paySecret.getParamValue())) { |
| | | // 校验业务结果 |
| | | if (AppConstance.CODE_SUCCESS.equals(data.getResult_code())) { |
| | |
| | | Double total_fee = Double.parseDouble(data.getTotal_fee()); |
| | | // 商户订单号 |
| | | String payNum = data.getOut_trade_no(); |
| | | orderId = data.getAttach(); |
| | | |
| | | LogUtil.info("支付回调关键信息---total_fee:{},payNum:{},orderId:{}", total_fee, payNum, orderId); |
| | | // 订单ID |
| | | BigDecimal payMoney = new BigDecimal(total_fee).divide(new BigDecimal(100), 2, |
| | | RoundingMode.HALF_UP); |
| | | |
| | | // 检验订单状态 |
| | | ShopOrder order = shopOrderDao.selectById(Integer.valueOf(orderId)); |
| | | |
| | | if (order != null && ShopOrder.ORDER_PAY_STATUS_WAIT == order.getPayStatus()) { |
| | | ShopPayLog payLog = new ShopPayLog(); |
| | | // TODO 校验支付金额 |
| | |
| | | threadResult.putInMap("msg", "查询支付信息失败,请联系客服或者刷新支付信息(错误码:003)"); |
| | | resXml = AppConstance.RESULT_XML_FAIL.replace(ERRORMSG, "通信标识失败"); |
| | | } |
| | | } catch (ParserConfigurationException | IOException | SAXException e) { |
| | | } catch (Exception e) { |
| | | LogUtil.error("支付回调签名错误", e); |
| | | threadResult.putInMap("status", "err"); |
| | | threadResult.putInMap("msg", "查询支付信息失败,请联系客服或者刷新支付信息(错误码:004)"); |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.component.tools.WxUtils; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.CustomerDataDictionary; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | |
| | | import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService; |
| | | import com.matrix.system.shopXcx.api.tools.SMSTools; |
| | | import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; |
| | | import com.matrix.system.shopXcx.bean.ShopOrder; |
| | | import com.matrix.system.shopXcx.bean.ShopRefundRecord; |
| | | import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; |
| | | import com.matrix.system.shopXcx.dao.ShopOrderDao; |
| | | import com.matrix.system.shopXcx.dao.ShopRefundRecordDao; |
| | | import com.matrix.component.tools.WxUtils; |
| | | import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService; |
| | | import com.matrix.system.shopXcx.api.tools.SMSTools; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | modifyMap.put("id", orderId); |
| | | modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_APPLY_MONEYBACK); |
| | | shopOrderDao.updateByMap(modifyMap); |
| | | //从数据字典获取需要发送的手机号码和短信提醒内容 |
| | | BusParameterSettings busParameterSetting1 =busParameterSettingsDao.selectCompanyParamByCode("MSG_ALERT_CONTENT_REFUND",17L); |
| | | |
| | | String msg = busParameterSetting1.getParamValue(); |
| | | |
| | | |
| | | //TODO 写死微商城17L公司id |
| | | BusParameterSettings busParameterSetting= busParameterSettingsDao.selectCompanyParamByCode("MSG_ALERT_MOBILE",17L); |
| | | |
| | | |
| | | String phons = busParameterSetting.getParamValue(); |
| | | |
| | | phons.replace(',',','); |
| | | List<String> result = Arrays.asList(phons.split(",")); |
| | | if(CollectionUtils.isNotEmpty(result)){ |
| | | for(String phon : result){ |
| | | smsTools.sendMsg(phon, msg + "退订回T" ); |
| | | } |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功"); |
| | | } |
| | | |
| | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.PropertiesUtil; |
| | | import com.matrix.core.tools.UUIDUtil; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.hive.dao.SysShopInfoDao; |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.shopXcx.api.pojo.QrcodeImgParam; |
| | |
| | | @Autowired |
| | | ShopActivitiesSeckillInfoDao shopActivitiesSeckillInfoDao; |
| | | |
| | | @Autowired |
| | | BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | /** |
| | | * 生成二维码 |
| | | */ |
| | |
| | | qrcodeImgParam = getQrcodeImgParam(loginUser, qrcodeVo); |
| | | shareQrcord.setProductId(qrcodeVo.getProductId()); |
| | | } |
| | | |
| | | qrcodeImgParam.logo=""; |
| | | //绘制二维码 |
| | | drawQrcode(qrcodeImgParam); |
| | | |
| | |
| | | qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg; |
| | | qrcodeImgParam.title = "【秒杀】" + shopProduct.getTitle(); |
| | | qrcodeImgParam.price = "¥" +seckillInfo.getSiPrice(); |
| | | qrcodeImgParam.logo = "深圳肽妍"; |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验肽妍产品"; |
| | | |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验"; |
| | | return qrcodeImgParam; |
| | | } |
| | | |
| | |
| | | qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg; |
| | | qrcodeImgParam.title = "【拼团】" + shopProduct.getTitle(); |
| | | qrcodeImgParam.price = "¥" + price.getGpPrice(); |
| | | qrcodeImgParam.logo = "深圳肽妍"; |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验肽妍产品"; |
| | | |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验"; |
| | | return qrcodeImgParam; |
| | | } |
| | | |
| | |
| | | private QrcodeImgParam getQrcodeImgParam(BizUser loginUser, QrcodeVo qrcodeVo) throws Exception { |
| | | |
| | | ShopProduct shopProduct = shopProductDao.selectById(qrcodeVo.getProductId()); |
| | | |
| | | |
| | | |
| | | String qrcodeSavePath = WxacodeUtil.getWxacode(qrcodeVo.getScene(), qrcodeVo.getPath(), UUIDUtil.getRandomID()); |
| | | |
| | |
| | | qrcodeImgParam.targetImg = baseSavePath + "/" + "wxacode" + "/" + targetImg; |
| | | qrcodeImgParam.title = shopProduct.getTitle(); |
| | | qrcodeImgParam.price = "¥" + shopProduct.getPrice().toString(); |
| | | qrcodeImgParam.logo = "深圳肽妍"; |
| | | |
| | | ShopCoupon shopCoupon = shopProduct.getShopCoupon(); |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验肽妍产品"; |
| | | qrcodeImgParam.couponName = loginUser.getNickName() + "邀您体验"; |
| | | if (shopCoupon != null) { |
| | | String beginTiem = DateUtil.dateFormatStr(shopCoupon.getBeginTime(), DateUtil.DATE_FORMAT_SPLITE_DD); |
| | | String endTiem = DateUtil.dateFormatStr(shopCoupon.getEndTime(), DateUtil.DATE_FORMAT_SPLITE_DD); |
| | |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.shopXcx.api.service.WXShopOrderService; |
| | | import com.matrix.system.shopXcx.api.service.WxShopActivitiesGroupService; |
| | | import com.matrix.system.shopXcx.api.vo.WxActivitiesGroupBuyVO; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @PostMapping(value = "/calPrice") |
| | | public AjaxResult calPrice(@RequestBody CreateGroupBuyDTO createGroupBuyDTO) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | ShopActivitiesGroupPrice groupPrice = shopActivitiesGroupPriceDao.selectById(createGroupBuyDTO.getGpId()); |
| | | // 判断参数中gjId是否为空,若为空则为团长开团。再判断团长价是否为空,如果不为空则拥有团长价 |
| | | if (createGroupBuyDTO.getGjId() == null) { |
| | |
| | | } else { |
| | | createGroupBuyDTO.setPrice(groupPrice.getGpPrice()); |
| | | } |
| | | BigDecimal postage = wxShopOrderService.calculationPostage(createGroupBuyDTO.getAddressId(), createGroupBuyDTO.getPrice()); |
| | | BigDecimal postage = wxShopOrderService.calculationPostage(createGroupBuyDTO.getPrice(),bizUser.getCompanyId()); |
| | | BigDecimal payPrice = createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount())).add(postage); |
| | | AjaxResult ajaxResult = new AjaxResult(AjaxResult.STATUS_SUCCESS, null); |
| | | ajaxResult.putInMap("billPrice", createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount()))); |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.system.shopXcx.api.service.WXShopOrderService; |
| | | import com.matrix.system.shopXcx.api.service.WxShopActivitiesSecKillService; |
| | |
| | | @Autowired |
| | | private WXShopOrderService wxShopOrderService; |
| | | @Autowired |
| | | private WxShopActivitiesSecKillService wxShopActivitiesSecKillService; |
| | | private WxShopActivitiesSecKillService wxShopActvitiesSecKillService; |
| | | |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping(value = "/calSecKillPrice") |
| | | public AjaxResult calSecKillPrice(@RequestBody SecKillVO secKillVO) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | ShopActivitiesSeckillInfo seckillInfo = shopActivitiesSeckillInfoDao.selectById(secKillVO.getId()); |
| | | if (seckillInfo == null) { |
| | | return AjaxResult.buildFailInstance("参数有误"); |
| | | } |
| | | |
| | | BigDecimal postage = wxShopOrderService.calculationPostage(secKillVO.getAddressId(), seckillInfo.getSiPrice()); |
| | | BigDecimal postage = wxShopOrderService.calculationPostage(seckillInfo.getSiPrice(),bizUser.getCompanyId()); |
| | | BigDecimal payPrice = seckillInfo.getSiPrice().multiply(BigDecimal.valueOf(secKillVO.getCount())).add(postage); |
| | | AjaxResult ajaxResult = new AjaxResult(AjaxResult.STATUS_SUCCESS, null); |
| | | ajaxResult.putInMap("totalPrice", payPrice); |
| | |
| | | */ |
| | | @PostMapping(value = "/createSecKill") |
| | | public AjaxResult createSecKill(@RequestBody CreateSecKillDTO secKillDTO) throws Exception { |
| | | return wxShopActivitiesSecKillService.createSecKillOrder(secKillDTO); |
| | | return wxShopActvitiesSecKillService.createSecKillOrder(secKillDTO); |
| | | } |
| | | } |
| | |
| | | package com.matrix.system.shopXcx.api.action; |
| | | |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.pojo.PaginationVO; |
| | | |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.shopXcx.dao.ShopCouponDao; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.shopXcx.api.service.WxShopCouponService; |
| | | import com.matrix.system.shopXcx.dao.ShopCouponDao; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "getMyCouponInfoByStatus/{shopId}/{status}") |
| | | @RequestMapping(value = "getMyCouponInfoByStatus/{status}") |
| | | @ResponseBody |
| | | public AjaxResult getMyCouponInfo(@PathVariable("shopId") Long shopId,@PathVariable("status") Integer status, @RequestBody PaginationVO pageVo) { |
| | | public AjaxResult getMyCouponInfo(@PathVariable("status") Integer status, @RequestBody PaginationVO pageVo) { |
| | | |
| | | return shopCouponService.getMyCouponInfoByStatus(shopId,status, pageVo); |
| | | return shopCouponService.getMyCouponInfoByStatus(HostInterceptor.getCompanyId(),status, pageVo); |
| | | } |
| | | |
| | | /** |
| | |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, shopCouponService.getCouponListByProductId(productId)); |
| | | } |
| | | |
| | | @GetMapping(value = "getCouponListByTag/{shopId}/{tag}") |
| | | @GetMapping(value = "getCouponListByTag/{tag}") |
| | | @ResponseBody |
| | | public AjaxResult getCouponListByTag(@PathVariable("tag") String tag,@PathVariable("shopId") Long shopId) { |
| | | return shopCouponService.getCouponListByTag(tag,shopId); |
| | | public AjaxResult getCouponListByTag(@PathVariable("tag") String tag) { |
| | | return shopCouponService.getCouponListByTag(tag, HostInterceptor.getCompanyId()); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.matrix.system.shopXcx.api.service; |
| | | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.CustomerDataDictionary; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.shopXcx.api.vo.ShopCartBillVo; |
| | | import com.matrix.system.shopXcx.api.vo.ShopCartVo; |
| | | import com.matrix.system.shopXcx.bean.ShopCoupon; |
| | | import com.matrix.system.shopXcx.bean.ShopShoppingCart; |
| | | import com.matrix.system.shopXcx.dao.ShopShoppingCartDao; |
| | | import com.matrix.system.shopXcx.api.vo.ShopCartBillVo; |
| | | import com.matrix.system.shopXcx.api.vo.ShopCartVo; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | // 1表示没有优惠的默认分组 |
| | | ShopCartVo def = new ShopCartVo(); |
| | | |
| | | /** |
| | | * 同城配送标题 |
| | | * //DataDictionary qsfy = dataDictionaryDao.selectByTypeCode(AppConstance.QSFY); |
| | | * //def.setMsg("2公里内满" + qsfy.getValue() + "元免配送费"); |
| | | */ |
| | | |
| | | def.setMsg("肽研官方商城"); |
| | | |
| | | def.setMsg("商城"); |
| | | def.setCartList(new ArrayList<>()); |
| | | // 组合默认分组 |
| | | cartList.add(def); |
| | |
| | | } |
| | | } |
| | | } else { |
| | | BusParameterSettings qsfy= busParameterSettingsDao.selectCompanyParamByCode(AppConstance.IN_PROVINCE_PACKAGE_LIST,17L); |
| | | |
| | | shopCartVo.setSubtotal(selectSum); |
| | | shopCartVo.setSrcPrice(selectSum); |
| | | if (selectSum.compareTo(new BigDecimal(qsfy.getParamValue())) < 0) { |
| | | shopCartVo.setSatisfactionCoupon(false); |
| | | } else { |
| | | shopCartVo.setSatisfactionCoupon(true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | BigDecimal calculationPostage(Integer addressId, BigDecimal payPrice); |
| | | BigDecimal calculationPostage(BigDecimal payPrice,Long companyId); |
| | | |
| | | /** |
| | | * 创建订单 |
| | |
| | | */ |
| | | AjaxResult updateStockAndVolumeById(Integer orderId); |
| | | |
| | | DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer id, Integer addrId); |
| | | DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer id, Long companyId); |
| | | } |
| | |
| | | * 根据购物车选中的产品 |
| | | * @return |
| | | */ |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long shopId,List<ShopShoppingCart> shopShoppingCarts); |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts); |
| | | |
| | | |
| | | /** |
| | |
| | | * 根据状态获取我的优惠券 |
| | | * |
| | | * |
| | | * @param shopId |
| | | * @param companyId |
| | | * @param status |
| | | * @param pageVo |
| | | * @return |
| | | */ |
| | | AjaxResult getMyCouponInfoByStatus(Long shopId, Integer status, PaginationVO pageVo); |
| | | AjaxResult getMyCouponInfoByStatus(Long companyId, Integer status, PaginationVO pageVo); |
| | | |
| | | /** |
| | | * 根据产品ID获取优惠券列表 |
| | |
| | | * 根据标签获取优惠券列表 |
| | | * |
| | | * @param tag |
| | | * @param shopId |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | AjaxResult getCouponListByTag(String tag, Long shopId); |
| | | AjaxResult getCouponListByTag(String tag, Long companyId); |
| | | |
| | | /** |
| | | * 根据产品id查询该产品符合的优惠活动 |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.matrix.biz.bean.BizUser; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.bean.CustomerDataDictionary; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.component.rabbitmq.RabiitMqTemplate; |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.component.tools.WxUtils; |
| | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.bean.BusParameterSettings; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.dao.CustomerDataDictionaryDao; |
| | | import com.matrix.system.common.interceptor.HostInterceptor; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.hive.bean.ShoppingGoods; |
| | |
| | | private BusParameterSettingsDao busParameterSettingsDao; |
| | | |
| | | @Override |
| | | public BigDecimal calculationPostage(Integer addressId, BigDecimal payPrice) { |
| | | public BigDecimal calculationPostage(BigDecimal payPrice,Long companyId) { |
| | | BigDecimal postage = BigDecimal.ZERO; |
| | | if (addressId != null) { |
| | | ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(addressId); |
| | | |
| | | |
| | | BusParameterSettings sn= busParameterSettingsDao.selectCompanyParamByCode(AppConstance.IN_PROVINCE_PACKAGE_LIST,17L); |
| | | |
| | | |
| | | BusParameterSettings pydq= busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SECOND_PROVINCE_PACKAGE_LIST,17L); |
| | | |
| | | |
| | | |
| | | if (sn.getParamValue().indexOf(shopReceiveAddress.getAddrProvince()) > -1) { |
| | | //省内邮费计算 |
| | | postage = getPostageByDataBictionary(AppConstance.IN_PROVINCE_PACKAGE_PRICE, payPrice); |
| | | } else if (pydq.getParamValue().indexOf(shopReceiveAddress.getAddrProvince()) > -1) { |
| | | //偏远地区 |
| | | postage = getPostageByDataBictionary(AppConstance.SECOND_OUT_PROVINCE_PACKAGE_PRICE, payPrice); |
| | | } else { |
| | | //其他地区 |
| | | postage = getPostageByDataBictionary(AppConstance.FIRST_OUT_PROVINCE_PACKAGE_PRICE, payPrice); |
| | | BusParameterSettings yf = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.PACKAGE_PRICE, companyId); |
| | | BusParameterSettings myje = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.FREE_PACKAGE_PRICE, companyId); |
| | | if(yf!=null&&myje!=null){ |
| | | if (Double.parseDouble(myje.getParamValue()) > payPrice.doubleValue()) { |
| | | postage = new BigDecimal(yf.getParamValue()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return postage; |
| | | } |
| | | |
| | | //todo 根据数据字典计算运费 运费设置为0 后面再改配置在改计算规则 |
| | | private BigDecimal getPostageByDataBictionary(String code, BigDecimal payPrice) { |
| | | |
| | | /*CustomerDataDictionary dd = dataDictionaryDao.selectByTypeCode(code); |
| | | |
| | | |
| | | BigDecimal postage = BigDecimal.ZERO; |
| | | if (StringUtils.isNotBlank(dd.getValue())) { |
| | | if (StringUtils.isNotBlank(dd.getExtValue()) |
| | | && payPrice.compareTo(new BigDecimal(dd.getExtValue())) >= 0) { |
| | | //达到条件免邮 |
| | | postage = BigDecimal.ZERO; |
| | | } else { |
| | | postage = new BigDecimal(dd.getValue()); |
| | | } |
| | | }*/ |
| | | return BigDecimal.ZERO; |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | //计算订单优惠信息 |
| | | DiscountExplain discountExplain = buildDiscountExplain(cartList, addShopOrderPOJO.getCouponReceiveId(), shopReceiveAddress.getAddrId()); |
| | | DiscountExplain discountExplain = buildDiscountExplain(cartList, addShopOrderPOJO.getCouponReceiveId(), bizUser.getCompanyId()); |
| | | |
| | | |
| | | ShopOrder shopOrder = new ShopOrder(); |
| | | shopOrder.setCompanyId(bizUser.getCompanyId()); |
| | | shopOrder.setStoreId(Integer.parseInt(addShopOrderPOJO.getShopId().toString())); |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_SERVICE); |
| | | //默认设置为产品类型 |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_GOODS); |
| | | |
| | | List<ShopOrderDetails> details = new ArrayList<>(); |
| | | Integer cartCount = 0; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer receiveId, Integer receiveAddrId) { |
| | | public DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer receiveId, Long companyId) { |
| | | ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList); |
| | | DiscountExplain discountExplain = new DiscountExplain(); |
| | | discountExplain.setActivity(shopCartBill.getBillCouponTotal()); |
| | |
| | | } |
| | | } |
| | | |
| | | discountExplain.setPostage(calculationPostage(receiveAddrId, discountExplain.getPayPrice())); |
| | | discountExplain.setPostage(calculationPostage(discountExplain.getPayPrice(),companyId)); |
| | | |
| | | //计算实际支付 |
| | | discountExplain.setPayPrice(discountExplain.getPayPrice().add(discountExplain.getPostage())); |
| | |
| | | import com.matrix.component.wechat.externalInterface.protocol.paramProtocol.BrandWCPayRequestData; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.constance.Dictionary; |
| | |
| | | if (shopReceiveAddress == null) { |
| | | throw new GlobleException("请选择正确的收获地址"); |
| | | } |
| | | |
| | | BizUser user=redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | ShopOrder shopOrder = new ShopOrder(); |
| | | shopOrder.setCompanyId(user.getCompanyId()); |
| | | shopOrder.setStoreId(Integer.parseInt(createGroupBuyDTO.getShopId().toString())); |
| | | shopOrder.setOrderType(ShopOrder.ORDER_TYPE_SERVICE); |
| | | |
| | |
| | | shopOrder.setPayResult(ShopOrder.ORDER_WX_STATUS_WAIT_PAY); |
| | | //如果没有提交购买方式或配送方式不是物流 |
| | | //获取邮费 |
| | | BigDecimal postPrice = wxShopOrderService.calculationPostage(createGroupBuyDTO.getAddressId(), createGroupBuyDTO.getPrice()); |
| | | BigDecimal postPrice = wxShopOrderService.calculationPostage(createGroupBuyDTO.getPrice(),user.getCompanyId()); |
| | | shopOrder.setPostage(postPrice); |
| | | BigDecimal payPrice = createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount())).add(shopOrder.getPostage()); |
| | | shopOrder.setOrderMoney(payPrice); |
| | |
| | | } |
| | | |
| | | private ShopOrder createOrder(CreateSecKillDTO secKillDTO) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(secKillDTO.getAddressId()); |
| | | if (shopReceiveAddress == null) { |
| | | throw new GlobleException("请选择正确的收获地址"); |
| | |
| | | shopOrder.setUpdateBy("微信小程序生成"); |
| | | shopOrder.setCommodityPrice(secKillDTO.getPrice()); |
| | | shopOrder.setPurchaseQuantity(1); |
| | | shopOrder.setCompanyId(bizUser.getCompanyId()); |
| | | //购买方式 |
| | | shopOrder.setShippingMethod(secKillDTO.getShippingMethod()); |
| | | //生成订单号 |
| | |
| | | shopOrder.setPayResult(ShopOrder.ORDER_WX_STATUS_WAIT_PAY); |
| | | //如果没有提交购买方式或配送方式不是物流 |
| | | //获取邮费 |
| | | BigDecimal postPrice = wxShopOrderService.calculationPostage(secKillDTO.getAddressId(), secKillDTO.getPrice()); |
| | | BigDecimal postPrice = wxShopOrderService.calculationPostage(secKillDTO.getPrice(),bizUser.getCompanyId()); |
| | | shopOrder.setPostage(postPrice); |
| | | BigDecimal payPrice = secKillDTO.getPrice().multiply(BigDecimal.valueOf(secKillDTO.getCount())).add(shopOrder.getPostage()); |
| | | shopOrder.setOrderMoney(payPrice); |
| | |
| | | import com.matrix.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | |
| | | import com.matrix.system.shopXcx.bean.ShopCoupon; |
| | | import com.matrix.system.shopXcx.bean.ShopCouponRecord; |
| | | import com.matrix.system.shopXcx.bean.ShopProductAttrRef; |
| | | import com.matrix.system.shopXcx.bean.ShopShoppingCart; |
| | | import com.matrix.system.shopXcx.dao.ShopCouponDao; |
| | | import com.matrix.system.shopXcx.dao.ShopCouponRecordDao; |
| | | import com.matrix.system.shopXcx.dao.ShopProductAttrRefDao; |
| | | import com.matrix.system.shopXcx.dao.ShopReceiveAddressDao; |
| | | import com.matrix.system.shopXcx.bean.*; |
| | | import com.matrix.system.shopXcx.dao.*; |
| | | import com.matrix.system.shopXcx.api.service.WxShopCouponService; |
| | | import com.matrix.system.shopXcx.api.tools.WxShopCouponUtil; |
| | | import com.matrix.system.shopXcx.api.tools.WxShopOrderUtil; |
| | |
| | | @Autowired |
| | | private WxShopCouponUtil wxShopCouponUtil; |
| | | |
| | | @Autowired |
| | | private ShopProductDao productDao; |
| | | |
| | | |
| | | /** |
| | | * 根据购物车选中的产品,计算合适的优惠券 |
| | | * |
| | | * @return |
| | | */ |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long shopId,List<ShopShoppingCart> shopShoppingCarts) { |
| | | public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts) { |
| | | |
| | | //可用优惠券列表 |
| | | List<CouponReceiveInfoVO> shopCoupons = new ArrayList<>(); |
| | |
| | | |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | //1.找到用户所有的优惠券 |
| | | List<CouponReceiveInfoVO> userAllCoupon = shopCouponRecordDao.selectMyCouponByStatus(shopId, bizUser.getOpenId(), AppConstance.MY_COUPON_NOT_USE, |
| | | List<CouponReceiveInfoVO> userAllCoupon = shopCouponRecordDao.selectMyCouponByStatus(companyId, bizUser.getOpenId(), AppConstance.MY_COUPON_NOT_USE, |
| | | null); |
| | | if (CollectionUtils.isNotEmpty(userAllCoupon)) { |
| | | //根据优惠力度排序,优惠力度大的先参与计算 |
| | |
| | | * 根据订单状态查询优惠券列表 |
| | | * |
| | | * |
| | | * @param shopId |
| | | * @param companyId |
| | | * @param status 1=已使用;2=未使用;3=过期 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult getMyCouponInfoByStatus(Long shopId, Integer status, PaginationVO pageVo) { |
| | | public AjaxResult getMyCouponInfoByStatus(Long companyId, Integer status, PaginationVO pageVo) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | // 如果查询使用或未使用状态的优惠券列表 |
| | | if (AppConstance.MY_COUPON_USE.equals(status) || AppConstance.MY_COUPON_NOT_USE.equals(status)) { |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyCouponByStatus(shopId,bizUser.getOpenId(), status, |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyCouponByStatus(companyId,bizUser.getOpenId(), status, |
| | | pageVo); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, list); |
| | | } |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyPastCoupon(shopId,bizUser.getOpenId(), pageVo); |
| | | List<CouponReceiveInfoVO> list = shopCouponRecordDao.selectMyPastCoupon(companyId,bizUser.getOpenId(), pageVo); |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, list); |
| | | } |
| | | |
| | |
| | | attrIds.addAll(ids); |
| | | } |
| | | } |
| | | List<ShopCoupon> list = shopCouponDao.selectHdListByProductId(productId, attrIds); |
| | | ShopProduct shopProduct = productDao.selectById(productId); |
| | | List<ShopCoupon> list = shopCouponDao.selectHdListByProductId(productId, attrIds,shopProduct.getCompanyId()); |
| | | return list; |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AjaxResult getCouponListByTag(String tag, Long shopId) { |
| | | public AjaxResult getCouponListByTag(String tag, Long companyId) { |
| | | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | boolean newPeople = wxShopCouponUtil.verifyIsNewPeople(bizUser.getOpenId()); |
| | | List<ShopCoupon> couponList = shopCouponDao.selectCouponListByTag(newPeople, bizUser.getOpenId(), tag,shopId); |
| | | List<ShopCoupon> couponList = shopCouponDao.selectCouponListByTag(newPeople, bizUser.getOpenId(), tag,companyId); |
| | | AjaxResult res = new AjaxResult(AjaxResult.STATUS_SUCCESS, couponList); |
| | | res.putInMap("isNewPeople", newPeople); |
| | | return res; |
| | |
| | | package com.matrix.system.shopXcx.api.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.matrix.core.constance.SystemErrorCode; |
| | | import com.matrix.component.tools.HttpCurlUtil; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.common.constance.AppConstance; |
| | | import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; |
| | | import com.matrix.system.shopXcx.api.vo.LogisticsInfoVo; |
| | | import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; |
| | | import com.matrix.system.shopXcx.bean.ShopLogisticsInfo; |
| | | import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; |
| | | import com.matrix.system.shopXcx.dao.ShopLogisticsInfoDao; |
| | | import com.matrix.component.tools.HttpCurlUtil; |
| | | import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService; |
| | | import com.matrix.system.shopXcx.api.vo.LogisticsInfoVo; |
| | | import com.matrix.system.shopXcx.api.vo.SfLogisticsInfoVo; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | } |
| | | } |
| | | } else { |
| | | throw new GlobleException(SystemErrorCode.REQUEST_INVALID, logisticsInfoVo.getReason()); |
| | | throw new GlobleException(logisticsInfoVo.getReason()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | LogUtil.error("物流信息查询失败", e); |
| | | throw new GlobleException(SystemErrorCode.REQUEST_INVALID); |
| | | throw new GlobleException("物流信息查询失败"); |
| | | } |
| | | List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); |
| | | result.setStatus(AjaxResult.STATUS_SUCCESS); |
| | |
| | | @Param("productId") Integer productId, @Param("attrIds") List<String> attrIds); |
| | | |
| | | List<ShopCoupon> selectCouponListByTag(@Param("isNewPeople") boolean isNewPeople, @Param("userId") String userId, |
| | | @Param("tag") String tag,@Param("shopId") Long shopId); |
| | | @Param("tag") String tag,@Param("companyId") Long companyId); |
| | | |
| | | public int updateStateByStateAndIds(@Param("list") List<String> list, @Param("state") int state); |
| | | |
| | |
| | | |
| | | ShopCoupon selectByIdAndUserId(@Param("id") Integer id, @Param("userId") String userId); |
| | | |
| | | public List<ShopCoupon> selectHdListByProductId(@Param("productId") Integer productId, @Param("attrIds") List<String> attrIds); |
| | | public List<ShopCoupon> selectHdListByProductId(@Param("productId") Integer productId, @Param("attrIds") List<String> attrIds, @Param("companyId")Long companyId); |
| | | |
| | | ShopCoupon getCouponByTitle(@Param("title")String title, @Param("companyId")Long companyId); |
| | | } |
| | |
| | | |
| | | CouponReceiveInfoVO selectMyCouponByReceiveId(@Param("receiveId") Integer receiveId); |
| | | |
| | | List<CouponReceiveInfoVO> selectMyCouponByStatus(@Param("shopId") Long shopId, @Param("userId") String userId, @Param("status") Integer status, |
| | | List<CouponReceiveInfoVO> selectMyCouponByStatus(@Param("companyId") Long shopId, @Param("userId") String userId, @Param("status") Integer status, |
| | | @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | List<CouponReceiveInfoVO> selectMyPastCoupon(@Param("shopId")Long shopId, @Param("userId") String userId, @Param("pageVo") PaginationVO pageVo); |
| | | List<CouponReceiveInfoVO> selectMyPastCoupon(@Param("companyId")Long shopId, @Param("userId") String userId, @Param("pageVo") PaginationVO pageVo); |
| | | |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createOrder(ShopOrder orderDto) { |
| | | |
| | | //判断是否存在需要同步的产品,只有绑定了erp中产品的才同步 |
| | | boolean needTb=false; |
| | | for (ShopOrderDetails orderItemDto : orderDto.getDetails()) { |
| | | ShopSku shopSku = shopSkuDao.selectById(orderItemDto.getsId()); |
| | | if (StringUtils.isNotBlank(shopSku.getStockCode())) { |
| | | needTb=true; |
| | | } |
| | | } |
| | | if(needTb){ |
| | | |
| | | BizUser bizUser = bizUserService.findByOpenId(orderDto.getUserId()); |
| | | SysOrder order = new SysOrder(); |
| | | //TODO 根据公司id区分 |
| | | SysVipInfo vipInfo = vipDao.selectByPhone(bizUser.getPhoneNumber()); |
| | | if(SysVipInfo.UNDEAL_VIP==vipInfo.getIsDeal()){ |
| | | //非成交客户下单更新客户为成交客户 |
| | |
| | | } |
| | | |
| | | //获取订单归属门店 |
| | | order.setCompanyId(vipInfo.getCompanyId()); |
| | | order.setCompanyId(orderDto.getCompanyId()); |
| | | order.setShopId(Long.parseLong(orderDto.getStoreId()+"")); |
| | | //同步的订单订单编号保持一致 |
| | | order.setOrderNo(orderDto.getOrderNo()); |
| | |
| | | order.setArrears(0); |
| | | int i = sysOrderDao.insert(order); |
| | | // 创建订单明细,并计算总价与折扣总价 |
| | | // 总价 |
| | | double total = 0; |
| | | double zkTotal = 0; |
| | | int count = 0; |
| | | // 设置订单条目 |
| | | for (ShopOrderDetails orderItemDto : orderDto.getDetails()) { |
| | |
| | | flow.setShopId(sourceOrder.getShopId()); |
| | | flow.setCompanyId(sourceOrder.getCompanyId()); |
| | | sysOrderFlowDao.insert(flow); |
| | | }else{ |
| | | LogUtil.info("不存在需要同步的产品"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | #线上测试环境 |
| | | |
| | | #spring.datasource.username=ct_test |
| | | #spring.datasource.password=123456 |
| | | #spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 |
| | | spring.datasource.username=ct_test |
| | | spring.datasource.password=123456 |
| | | spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 |
| | | |
| | | spring.datasource.username=chuhuan |
| | | spring.datasource.password=chuhuan |
| | | spring.datasource.url=jdbc:mysql://121.37.162.173:3306/hive_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 |
| | | |
| | | |
| | | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
| | |
| | | <result property="tag" column="tag"/> |
| | | <result property="isUsing" column="is_using"/> |
| | | <result property="kind" column="kind"/> |
| | | <result property="companyId" column="company_id"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectUsableCouponByProductInfo" resultMap="WxShopCouponMap"> |
| | |
| | | select * |
| | | from shop_coupon |
| | | where |
| | | kind=2 and now() >= begin_time and end_time >= now() |
| | | company_id=#{companyId} |
| | | and kind=2 and now() >= begin_time and end_time >= now() |
| | | and is_open = 1 |
| | | and (is_all = 1 or |
| | | ( |
| | |
| | | ifnull(scr.is_using, 0) is_using |
| | | from shop_coupon sc left join shop_coupon_record scr |
| | | on sc.id = scr.c_id and user_id = #{userId} |
| | | where sc.shop_id=#{shopId} and sc.kind=1 and now() >= begin_time and end_time >= now() and is_open = 1 |
| | | where sc.company_id=#{companyId} and sc.kind=1 and now() >= begin_time and end_time >= now() and is_open = 1 |
| | | <!--<if test="!isNewPeople">--> |
| | | <!--and get_limit = 1--> |
| | | <!--</if>--> |
| | |
| | | sc.min_amount minAmount, sc.offset_amount offsetAmount, sc.is_all isAll, |
| | | sc.product_ids productIds, sc.attr_ids attrIds, scr.is_using isUsing |
| | | from shop_coupon sc, shop_coupon_record scr |
| | | where sc.shop_id=#{shopId} and sc.id = scr.c_id and scr.user_id = #{userId} and is_using = #{status} |
| | | where sc.company_id=#{companyId} and sc.id = scr.c_id and scr.user_id = #{userId} and is_using = #{status} |
| | | and is_open = 1 |
| | | <if test="status == 2"> |
| | | and now() >= begin_time and end_time >= now() |
| | |
| | | sc.min_amount minAmount, sc.offset_amount offsetAmount, sc.is_all isAll, |
| | | sc.product_ids productIds, sc.attr_ids attrIds, scr.is_using isUsing |
| | | from shop_coupon sc, shop_coupon_record scr |
| | | where sc.shop_id=#{shopId} and sc.id = scr.c_id and scr.user_id = #{userId} |
| | | where sc.company_id=#{companyId} and sc.id = scr.c_id and scr.user_id = #{userId} |
| | | and (isnull(order_id) or order_id = 0) |
| | | and now() > end_time and is_open = 1 |
| | | <if test="pageVo != null"><!-- 判断pageVo对象是否为空 --> |
| | |
| | | <!--<span class="text-danger">*</span>--> |
| | | </label> |
| | | <div class="col-sm-4"> |
| | | <input autocomplete="off" type="text" class="form-control" name="tag" |
| | | ignore="ignore" |
| | | th:value="${obj.tag}"nullmsg="优惠券名称不能为空"> |
| | | <select class="form-control" dataType="*" nullmsg="请选择" name="tag"> |
| | | <!-- <option value=''>请选择</option>--> |
| | | <option value='zqyhq' th:if="${obj.tag == 'zqyhq'}" selected>专区券</option> |
| | | <option value='zqyhq' th:unless="${obj.tag == 'zqyhq'}">专区券</option> |
| | | <option value='gmyhq' th:if="${obj.tag == 'gmyhq'}" selected>全场券</option> |
| | | <option value='gmyhq' th:unless="${obj.tag == 'gmyhq'}">全场券</option> |
| | | </select> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | |
| | | <div class="form-group mr-20 ml-20"> |
| | | <span class="serch-title">物流公司:</span> |
| | | <select class="form-control autoFull" style="width: 190px" |
| | | th:data-url="@{/wxapi/dataDictionary/getListByParentCode/kdgs}" data-value="typeCode" |
| | | th:data-url="@{/admin/customerDictionary/getListByParentCode/kdgs}" data-value="typeCode" |
| | | data-filed="typeName" name="logisticsCompanyCode"> |
| | | <option value=''>--请选择物流公司--</option> |
| | | </select> |