客户回调接口

master
Caps 6 years ago
parent 95f610d86d
commit 15c3296dec

@ -172,7 +172,11 @@ public class CustomerService {
insertCustomer.setWechatUniId(turnBackDTOS.getWx_data().getUnit_id()); insertCustomer.setWechatUniId(turnBackDTOS.getWx_data().getUnit_id());
insertCustomer.setName(turnBackDTOS.getName()); insertCustomer.setName(turnBackDTOS.getName());
insertCustomer.setAvatarUrl(turnBackDTOS.getWx_data().getAvatar_url()); insertCustomer.setAvatarUrl(turnBackDTOS.getWx_data().getAvatar_url());
insertCustomer.setPhone(turnBackDTOS.getPhone());
if(null != opCustomer){ if(null != opCustomer){
//更新一下
insertCustomer.setId(opCustomer.getId());
opCustomerDOMapper.updateById(insertCustomer);
//存在--1.处理客户导购关系。 //存在--1.处理客户导购关系。
sellerCustomerRelation(opCustomer,turnBackDTOS.getEa_code(),poiStore.getId(),poiStoreStaff.getUserId()); sellerCustomerRelation(opCustomer,turnBackDTOS.getEa_code(),poiStore.getId(),poiStoreStaff.getUserId());
}else { }else {
@ -211,22 +215,24 @@ public class CustomerService {
QueryWrapper<OpVip> wrapper = new QueryWrapper<>(); QueryWrapper<OpVip> wrapper = new QueryWrapper<>();
wrapper.eq("phone",vipDataDTO.getPhone()).eq("name",vipDataDTO.getName()); wrapper.eq("phone",vipDataDTO.getPhone()).eq("name",vipDataDTO.getName());
OpVip opVip = opVipDOMapper.selectOne(wrapper); OpVip opVip = opVipDOMapper.selectOne(wrapper);
OpVip opVip1 = new OpVip();
opVip1.setStatus(1L);
opVip1.setPhone(vipDataDTO.getPhone());
opVip1.setName(vipDataDTO.getName());
opVip1.setBirthday(vipDataDTO.getBirthday());
opVip1.setRegisterTime(new Date(vipDataDTO.getRegister_time()));
if(opVip == null){ if(opVip == null){
//数据库没有这个数据--新建数据 //数据库没有这个数据--新建数据
OpVip opVip1 = new OpVip();
opVip1.setStatus(1L);
opVip1.setPhone(vipDataDTO.getPhone());
opVip1.setName(vipDataDTO.getName());
opVip1.setBirthday(vipDataDTO.getBirthday());
opVip1.setRegisterTime(new Date(vipDataDTO.getRegister_time()));
opVip1.setCreateTime(new Date()); opVip1.setCreateTime(new Date());
opVip1.setUpdateTime(new Date());
opVip1.setCreateBy(Constants.SYS_OPERATION); opVip1.setCreateBy(Constants.SYS_OPERATION);
opVip1.setUpdateBy(Constants.SYS_OPERATION);
opVipDOMapper.insert(opVip1); opVipDOMapper.insert(opVip1);
//有vip信息就绑定信息 //有vip信息就绑定信息
opCustomer.setMemberId(opVip1.getId()); opCustomer.setMemberId(opVip1.getId());
}else { }else {
opVip1.setId(opVip.getId());
opVip1.setUpdateTime(new Date());
opVip1.setUpdateBy(Constants.SYS_OPERATION);
opVipDOMapper.updateById(opVip1);
//有vip信息就绑定信息 //有vip信息就绑定信息
opCustomer.setMemberId(opVip.getId()); opCustomer.setMemberId(opVip.getId());
} }
@ -246,22 +252,24 @@ public class CustomerService {
QueryWrapper<OpVip> wrapper = new QueryWrapper<>(); QueryWrapper<OpVip> wrapper = new QueryWrapper<>();
wrapper.eq("phone",turnBackDTO.getVip_data().getPhone()).eq("name",turnBackDTO.getVip_data().getName()); wrapper.eq("phone",turnBackDTO.getVip_data().getPhone()).eq("name",turnBackDTO.getVip_data().getName());
OpVip opVip = opVipDOMapper.selectOne(wrapper); OpVip opVip = opVipDOMapper.selectOne(wrapper);
OpVip opVip1 = new OpVip();
opVip1.setStatus(1L);
opVip1.setPhone(turnBackDTO.getVip_data().getPhone());
opVip1.setName(turnBackDTO.getVip_data().getName());
opVip1.setBirthday(turnBackDTO.getVip_data().getBirthday());
opVip1.setRegisterTime(new Date(turnBackDTO.getVip_data().getRegister_time()));
if(opVip == null){ if(opVip == null){
//数据库没有这个数据--新建数据 //数据库没有这个数据--新建数据
OpVip opVip1 = new OpVip();
opVip1.setStatus(1L);
opVip1.setPhone(turnBackDTO.getVip_data().getPhone());
opVip1.setName(turnBackDTO.getVip_data().getName());
opVip1.setBirthday(turnBackDTO.getVip_data().getBirthday());
opVip1.setRegisterTime(new Date(turnBackDTO.getVip_data().getRegister_time()));
opVip1.setCreateTime(new Date());
opVip1.setUpdateTime(new Date());
opVip1.setCreateBy(Constants.SYS_OPERATION); opVip1.setCreateBy(Constants.SYS_OPERATION);
opVip1.setUpdateBy(Constants.SYS_OPERATION); opVip1.setCreateTime(new Date());
opVipDOMapper.insert(opVip1); opVipDOMapper.insert(opVip1);
//有vip信息就绑定信息 //有vip信息就绑定信息
opCustomer.setMemberId(opVip1.getId()); opCustomer.setMemberId(opVip1.getId());
}else { }else {
opVip1.setId(opVip.getId());
opVip1.setUpdateTime(new Date());
opVip1.setUpdateBy(Constants.SYS_OPERATION);
opVipDOMapper.updateById(opVip1);
//有vip信息就绑定信息 //有vip信息就绑定信息
opCustomer.setMemberId(opVip.getId()); opCustomer.setMemberId(opVip.getId());
} }

@ -1,5 +1,7 @@
package com.kiisoo.ic.synchronous.controller; package com.kiisoo.ic.synchronous.controller;
import com.alibaba.fastjson.JSON;
import com.google.gson.JsonObject;
import com.kiisoo.ic.customer.CustomerService; import com.kiisoo.ic.customer.CustomerService;
import com.kiisoo.ic.store.entity.PoiStore; import com.kiisoo.ic.store.entity.PoiStore;
import com.kiisoo.ic.synchronous.entity.TurnBackDTO; import com.kiisoo.ic.synchronous.entity.TurnBackDTO;
@ -64,10 +66,12 @@ public class SynchronousController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/ics/customer",method = RequestMethod.POST) @RequestMapping(value = "/ics/customer",method = RequestMethod.POST,consumes = "Application/json")
@ResponseBody @ResponseBody
public String turnBack(@RequestBody TurnBackDTO turnBackDTOS){ public String turnBack(@RequestBody List<TurnBackDTO> turnBackDTOS){
customerService.turnBack(turnBackDTOS); String str = JSON.toJSONString(turnBackDTOS);
System.out.println(str);
turnBackDTOS.forEach(customerService::turnBack);
return DataImportUtil.succ(1); return DataImportUtil.succ(1);
} }
} }

@ -1,5 +1,7 @@
package com.kiisoo.ic.synchronous.entity; package com.kiisoo.ic.synchronous.entity;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
/** /**
@ -39,7 +41,7 @@ public class TurnBackDTO {
/** /**
* *
*/ */
private Date join_time; private String join_time;
/** /**
* id * id
@ -91,11 +93,11 @@ public class TurnBackDTO {
this.phone = phone; this.phone = phone;
} }
public Date getJoin_time() { public String getJoin_time() {
return join_time; return join_time;
} }
public void setJoin_time(Date join_time) { public void setJoin_time(String join_time) {
this.join_time = join_time; this.join_time = join_time;
} }
@ -114,4 +116,8 @@ public class TurnBackDTO {
public void setVip_data(VipDataDTO vip_data) { public void setVip_data(VipDataDTO vip_data) {
this.vip_data = vip_data; this.vip_data = vip_data;
} }
//
// public Date getJoinTime() {
// return LocalDate.parse(this.join_time);
// }
} }

Loading…
Cancel
Save