public int save(AreaInfoQO qo) { AreaInfo record = new AreaInfo(); BeanUtils.copyProperties(qo, record); return dao.save(record); }
private MobileInfo getMobileInfoByApi(String mobile) { MobileInfo mobileInfo; // 这里是demo,并不是真实的接口 //String result = HttpUtil.get("http://demo.recharge.roncoo.com/getMobinfo.do?mobilenum={mobile}".replace("{mobile}", mobile)); String result = "18302045627|广东广州|移动"; // result = 18302045627|广东广州|移动 String[] results = result.split("\\|"); AreaInfo areaInfo = getByProvinceAndCity(results[1]); mobileInfo = new MobileInfo(); mobileInfo.setMobilePrefix(results[0].substring(0, 7)); mobileInfo.setProvinceCode(areaInfo.getProvinceCode()); mobileInfo.setCityCode(areaInfo.getCityCode()); mobileInfo.setAreaCode(areaInfo.getAreaCode()); mobileInfo.setCarrierName(results[2]); mobileInfo.setCarrierType(CarrierTypeEnum.getCode(results[2])); // 插入到库 mobileInfoDao.save(mobileInfo); return mobileInfo; }
public int save(ItemQO qo) { Item record = new Item(); BeanUtils.copyProperties(qo, record); // 商品编码=商品类型+运营商类型+销售地区+面值 record.setItemNo(getItemNo(qo)); record.setItemName(areaInfoDao.getByProvinceCode(qo.getSalesArea()).getProvinceName() + CarrierTypeEnum.getDesc(qo.getCarrierType()) + qo.getFacePrice() + ItemTypeEnum.getDesc(qo.getItemType()) + FlowScopeEnum.getDesc(qo.getFlowScope()) + FlowPackageTypeEnum.getDesc(qo.getFlowPackageType()) + FlowStreamTypeEnum.getDesc(qo.getFlowStreamType())); record.setCostPrice(BigDecimalUtils.integerMultiply(qo.getCostPrice())); record.setSalesPrice1(BigDecimalUtils.integerMultiply(qo.getSalesPrice1())); record.setSalesPrice2(BigDecimalUtils.integerMultiply(qo.getSalesPrice2())); record.setSalesPrice3(BigDecimalUtils.integerMultiply(qo.getSalesPrice3())); if (record.getSalesPrice1() < record.getSalesPrice2()) { throw new BaseException("销售价1不能低于销售价2"); } if (record.getSalesPrice2() < record.getSalesPrice3()) { throw new BaseException("销售价2不能低于销售价3"); } if (record.getSalesPrice3() < record.getCostPrice()) { throw new BaseException("销售价3不能低于成本价"); } record.setItemStatus(ItemStatusEnum.INIT.getCode()); return dao.save(record); }
public int updateById(AreaInfoQO qo) { AreaInfo record = new AreaInfo(); BeanUtils.copyProperties(qo, record); return dao.updateById(record); }