|
|
@ -4,16 +4,20 @@ package org.jeecg.modules.system.controller; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.google.common.base.Joiner; |
|
|
|
import com.google.common.base.Joiner; |
|
|
|
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.apache.shiro.SecurityUtils; |
|
|
|
import org.aspectj.apache.bcel.generic.RET; |
|
|
|
import org.aspectj.apache.bcel.generic.RET; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
import org.jeecg.common.constant.CommonConstant; |
|
|
|
import org.jeecg.common.constant.CommonConstant; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.modules.base.service.BaseCommonService; |
|
|
|
import org.jeecg.modules.base.service.BaseCommonService; |
|
|
|
import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; |
|
|
|
import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; |
|
|
|
import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; |
|
|
|
import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.customerreceivingaddress.entity.CustomerReceivingAddress; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.customerreceivingaddress.service.ICustomerReceivingAddressService; |
|
|
|
import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; |
|
|
|
import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; |
|
|
|
import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; |
|
|
|
import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; |
|
|
|
import org.jeecg.modules.demo.zygoods.entity.ZyGoods; |
|
|
|
import org.jeecg.modules.demo.zygoods.entity.ZyGoods; |
|
|
@ -52,6 +56,9 @@ public class ApeopersionController { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ICustomerShoppingCartService customerShoppingCartService; |
|
|
|
private ICustomerShoppingCartService customerShoppingCartService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ICustomerReceivingAddressService customerReceivingAddressService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
个人中心,我的账户的数据获取 |
|
|
|
个人中心,我的账户的数据获取 |
|
|
@ -160,4 +167,66 @@ public class ApeopersionController { |
|
|
|
return Result.ok("添加完成"); |
|
|
|
return Result.ok("添加完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//个人中心的收货地址的首页需要的数据
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getaddress", method = RequestMethod.GET) |
|
|
|
|
|
|
|
public Result<?> getaddress() { |
|
|
|
|
|
|
|
//这里方便获取当前登陆信息
|
|
|
|
|
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
|
|
|
//这里获取当前登陆的id
|
|
|
|
|
|
|
|
String userid = loginUser.getId(); |
|
|
|
|
|
|
|
Integer usersex = loginUser.getSex(); |
|
|
|
|
|
|
|
//这个是根据用户id查收货地址
|
|
|
|
|
|
|
|
List<CustomerReceivingAddress> cra =customerReceivingAddressService.getcra(userid); |
|
|
|
|
|
|
|
for (int i=0;i<cra.size();i++) { |
|
|
|
|
|
|
|
cra.get(i).setSysOrgCode(usersex.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Result.ok(cra); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 通过id删除 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param id |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@AutoLog(value = "顾客地址表-通过id删除") |
|
|
|
|
|
|
|
@ApiOperation(value="顾客地址表-通过id删除", notes="顾客地址表-通过id删除") |
|
|
|
|
|
|
|
@DeleteMapping(value = "/deleteadd") |
|
|
|
|
|
|
|
public Result<?> deleteadd(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
|
|
|
customerReceivingAddressService.removeById(id); |
|
|
|
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getaddressbyid", method = RequestMethod.GET) |
|
|
|
|
|
|
|
public Result<?> getaddressbyid(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
|
|
|
System.out.println(id); |
|
|
|
|
|
|
|
/*return Result.ok("");*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/sdqx", method = RequestMethod.GET) |
|
|
|
|
|
|
|
public Result<?> sdqx(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
|
|
|
//根据id查询需要设置成默认收货地址的收货地址
|
|
|
|
|
|
|
|
CustomerReceivingAddress cus = customerReceivingAddressService.getById(id); |
|
|
|
|
|
|
|
String userid = cus.getUserId(); |
|
|
|
|
|
|
|
Integer sort = cus.getSort(); |
|
|
|
|
|
|
|
//开始寻找之前的默认地址
|
|
|
|
|
|
|
|
CustomerReceivingAddress cusm = customerReceivingAddressService.getneed(userid); |
|
|
|
|
|
|
|
//如果没有默认地址
|
|
|
|
|
|
|
|
if (cusm==null){ |
|
|
|
|
|
|
|
customerReceivingAddressService.updatesetneed(id); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
//这个是更新默认地址
|
|
|
|
|
|
|
|
customerReceivingAddressService.updatec(cusm.getId(),sort); |
|
|
|
|
|
|
|
customerReceivingAddressService.updates(id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result.OK("成功!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|