/** * 保存店铺周边 * * @param dealerShopEnv */ @Override public void save(DealerShopEnv dealerShopEnv) { if (StringUtils.isNotBlank(dealerShopEnv.getRefrenceId())) { dealerShopEnv.setUpdateTime(CalendarUtils.getCurrentLong()); this.updateByPrimaryKeySelective(dealerShopEnv); } else { dealerShopEnv.setCreateTime(CalendarUtils.getCurrentLong()); dealerShopEnv.setUpdateTime(CalendarUtils.getCurrentLong()); this.insertSelective(dealerShopEnv); } }
/** * @param dealerId * @throws BusinessException */ @Override public void addTrialErpDealerBuyService(String dealerId) throws BusinessException { Map<String, Object> params = Maps.newHashMap(); DealerInfo dealerInfo = dealerInfoService.selectByPrimaryKey(dealerId); UserInfo dealerUserm = userInfoService.selectByPrimaryKey(dealerId); params.put("dealerId", dealerId); params.put("dealerName", dealerInfo.getDealerName()); params.put("dealerMobile", dealerUserm.getUserMobile()); params.put("dealerUser", dealerInfo.getDealerUser()); params.put( "dealerMail", StringUtils.isEmpty(dealerUserm.getUserMail()) ? "*****@*****.**" : dealerUserm.getUserMail()); params.put( "dealerSex", dealerInfo.getDealerGender() == null ? 1 : (dealerInfo.getDealerGender() == 2 ? 1 : 0)); params.put("dealerKey", dealerId); params.put( "outOfTime", com.zttx.web.utils.CalendarUtils.addDay( com.zttx.web.utils.CalendarUtils.getCurrentLong(), 60)); params.put("userName", dealerUserm.getUserMobile()); JSONObject _resJson = AppParameterUtils.getErpTrailJSONObject(params); if (_resJson == null || !_resJson.containsKey("code") || _resJson.getIntValue("code") != 121000) { throw new BusinessException("ERP 接口调用失败"); } DealerBuyService _dealerBuyService = this.findBy(dealerId, CommonConstant.WebServiceItems.SERVICE_SYSTEM_STIALERP); if (_dealerBuyService != null) { throw new BusinessException("ERP试用服务已经开通,请刷页面!"); } _dealerBuyService = new DealerBuyService(); _dealerBuyService.setBeginTime(CalendarUtils.getCurrentLong()); _dealerBuyService.setEndTime( CalendarUtils.addDay(com.zttx.web.utils.CalendarUtils.getCurrentLong(), 60)); _dealerBuyService.setBuyTime(CalendarUtils.getCurrentLong()); _dealerBuyService.setServiceId(CommonConstant.WebServiceItems.SERVICE_SYSTEM_STIALERP); _dealerBuyService.setServicerCate(Short.valueOf("1")); _dealerBuyService.setChargType(Short.valueOf("1")); _dealerBuyService.setBuyMoney(BigDecimal.ZERO); _dealerBuyService.setRefrenceId(SerialnoUtils.buildPrimaryKey()); _dealerBuyService.setDealerId(dealerId); this.insertSelective(_dealerBuyService); // DealerInfo的服务起起时间 dealerInfo.setBeginTime(CalendarUtils.getCurrentLong()); dealerInfo.setEndTime( CalendarUtils.addDay(com.zttx.web.utils.CalendarUtils.getCurrentLong(), 60)); dealerInfoService.updateByPrimaryKeySelective(dealerInfo); }
/** * 新增/修改(第三方调用,会同时维护经销商购买的服务表) * * @param dealerBuySerLog refrenceId 经销商购买的服务表的主键(由第三方调用者提供) dealerBuyServiceId * 经销商购买的服务的主键(由第三方调用者提供,若记录不存在:新增、记录已存在:修改) dealerId 经销商编号(必填) dealerName 经销商名称 serviceId * 服务编号(必填) servicerCate 服务类别(读字典:字典编码 servicerCate)(必填) buyNum 购买数量(必填) buyMoney 购买的金额(必填) * chargType 购买类型(1:续期、2:增加数量)(必填) beginTime 服务开始时间 endTime 服务结束时间 * @author 周光暖 */ @Override public DealerBuyService saveByClient(DealerBuySerLog dealerBuySerLog) throws BusinessException { DealerBuyService dealerBuyService = builtDealerBuyService(dealerBuySerLog); // 判断服务是否存在 if (!webServiceItemsService.isExist( dealerBuySerLog.getServiceId(), dealerBuySerLog.getServicerCate(), dealerBuySerLog.getChargType())) { throw new BusinessException(ClientConst.PARAMERROR.code, "网站服务不存在"); } DealerBuyService dbDealerBuyService = this.findBy(dealerBuySerLog.getDealerId(), dealerBuySerLog.getServiceId()); if (null == dbDealerBuyService) { dealerBuyService.setRefrenceId(SerialnoUtils.buildPrimaryKey()); dealerBuyService.setCreateTime(CalendarUtils.getCurrentLong()); this.handChargType(dealerBuyService, null); this.insertSelective(dealerBuyService); } else { dealerBuyService.setRefrenceId(dbDealerBuyService.getRefrenceId()); this.handChargType(dealerBuyService, dbDealerBuyService); dealerBuyService.setBuyMoney( dealerBuyService.getBuyMoney().add(dbDealerBuyService.getBuyMoney())); this.updateByPrimaryKeySelective(dealerBuyService); } dealerBuySerLog.setBuyTime(dealerBuyService.getBuyTime()); dealerBuySerLog.setEndTime(dealerBuyService.getEndTime()); dealerBuySerLogService.createDealerBuySerLog(dealerBuySerLog); return dealerBuyService; }
/** * 批量保存品牌权重 * * @param param * @return * @throws Exception */ @ResponseBody @RequestMapping(value = "/batchSave", method = RequestMethod.POST) @Deprecated public JsonMessage batchSave(ClientParameter param) { Map<String, String> map = ParameterUtils.getMapFromParameter(param); String data = MapUtils.getString(map, "dataList", ""); List<BrandesWeightInfo> brandesWeightInfos = ParameterUtils.getListObjectFromParameter(data, BrandesWeightInfo.class); JsonMessage jsonMessage = super.getJsonMessage(CommonConst.SUCCESS); try { for (BrandesWeightInfo brandesWeightInfo : brandesWeightInfos) { if (!beanValidator(jsonMessage, brandesWeightInfo)) { return jsonMessage; } brandesWeightInfo.setUpdateTime(CalendarUtils.getCurrentLong()); brandesWeightInfoService.updateByPrimaryKeySelective(brandesWeightInfo); BrandesInfo filter1 = new BrandesInfo(); filter1.setRefrenceId(brandesWeightInfo.getBrandesId()); // 修改品牌索引 brandeSolrHandler.addBrandsInfoList( brandesInfoService.findBrandesInfoToSolr(filter1, null)); // 修改旗下产品索引 ProductInfo filter2 = new ProductInfo(); filter2.setBrandsId(brandesWeightInfo.getBrandesId()); List<ProductInfo> productInfos = productInfoService.findProductToSolr(filter2, null); productSolrHandler.addProductInfoList(productInfos); } } catch (BusinessException e) { logger.error("品牌权重接口,调用保存失败: " + e.getMessage()); return this.getJsonMessage(e.getErrorCode()); } return jsonMessage; }
private DealerBuyService builtDealerBuyService(DealerBuySerLog dealerBuySerLog) { DealerBuyService dealerBuyService = new DealerBuyService(); dealerBuyService.setDealerId(dealerBuySerLog.getDealerId()); dealerBuyService.setDealerName(dealerBuySerLog.getDealerName()); dealerBuyService.setServiceId(dealerBuySerLog.getServiceId()); dealerBuyService.setServicerCate(dealerBuySerLog.getServicerCate()); dealerBuyService.setChargType(dealerBuySerLog.getChargType()); dealerBuyService.setBuyTime(CalendarUtils.getCurrentLong()); dealerBuyService.setBeginTime(dealerBuySerLog.getBeginTime()); dealerBuyService.setBuyMoney(dealerBuySerLog.getBuyMoney()); return dealerBuyService; }