|
|
|
@ -352,17 +352,42 @@ public class CustomerService {
|
|
|
|
|
* @date 2020/05/24 13:46
|
|
|
|
|
*/
|
|
|
|
|
private void handleDelCustomer (TurnBackDTO turnBackDTOS) {
|
|
|
|
|
String customerUserId = turnBackDTOS.getWxData().getUserId();
|
|
|
|
|
if (StringUtils.isBlank(customerUserId)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
privilageCpUserDOMapper.deleteCount(customerUserId,turnBackDTOS.getUserId());
|
|
|
|
|
QueryWrapper<OpCustomer> customerQw = new QueryWrapper<>();
|
|
|
|
|
customerQw.eq("external_userid",customerUserId).last("limit 1");
|
|
|
|
|
OpCustomer customer = opCustomerDOMapper.selectOne(customerQw);
|
|
|
|
|
if (customer == null){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//店铺信息
|
|
|
|
|
PrivilageCpUserStoreDO poiStore = privilageCpUserStoreDOMapper.selectOneCpUser(turnBackDTOS.getUserId());
|
|
|
|
|
if (null == poiStore) {
|
|
|
|
|
//无店铺数据处理
|
|
|
|
|
log.error("无店铺数据处理 no store data : " + turnBackDTOS.toString());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QueryWrapper<PrivilageCpUserDO> cpUserQw = new QueryWrapper<>();
|
|
|
|
|
cpUserQw.eq("cp_user_id",turnBackDTOS.getUserId()).last("limit 1");
|
|
|
|
|
PrivilageCpUserDO privilageCpUserDO = privilageCpUserDOMapper.selectOne(cpUserQw);
|
|
|
|
|
|
|
|
|
|
QueryWrapper<PrivilageCpUserStoreDO> relationQw = new QueryWrapper<>();
|
|
|
|
|
relationQw.eq("customer_id",customer.getId()).eq("user_id",privilageCpUserDO.getId()).eq("type",3);
|
|
|
|
|
privilageCpUserStoreDOMapper.delete(relationQw);
|
|
|
|
|
}else{
|
|
|
|
|
String eaCode = turnBackDTOS.getEaCode();
|
|
|
|
|
PoiStoreStaff staff;
|
|
|
|
|
QueryWrapper<PoiStoreStaff> staffQw = new QueryWrapper<>();
|
|
|
|
|
if (StringUtils.isNotBlank(eaCode) && !"0".equals(eaCode)){
|
|
|
|
|
staffQw.eq("staff_code",eaCode).eq("type",4).eq("store_id",poiStore.getStoreId()).last("limit 1");
|
|
|
|
|
staff = poiStoreStaffDOMapper.selectOne(staffQw);
|
|
|
|
|
}else{
|
|
|
|
|
staffQw.eq("staff_code",turnBackDTOS.getUserId()).eq("type",1).eq("store_id",poiStore.getStoreId()).last("limit 1");
|
|
|
|
|
staff = poiStoreStaffDOMapper.selectOne(staffQw);
|
|
|
|
|
}
|
|
|
|
|
QueryWrapper<PrivilageCpUserStoreDO> relationQw = new QueryWrapper<>();
|
|
|
|
|
relationQw.eq("customer_id",customer.getId()).eq("user_id",staff.getId());
|
|
|
|
|
privilageCpUserStoreDOMapper.delete(relationQw);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|