|
@ -10,17 +10,17 @@ import com.yxt.common.base.service.MybatisBaseService; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
import com.yxt.common.base.utils.StringUtils; |
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
|
|
import com.yxt.common.core.result.FileUploadResult; |
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.yythmall.api.lpkcustomer.LpkCustomer; |
|
|
import com.yxt.yythmall.api.lpkcustomer.*; |
|
|
import com.yxt.yythmall.api.lpkcustomer.LpkCustomerQuery; |
|
|
|
|
|
import com.yxt.yythmall.api.lpkcustomer.LpkCustomerVo; |
|
|
|
|
|
import com.yxt.yythmall.api.lpkcustomer.WxBindMobileDto; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestPart; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
@ -97,20 +97,34 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp |
|
|
newCustomer.setWxMpOpenid(openid); |
|
|
newCustomer.setWxMpOpenid(openid); |
|
|
// newCustomer.setUnionId(unionid);
|
|
|
// newCustomer.setUnionId(unionid);
|
|
|
newCustomer.setCreateTime(new Date()); |
|
|
newCustomer.setCreateTime(new Date()); |
|
|
|
|
|
newCustomer.setPhoto("headImage.jpg"); |
|
|
|
|
|
newCustomer.setNick("小菜窖000"+newCustomer.getId()); |
|
|
baseMapper.insert(newCustomer); |
|
|
baseMapper.insert(newCustomer); |
|
|
// return rb.setData(newCustomer).setCode("110");
|
|
|
// return rb.setData(newCustomer).setCode("110");
|
|
|
StpUtil.login(newCustomer.getId()); |
|
|
StpUtil.login(newCustomer.getId()); |
|
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo(); |
|
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo(); |
|
|
newCustomer.setToken(tokenInfo.getTokenValue()); |
|
|
newCustomer.setToken(tokenInfo.getTokenValue()); |
|
|
|
|
|
|
|
|
return rb.success().setData(newCustomer); |
|
|
return rb.success().setData(newCustomer); |
|
|
} |
|
|
} |
|
|
// //判断是否绑定手机号
|
|
|
// //判断是否绑定手机号
|
|
|
// if(StringUtils.isBlank(lpkCustomer.getMobile())){
|
|
|
// if(StringUtils.isBlank(lpkCustomer.getMobile())){
|
|
|
// return rb.setData(lpkCustomer).setCode("110");
|
|
|
// return rb.setData(lpkCustomer).setCode("110");
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
if(StringUtils.isBlank(lpkCustomer.getPhoto())){ |
|
|
|
|
|
lpkCustomer.setPhoto("headImage.jpg"); |
|
|
|
|
|
baseMapper.updateById(lpkCustomer); |
|
|
|
|
|
lpkCustomer = fetchBySid(lpkCustomer.getSid()); |
|
|
|
|
|
} |
|
|
|
|
|
if(StringUtils.isBlank(lpkCustomer.getNick())){ |
|
|
|
|
|
lpkCustomer.setNick("小菜窖000"+lpkCustomer.getId()); |
|
|
|
|
|
baseMapper.updateById(lpkCustomer); |
|
|
|
|
|
lpkCustomer = fetchBySid(lpkCustomer.getSid()); |
|
|
|
|
|
} |
|
|
StpUtil.login(lpkCustomer.getId()); |
|
|
StpUtil.login(lpkCustomer.getId()); |
|
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo(); |
|
|
SaTokenInfo tokenInfo = StpUtil.getTokenInfo(); |
|
|
lpkCustomer.setToken(tokenInfo.getTokenValue()); |
|
|
lpkCustomer.setToken(tokenInfo.getTokenValue()); |
|
|
|
|
|
|
|
|
return rb.success().setData(lpkCustomer); |
|
|
return rb.success().setData(lpkCustomer); |
|
|
} |
|
|
} |
|
|
public ResultBean wxBindMobile(WxBindMobileDto wxBindMobileDto) { |
|
|
public ResultBean wxBindMobile(WxBindMobileDto wxBindMobileDto) { |
|
@ -155,4 +169,48 @@ public class LpkCustomerService extends MybatisBaseService<LpkCustomerMapper, Lp |
|
|
} |
|
|
} |
|
|
return rb.success().setData(p); |
|
|
return rb.success().setData(p); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean modifyHeadImage(String userSid,MultipartFile file) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
LpkCustomer lpkCustomer= fetchBySid(userSid); |
|
|
|
|
|
if(lpkCustomer == null){ |
|
|
|
|
|
return rb.setMsg("该客户信息不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
if (file == null || file.isEmpty()) { |
|
|
|
|
|
return rb.setMsg("文件为空"); |
|
|
|
|
|
} |
|
|
|
|
|
ResultBean<FileUploadResult> resultBean =fileUploadComponent.uploadFile(file,null); |
|
|
|
|
|
FileUploadResult fileUploadResult = resultBean.getData(); |
|
|
|
|
|
if(fileUploadResult != null && StringUtils.isNotBlank(fileUploadResult.getFullUrl())){ |
|
|
|
|
|
if(fileUploadResult.getFullUrl().contains(fileUploadComponent.getUrlPrefix())){ |
|
|
|
|
|
String headImageUrl = fileUploadResult.getFullUrl().replace(fileUploadComponent.getUrlPrefix(),""); |
|
|
|
|
|
lpkCustomer.setPhoto(headImageUrl); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.updateById(lpkCustomer); |
|
|
|
|
|
return rb.success().setData(fileUploadComponent.getUrlPrefix()+lpkCustomer.getPhoto()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean modifyUserNickName(String userSid, String userNickName) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
LpkCustomer lpkCustomer= fetchBySid(userSid); |
|
|
|
|
|
if(lpkCustomer == null){ |
|
|
|
|
|
return rb.setMsg("该客户信息不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
lpkCustomer.setNick(userNickName); |
|
|
|
|
|
baseMapper.updateById(lpkCustomer); |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean<CustomerInfoVo> getCustomerInfos(String userSid) { |
|
|
|
|
|
ResultBean<CustomerInfoVo> rb = ResultBean.fireFail(); |
|
|
|
|
|
LpkCustomer lpkCustomer= fetchBySid(userSid); |
|
|
|
|
|
if(lpkCustomer == null){ |
|
|
|
|
|
return rb.setMsg("该客户信息不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
CustomerInfoVo customerInfoVo = baseMapper.getCustomerInfos(userSid); |
|
|
|
|
|
String photo = fileUploadComponent.getUrlPrefix()+customerInfoVo.getPhoto(); |
|
|
|
|
|
customerInfoVo.setPhoto(photo); |
|
|
|
|
|
return rb.success().setData(customerInfoVo); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|