diff --git a/src/main/java/com/kiisoo/ic/customer/CustomerService.java b/src/main/java/com/kiisoo/ic/customer/CustomerService.java index 8c63d34..a9102de 100644 --- a/src/main/java/com/kiisoo/ic/customer/CustomerService.java +++ b/src/main/java/com/kiisoo/ic/customer/CustomerService.java @@ -38,6 +38,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.text.DateFormat; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; @@ -216,7 +217,11 @@ public class CustomerService { if(turnBackDTOS.getVipData() != null){ log.info("如果有vip数据就认为是vip客户然后绑定客户vip关系"); //有vip数据就不需要重新请求bsd的vip接口 - vipCheck(turnBackDTOS); + try { + vipCheck(turnBackDTOS); + } catch (ParseException e) { + e.printStackTrace(); + } } } @@ -224,7 +229,8 @@ public class CustomerService { * vip数据检验 * @param turnBackDTO vip数据 */ - private void vipCheck(TurnBackDTO turnBackDTO){ + private void vipCheck(TurnBackDTO turnBackDTO) throws ParseException { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); OpCustomer opCustomer = new OpCustomer(turnBackDTO.getName(),turnBackDTO.getPhone()); opCustomer.setUpdateBy(Constants.SYS_OPERATION); @@ -236,7 +242,7 @@ public class CustomerService { opVip1.setPhone(turnBackDTO.getVipData().getPhone()); opVip1.setName(turnBackDTO.getVipData().getName()); opVip1.setBirthday(turnBackDTO.getVipData().getBirthday()); - opVip1.setRegisterTime(new Date(turnBackDTO.getVipData().getRegisterTime())); + opVip1.setRegisterTime(simpleDateFormat.parse(turnBackDTO.getVipData().getRegisterTime())); if(opVip == null){ //数据库没有这个数据--新建数据 opVip1.setCreateBy(Constants.SYS_OPERATION); @@ -264,7 +270,7 @@ public class CustomerService { */ private void sellerCustomerRelation(OpCustomer opCustomer,String staffCode,long shopId,long sellerId){ QueryWrapper staf = new QueryWrapper(); - staf.eq("staff_code",staffCode); + staf.eq("staff_code",staffCode).last("limit 1");; PoiStoreStaff poiStoreStaff = poiStoreStaffDOMapper.selectOne(staf); QueryWrapper wrapper1 = new QueryWrapper<>(); wrapper1.eq("customer_id",opCustomer.getId()).eq("user_id",poiStoreStaff.getUserId()).eq("store_id",shopId).last("limit 1");