7 changed files with 116 additions and 35 deletions
@ -0,0 +1,40 @@ |
|||||
|
package cn.chjyj.szwh.controller.api; |
||||
|
|
||||
|
import cn.chjyj.szwh.controller.BaseController; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import org.apache.commons.logging.Log; |
||||
|
import org.apache.commons.logging.LogFactory; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* API端产品信息 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/api/Goods") |
||||
|
public class GoodsController extends BaseController { |
||||
|
private static Log log = LogFactory.getLog(GoodsController.class); |
||||
|
|
||||
|
/** |
||||
|
* 添加到购物车 |
||||
|
* only support POST method |
||||
|
* @param userIsli |
||||
|
* @param goodsIsli |
||||
|
* @param useYears |
||||
|
* @return |
||||
|
*/ |
||||
|
@RequestMapping(value = "/addShoppingCar",method = RequestMethod.POST) |
||||
|
public JSONObject addShoppingCar(@RequestParam("user_isli") String userIsli, |
||||
|
@RequestParam("goods_isli") String goodsIsli, |
||||
|
@RequestParam("use_years") String useYears){ |
||||
|
|
||||
|
// $goodsService = new GoodsService();
|
||||
|
// $this->apilog->info("添加购物车", Request()->param());
|
||||
|
// $goodsService->addShoppingCar($user_isli, $goods_isli, $use_years);
|
||||
|
// return _success('成功');
|
||||
|
jsonObject.put("msg","成功"); |
||||
|
return jsonObject; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package cn.chjyj.szwh.service; |
||||
|
|
||||
|
/** |
||||
|
* 购物车服务接口 |
||||
|
* xy |
||||
|
*/ |
||||
|
public interface ShopCarService { |
||||
|
/** |
||||
|
* |
||||
|
* @param userIsli user_isli 用户isli标识码 |
||||
|
* @param goodsIsli goods_isli 商品isli标识码 |
||||
|
* @param useYears use_years 购买使用年限 |
||||
|
* @return |
||||
|
*/ |
||||
|
int addShopCart(String userIsli,String goodsIsli,String useYears); |
||||
|
|
||||
|
/** |
||||
|
* 删除回收站 |
||||
|
* @param userIsli |
||||
|
* @param goodsIsli |
||||
|
* @return |
||||
|
*/ |
||||
|
int delShoppingCar(String userIsli,String goodsIsli); |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package cn.chjyj.szwh.service.impl; |
||||
|
|
||||
|
import cn.chjyj.szwh.service.ShopCarService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class ShopCarServiceImpl implements ShopCarService { |
||||
|
@Override |
||||
|
public int addShopCart(String userIsli, String goodsIsli, String useYears) { |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int delShoppingCar(String userIsli, String goodsIsli) { |
||||
|
return 0; |
||||
|
} |
||||
|
} |
||||
@ -1,29 +0,0 @@ |
|||||
package cn.chjyj.szwh.utils; |
|
||||
|
|
||||
import org.apache.http.client.utils.DateUtils; |
|
||||
import org.springframework.util.CollectionUtils; |
|
||||
import org.springframework.util.StringUtils; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @author xie.xinquan |
|
||||
* @create 2022/6/13 13:54 |
|
||||
* @company 深圳亿起融网络科技有限公司 |
|
||||
*/ |
|
||||
public class DateUtil { |
|
||||
|
|
||||
private static final String dateFormat = "yyyy-MM-dd"; |
|
||||
private static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; |
|
||||
|
|
||||
public static Date[] dateRangeConvert(List<String> list) { |
|
||||
Date[] result = new Date[2]; |
|
||||
if (!CollectionUtils.isEmpty(list) && list.size() == 2 && list.stream().filter(s -> StringUtils.isEmpty(s)).count() == 0) { |
|
||||
String start = list.get(0); |
|
||||
result[0] = DateUtils.parseDate(start + " 00:00:00", new String[]{dateTimeFormat}); |
|
||||
result[1] = DateUtils.parseDate(list.get(1) + " 23:59:59", new String[]{dateTimeFormat}); |
|
||||
} |
|
||||
return result; |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue