联系地址

pull/451/head
starrysky 2019-08-18 11:50:02 +08:00
parent f0d5fd27e9
commit d2304e60d5
11 changed files with 147 additions and 15 deletions

View File

@ -49,7 +49,7 @@ public class SupplierInfo implements Serializable {
@Column(name = "remark") @Column(name = "remark")
private String remark; private String remark;
// 供应商地址地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}] // 供应商地址地址数组[{“province”:””,”city”:””,”area”:””,”addressDetail”:””,”sort”:””}]
@Column(name = "supplier_address") @Column(name = "supplier_address")
private String supplierAddress; private String supplierAddress;

View File

@ -0,0 +1,57 @@
package me.zhengjie.modules.wms.bd.request;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;
import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;
/**
* @author
* @date 2019-08-18
*/
@Data
public class CreateSupplierInfoRequest implements Serializable {
private Long id;
// 供应商名称
private String supplierName;
// 期初预收款
private Long initialPreMoney;
// 供应商编号
private String supplierCode;
// 创建时间
private Timestamp createTime;
// 更新时间
private Timestamp updateTime;
// 备注
private String remark;
// 供应商地址地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
private List<SupplierAddress> supplierAddress;
// 供应商联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
private List<SupplierContact> supplierContact;
private Boolean status;
// 供应商类别主键
private Long supplierCategoryId;
// 供应商类别名称
private String supplierCategoryName;
public void copy(SupplierInfo source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,22 @@
package me.zhengjie.modules.wms.bd.request;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* @date 2019-08-18
*/
@Data
public class SupplierAddress implements Serializable {
private String province;
private String city;
private String area;
private String addressDetail;
private Integer sort;
}

View File

@ -0,0 +1,31 @@
package me.zhengjie.modules.wms.bd.request;
import lombok.Data;
import java.io.Serializable;
/**
* @author
* [{sort:,name:,mobile:,phone:,email:,qq:,weixin:,firstTag:}]firstTag 0: 1:
* @date 2019-08-18
*/
@Data
public class SupplierContact implements Serializable {
private Integer sort;
private String name;
private String mobile;
private String phone;
private String email;
private String qq;
private String weixin;
private Integer firstTag;
}

View File

@ -2,6 +2,7 @@ package me.zhengjie.modules.wms.bd.rest;
import me.zhengjie.aop.log.Log; import me.zhengjie.aop.log.Log;
import me.zhengjie.modules.wms.bd.domain.SupplierInfo; import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
import me.zhengjie.modules.wms.bd.request.CreateSupplierInfoRequest;
import me.zhengjie.modules.wms.bd.service.SupplierInfoService; import me.zhengjie.modules.wms.bd.service.SupplierInfoService;
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria; import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -68,8 +69,8 @@ public class SupplierInfoController {
@ApiOperation(value = "新增供应商资料") @ApiOperation(value = "新增供应商资料")
@PostMapping(value = "/supplierInfo") @PostMapping(value = "/supplierInfo")
@PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_CREATE')") @PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_CREATE')")
public ResponseEntity create(@Validated @RequestBody SupplierInfo resources){ public ResponseEntity create(@RequestBody CreateSupplierInfoRequest createSupplierInfoRequest){
return new ResponseEntity(supplierInfoService.create(resources),HttpStatus.CREATED); return new ResponseEntity(supplierInfoService.create(createSupplierInfoRequest),HttpStatus.CREATED);
} }
@Log("修改供应商资料") @Log("修改供应商资料")

View File

@ -1,6 +1,7 @@
package me.zhengjie.modules.wms.bd.service; package me.zhengjie.modules.wms.bd.service;
import me.zhengjie.modules.wms.bd.domain.SupplierInfo; import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
import me.zhengjie.modules.wms.bd.request.CreateSupplierInfoRequest;
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoDTO; import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoDTO;
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria; import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria;
//import org.springframework.cache.annotation.CacheConfig; //import org.springframework.cache.annotation.CacheConfig;
@ -42,11 +43,11 @@ public interface SupplierInfoService {
/** /**
* create * create
* @param resources * @param createSupplierInfoRequest
* @return * @return
*/ */
//@CacheEvict(allEntries = true) //@CacheEvict(allEntries = true)
SupplierInfoDTO create(SupplierInfo resources); SupplierInfoDTO create(CreateSupplierInfoRequest createSupplierInfoRequest);
/** /**
* update * update

View File

@ -1,8 +1,12 @@
package me.zhengjie.modules.wms.bd.service.dto; package me.zhengjie.modules.wms.bd.service.dto;
import lombok.Data; import lombok.Data;
import me.zhengjie.modules.wms.bd.request.SupplierAddress;
import me.zhengjie.modules.wms.bd.request.SupplierContact;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**

View File

@ -1,14 +1,19 @@
package me.zhengjie.modules.wms.bd.service.impl; package me.zhengjie.modules.wms.bd.service.impl;
import com.google.gson.Gson;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.wms.bd.domain.CustomerInfo; import me.zhengjie.modules.wms.bd.domain.CustomerInfo;
import me.zhengjie.modules.wms.bd.domain.SupplierInfo; import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
import me.zhengjie.modules.wms.bd.request.CreateSupplierInfoRequest;
import me.zhengjie.modules.wms.bd.request.SupplierAddress;
import me.zhengjie.modules.wms.bd.request.SupplierContact;
import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.ValidationUtil;
import me.zhengjie.modules.wms.bd.repository.SupplierInfoRepository; import me.zhengjie.modules.wms.bd.repository.SupplierInfoRepository;
import me.zhengjie.modules.wms.bd.service.SupplierInfoService; import me.zhengjie.modules.wms.bd.service.SupplierInfoService;
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoDTO; import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoDTO;
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria; import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria;
import me.zhengjie.modules.wms.bd.service.mapper.SupplierInfoMapper; import me.zhengjie.modules.wms.bd.service.mapper.SupplierInfoMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -95,11 +100,23 @@ public class SupplierInfoServiceImpl implements SupplierInfoService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public SupplierInfoDTO create(SupplierInfo resources) { public SupplierInfoDTO create(CreateSupplierInfoRequest createSupplierInfoRequest) {
resources.setStatus(true); SupplierInfo supplierInfo = new SupplierInfo();
SupplierInfo supplierInfo = supplierInfoRepository.save(resources); BeanUtils.copyProperties(createSupplierInfoRequest, supplierInfo);
supplierInfoMapper.toDto(supplierInfo); supplierInfo.setStatus(true);
return supplierInfoMapper.toDto(supplierInfo); List<SupplierAddress> supplierAddressList = createSupplierInfoRequest.getSupplierAddress();
if(!CollectionUtils.isEmpty(supplierAddressList)){
String supplierAddressStr = new Gson().toJson(supplierAddressList);
supplierInfo.setSupplierAddress(supplierAddressStr);
}
List<SupplierContact> supplierContactList = createSupplierInfoRequest.getSupplierContact();
if(!CollectionUtils.isEmpty(supplierContactList)){
String supplierContactStr = new Gson().toJson(supplierContactList);
supplierInfo.setSupplierContact(supplierContactStr);
}
supplierInfo = supplierInfoRepository.save(supplierInfo);
SupplierInfoDTO supplierInfoDTO = supplierInfoMapper.toDto(supplierInfo);
return supplierInfoDTO;
} }
@Override @Override

View File

@ -16,7 +16,7 @@ public class OutSourceProcessSheetDTO implements Serializable {
private Long id; private Long id;
// 状态 // 状态
private Integer status; private Boolean status;
// 创建时间 // 创建时间
private Timestamp createTime; private Timestamp createTime;

View File

@ -16,7 +16,7 @@ public class OutSourceProcessSheetProductDTO implements Serializable {
private Long id; private Long id;
// 状态 // 状态
private Integer status; private Boolean status;
// 创建时间 // 创建时间
private Timestamp createTime; private Timestamp createTime;

View File

@ -3,10 +3,9 @@ server:
spring: spring:
profiles: profiles:
active: dev active: prod
jackson: jackson:
time-zon time-zone: GMT+8
e: GMT+8
data: data:
redis: redis:
repositories: repositories: