| | |
| | | if (dto.getState() == 1 && goods.getClinicPurchasePrice() == null) { |
| | | return R.fail("操作失败,请设置供应商分佣比例后再启用"); |
| | | } |
| | | if (dto.getState() == 1 && goods.getStateUser() == 1 && user.getRoleType() == 4) { |
| | | if (dto.getState() == 1 && Objects.nonNull(goods.getStateUser()) && goods.getStateUser() == 1 && user.getRoleType() == 4) { |
| | | return R.fail("操作失败,平台禁用商品不可启用"); |
| | | } |
| | | if (user.getRoleType() == 1) { |
| | |
| | | if (goodsIds.isEmpty()){ |
| | | ShopCarVO shopCarVO = new ShopCarVO(); |
| | | shopCarVO.setTotalPrice(BigDecimal.ZERO); |
| | | shopCarVO.setList(new PageInfo<>()); |
| | | shopCarVO.setList(new ArrayList<>()); |
| | | return R.ok(shopCarVO); |
| | | } |
| | | TErpGoodsShopQuery tErpGoodsShopQuery = new TErpGoodsShopQuery(); |
| | | tErpGoodsShopQuery.setGoodsIds(goodsIds); |
| | | PageInfo<TErpGoodsVO> tErpGoodsVOPageInfo = erpGoodsService.pageShopList(tErpGoodsShopQuery); |
| | | List<TErpGoodsVO> records = tErpGoodsVOPageInfo.getRecords(); |
| | | for (TErpGoodsVO record : records) { |
| | | for (ShoppingCartItem cartItem : cacheList) { |
| | | if (cartItem.getId().equals(record.getId())) { |
| | | record.setNumber(cartItem.getNum()); |
| | | record.setPrice(record.getSalesAmount().multiply(new BigDecimal(record.getNumber())).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | } |
| | | } |
| | | // PageInfo<TErpGoodsVO> tErpGoodsVOPageInfo = erpGoodsService.pageShopList(tErpGoodsShopQuery); |
| | | // List<TErpGoodsVO> records = tErpGoodsVOPageInfo.getRecords(); |
| | | // for (TErpGoodsVO record : records) { |
| | | // for (ShoppingCartItem cartItem : cacheList) { |
| | | // if (cartItem.getId().equals(record.getId())) { |
| | | // record.setNumber(cartItem.getNum()); |
| | | // record.setPrice(record.getSalesAmount().multiply(new BigDecimal(record.getNumber())).setScale(2, RoundingMode.HALF_UP)); |
| | | // } |
| | | // } |
| | | // } |
| | | List<TErpGoodsVO> listAll = erpGoodsService.pageShopListAll(tErpGoodsShopQuery); |
| | | for (TErpGoodsVO record : listAll) { |
| | | for (ShoppingCartItem cartItem : cacheList) { |
| | |
| | | } |
| | | } |
| | | } |
| | | BigDecimal totalPrice = records.stream().map(TErpGoodsVO::getPrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | res.setList(tErpGoodsVOPageInfo); |
| | | BigDecimal totalPrice = listAll.stream().map(TErpGoodsVO::getPrice).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | res.setList(listAll); |
| | | res.setTotalPrice(totalPrice); |
| | | return R.ok(res); |
| | | } |
| | |
| | | String url = WxConstant.CREATE_CODE_URL.replace("ACCESS_TOKEN", accessToken); |
| | | // 发送请求 |
| | | try { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("path", "pages/invite/invite"); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("page", "pages/invite/invite"); |
| | | map.put("scene", "clinicId=" + crmClinic.getId()); |
| | | map.put("check_path", false); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | HttpEntity requestEntity = new HttpEntity(map, headers); |
| | |
| | | /** |
| | | * 生成小程序码地址 |
| | | */ |
| | | public static final String CREATE_CODE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN"; |
| | | public static final String CREATE_CODE_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN"; |
| | | |
| | | /** |
| | | * 高德地图坐标转换 |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("购物车返回VO") |
| | |
| | | private BigDecimal totalPrice; |
| | | |
| | | @ApiModelProperty("购物车") |
| | | private PageInfo<TErpGoodsVO> list; |
| | | private List<TErpGoodsVO> list; |
| | | } |
| | |
| | | |
| | | </select> |
| | | <select id="pageShopList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select t1.id,t1.cover,t1.low_purchase_quantity,t1.packing_unit_id,t1.sales_amount,t1.supplier_clinic_id,t2.supplier_name as supplier |
| | | ,t3.unit_name as packingUnitName |
| | | select t1.id,t1.cover,t1.goods_name,t1.low_purchase_quantity,t1.low_unit_id,t1.packing_unit_id, |
| | | t1.manufacturer,t1.sales_amount,t1.supplier_clinic_id,t2.supplier_name as supplier, |
| | | t3.unit_name as packingUnitName |
| | | from t_erp_goods t1 |
| | | left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id |
| | | left join t_erp_goods_unit t3 on t1.packing_unit_id = t3.id |
| | |
| | | |
| | | </select> |
| | | <select id="pageShopListAll" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select t1.id,t1.cover,t1.low_purchase_quantity,t1.packing_unit_id,t1.sales_amount,t1.supplier_clinic_id,t2.supplier_name as supplier |
| | | ,t3.unit_name as packingUnitName |
| | | select t1.id,t1.cover,t1.goods_name,t1.low_purchase_quantity,t1.low_unit_id,t1.packing_unit_id, |
| | | t1.manufacturer,t1.sales_amount,t1.supplier_clinic_id,t2.supplier_name as supplier, |
| | | t3.unit_name as packingUnitName |
| | | from t_erp_goods t1 |
| | | left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id |
| | | left join t_erp_goods_unit t3 on t1.packing_unit_id = t3.id |