Commit 971eda99 authored by lee_mingzhu's avatar lee_mingzhu

fix bug

parent 803d5ac4
...@@ -200,7 +200,10 @@ public class InnerController { ...@@ -200,7 +200,10 @@ public class InnerController {
return JsonResult.buildErrorStateResult(null, null); return JsonResult.buildErrorStateResult(null, null);
} }
List<Contact> contacts = contactService.findByUserId(userId); List<Contact> contacts = contactService.findByUserId(userId);
return JsonResult.buildErrorStateResult(null, ContactRet.contacts2ContactRets(contacts)); if(null == contacts || contacts.size() == 0) {
return JsonResult.buildErrorStateResult(null, null);
}
return JsonResult.buildSuccessResult(null, ContactRet.contacts2ContactRets(contacts));
} }
@RequestMapping("/contact/save/contacts") @RequestMapping("/contact/save/contacts")
...@@ -257,6 +260,7 @@ public class InnerController { ...@@ -257,6 +260,7 @@ public class InnerController {
addressObj.setProvince(province); addressObj.setProvince(province);
addressObj.setCreatedAt(now); addressObj.setCreatedAt(now);
addressObj.setUpdateAt(now); addressObj.setUpdateAt(now);
addressService.saveAddress(addressObj);
return JsonResult.buildSuccessResult(null, AddressRet.address2AddressRet(addressObj)); return JsonResult.buildSuccessResult(null, AddressRet.address2AddressRet(addressObj));
} }
...@@ -273,6 +277,7 @@ public class InnerController { ...@@ -273,6 +277,7 @@ public class InnerController {
if (info == null) { if (info == null) {
Timestamp now = new Timestamp(System.currentTimeMillis()); Timestamp now = new Timestamp(System.currentTimeMillis());
info = new UserExtInfo(); info = new UserExtInfo();
info.setUserId(userId);
info.setCreatedAt(now); info.setCreatedAt(now);
info.setUpdateAt(now); info.setUpdateAt(now);
} }
......
...@@ -3,10 +3,7 @@ package cn.quantgroup.xyqb.entity; ...@@ -3,10 +3,7 @@ package cn.quantgroup.xyqb.entity;
import cn.quantgroup.xyqb.entity.enumerate.*; import cn.quantgroup.xyqb.entity.enumerate.*;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.sql.Timestamp;
...@@ -20,6 +17,7 @@ public class UserExtInfo implements Serializable { ...@@ -20,6 +17,7 @@ public class UserExtInfo implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id") @Column(name = "id")
private Long id; private Long id;
@Column(name = "user_id") @Column(name = "user_id")
......
...@@ -8,4 +8,5 @@ import cn.quantgroup.xyqb.entity.Address; ...@@ -8,4 +8,5 @@ import cn.quantgroup.xyqb.entity.Address;
public interface IAddressService { public interface IAddressService {
Address findByUserId(Long userId); Address findByUserId(Long userId);
Address saveAddress(Address address);
} }
package cn.quantgroup.xyqb.service.user.impl; package cn.quantgroup.xyqb.service.user.impl;
import cn.quantgroup.xyqb.entity.Address; import cn.quantgroup.xyqb.entity.Address;
import cn.quantgroup.xyqb.entity.UserExtInfo;
import cn.quantgroup.xyqb.repository.IAddressRepository; import cn.quantgroup.xyqb.repository.IAddressRepository;
import cn.quantgroup.xyqb.repository.IUserExtInfoRepository;
import cn.quantgroup.xyqb.service.user.IAddressService; import cn.quantgroup.xyqb.service.user.IAddressService;
import cn.quantgroup.xyqb.service.user.IUserExtInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -25,4 +22,8 @@ public class AddressServiceImpl implements IAddressService { ...@@ -25,4 +22,8 @@ public class AddressServiceImpl implements IAddressService {
return addressRepository.findByUserId(userId); return addressRepository.findByUserId(userId);
} }
@Override
public Address saveAddress(Address address) {
return addressRepository.save(address);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment