mirror of https://github.com/elunez/eladmin
				
				
				
			新增委外公司资料
							parent
							
								
									dccf6e9908
								
							
						
					
					
						commit
						153c7d8a82
					
				| 
						 | 
				
			
			@ -32,7 +32,7 @@ public class CreateCustomerInfoRequest implements Serializable {
 | 
			
		|||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    // 客户地址地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
 | 
			
		||||
    private List<CustomerAddress> supplierAddress;
 | 
			
		||||
    private List<CustomerAddress> customerAddress;
 | 
			
		||||
 | 
			
		||||
    // 客户联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
 | 
			
		||||
    private List<CustomerContact> customerContact;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
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.OutSourceCompanyInfo;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author 黄星星
 | 
			
		||||
 * @date 2019-08-24
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class CreateOutSourceCompanyInfoRequest implements Serializable {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // 委外公司名称
 | 
			
		||||
    private String outSourceCompanyName;
 | 
			
		||||
 | 
			
		||||
    // 期初预收款
 | 
			
		||||
    private Long initialPreMoney;
 | 
			
		||||
 | 
			
		||||
    // 委外公司编号
 | 
			
		||||
    private String outSourceCompanyCode;
 | 
			
		||||
 | 
			
		||||
    // 备注
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    // 委外公司地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
 | 
			
		||||
    private List<OutSourceCompanyAddress> outSourceCompanyAddress;
 | 
			
		||||
 | 
			
		||||
    // 委外公司联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
 | 
			
		||||
    private List<OutSourceCompanyContact> outSourceCompanyContact;
 | 
			
		||||
 | 
			
		||||
    //    @Column(name = "status")
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
 | 
			
		||||
    public void copy(OutSourceCompanyInfo source){
 | 
			
		||||
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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 OutSourceCompanyAddress implements Serializable {
 | 
			
		||||
    private String province;
 | 
			
		||||
 | 
			
		||||
    private String city;
 | 
			
		||||
 | 
			
		||||
    private String area;
 | 
			
		||||
 | 
			
		||||
    private String addressDetail;
 | 
			
		||||
 | 
			
		||||
    private Integer sort;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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 OutSourceCompanyContact 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;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +15,9 @@ import org.springframework.validation.annotation.Validated;
 | 
			
		|||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
import io.swagger.annotations.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @author jie
 | 
			
		||||
* @date 2019-08-03
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +30,16 @@ public class CustomerInfoController {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private CustomerInfoService customerInfoService;
 | 
			
		||||
 | 
			
		||||
    @Log("初始化客户编号")
 | 
			
		||||
    @ApiOperation(value = "初始化客户编号")
 | 
			
		||||
    @GetMapping(value = "/initCustomerCode")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDSUPPLIERINFO_ALL','BDSUPPLIERINFO_SELECT')")
 | 
			
		||||
    public ResponseEntity initCustomerCode(){
 | 
			
		||||
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");//设置日期格式
 | 
			
		||||
        String supplierCode = "KH"+ LocalDateTime.now().format(fmt);
 | 
			
		||||
        return new ResponseEntity(supplierCode,HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("分页查询客户信息")
 | 
			
		||||
    @ApiOperation(value = "分页查询客户信息")
 | 
			
		||||
    @GetMapping(value = "/queryCustomerInfoPage")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package me.zhengjie.modules.wms.bd.rest;
 | 
			
		|||
 | 
			
		||||
import me.zhengjie.aop.log.Log;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.CreateOutSourceCompanyInfoRequest;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.OutSourceCompanyInfoService;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoQueryCriteria;
 | 
			
		||||
| 
						 | 
				
			
			@ -28,18 +29,18 @@ public class OutSourceCompanyInfoController {
 | 
			
		|||
 | 
			
		||||
    @Log("分页查询委外公司资料列表")
 | 
			
		||||
    @ApiOperation(value = "分页查询委外公司资料列表")
 | 
			
		||||
    @GetMapping(value = "/outSourceCompanyInfos")
 | 
			
		||||
    @GetMapping(value = "/queryOutSourceCompanyInfoPage")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_SELECT')")
 | 
			
		||||
    public ResponseEntity getOutSourceCompanyInfos(OutSourceCompanyInfoQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
    public ResponseEntity queryOutSourceCompanyInfoPage(OutSourceCompanyInfoQueryCriteria criteria, Pageable pageable){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.queryAll(criteria,pageable),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Log("查询委外公司资料列表")
 | 
			
		||||
    @ApiOperation(value = "分页查询委外公司资料列表")
 | 
			
		||||
    @GetMapping(value = "/getOutSourceCompanyInfoList")
 | 
			
		||||
    @GetMapping(value = "/queryOutSourceCompanyInfoList")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_SELECT')")
 | 
			
		||||
    public ResponseEntity getOutSourceCompanyInfoList(OutSourceCompanyInfoQueryCriteria criteria){
 | 
			
		||||
    public ResponseEntity queryOutSourceCompanyInfoList(OutSourceCompanyInfoQueryCriteria criteria){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.queryAll(criteria),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,8 +59,8 @@ public class OutSourceCompanyInfoController {
 | 
			
		|||
    @ApiOperation(value = "新增委外公司资料")
 | 
			
		||||
    @PostMapping(value = "/outSourceCompanyInfo")
 | 
			
		||||
    @PreAuthorize("hasAnyRole('ADMIN','BDOUTSOURCECOMPANYINFO_ALL','BDOUTSOURCECOMPANYINFO_CREATE')")
 | 
			
		||||
    public ResponseEntity create(@Validated @RequestBody OutSourceCompanyInfo resources){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.create(resources),HttpStatus.CREATED);
 | 
			
		||||
    public ResponseEntity create(@RequestBody CreateOutSourceCompanyInfoRequest createOutSourceCompanyInfoRequest){
 | 
			
		||||
        return new ResponseEntity(outSourceCompanyInfoService.create(createOutSourceCompanyInfoRequest),HttpStatus.CREATED);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Log("修改委外公司资料")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ public interface CustomerInfoService {
 | 
			
		|||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    CustomerInfoDTO create(CreateCustomerInfoRequest createCustomerInfoRequest);
 | 
			
		||||
    CustomerInfoDetailDTO create(CreateCustomerInfoRequest createCustomerInfoRequest);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.CreateOutSourceCompanyInfoRequest;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoQueryCriteria;
 | 
			
		||||
//import org.springframework.cache.annotation.CacheConfig;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,11 +43,11 @@ public interface OutSourceCompanyInfoService {
 | 
			
		|||
 | 
			
		||||
    /**
 | 
			
		||||
     * create
 | 
			
		||||
     * @param resources
 | 
			
		||||
     * @param createOutSourceCompanyInfoRequest
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    OutSourceCompanyInfoDTO create(OutSourceCompanyInfo resources);
 | 
			
		||||
    OutSourceCompanyInfoDTO create(CreateOutSourceCompanyInfoRequest createOutSourceCompanyInfoRequest);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,9 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service;
 | 
			
		||||
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.CreateSupplierInfoRequest;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.UpdateSupplierInfoRequest;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoDetailDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.SupplierInfoQueryCriteria;
 | 
			
		||||
//import org.springframework.cache.annotation.CacheConfig;
 | 
			
		||||
//import org.springframework.cache.annotation.CacheEvict;
 | 
			
		||||
//import org.springframework.cache.annotation.Cacheable;
 | 
			
		||||
import org.springframework.data.domain.Pageable;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +44,7 @@ public interface SupplierInfoService {
 | 
			
		|||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    //@CacheEvict(allEntries = true)
 | 
			
		||||
    SupplierInfoDTO create(CreateSupplierInfoRequest createSupplierInfoRequest);
 | 
			
		||||
    SupplierInfoDetailDTO create(CreateSupplierInfoRequest createSupplierInfoRequest);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * update
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,4 +35,13 @@ public class CustomerInfoDTO implements Serializable {
 | 
			
		|||
    // 状态
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
 | 
			
		||||
    // 首要联系人姓名
 | 
			
		||||
    private String firstContactName;
 | 
			
		||||
 | 
			
		||||
    // 首要联系人手机
 | 
			
		||||
    private String firstContactMobile;
 | 
			
		||||
 | 
			
		||||
    // 首要联系人地址
 | 
			
		||||
    private String firstContactAddress;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -32,11 +32,6 @@ public class OutSourceCompanyInfoDTO implements Serializable {
 | 
			
		|||
    // 备注
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    // 委外公司地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
 | 
			
		||||
    private String outSourceCompanyAddress;
 | 
			
		||||
 | 
			
		||||
    // 委外公司联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
 | 
			
		||||
    private String outSourceCompanyContact;
 | 
			
		||||
 | 
			
		||||
    private Boolean status;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service.dto;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.CustomerContact;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.OutSourceCompanyAddress;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.OutSourceCompanyContact;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author 黄星星
 | 
			
		||||
 * @date 2019-08-24
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class OutSourceCompanyInfoDetailDTO extends  OutSourceCompanyInfoDTO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    // 客户地址地址数组[{“province”:””,”city”:””,”area”:””,”address_detail”:””,”sort”:””}]
 | 
			
		||||
    private List<OutSourceCompanyAddress> outSourceCompanyAddress;
 | 
			
		||||
 | 
			
		||||
    // 客户联系人[{“sort”:””,”name”:””,”mobile”:””,”phone”:””,”email”:””,”qq”:””,”weixin”:””,”firstTag”:””}]firstTag 0:非首要联系人 1:首要联系人
 | 
			
		||||
    private List<OutSourceCompanyContact> outSourceCompanyContact;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -61,23 +61,9 @@ public class CustomerInfoServiceImpl implements CustomerInfoService {
 | 
			
		|||
 | 
			
		||||
                List<Predicate> targetPredicateList = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
                //客户名称
 | 
			
		||||
                String customerName = criteria.getCustomerName();
 | 
			
		||||
                if (!StringUtils.isEmpty(customerName)) {
 | 
			
		||||
                    Predicate namePredicate = criteriaBuilder.like(root.get("customerName"), "%" + customerName + "%");
 | 
			
		||||
                    targetPredicateList.add(namePredicate);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //状态
 | 
			
		||||
                Predicate statusPredicate = criteriaBuilder.equal(root.get("status"), 1);
 | 
			
		||||
                targetPredicateList.add(statusPredicate);
 | 
			
		||||
 | 
			
		||||
                String customerCode = criteria.getCustomerCode();
 | 
			
		||||
                if(!StringUtils.isEmpty(customerCode)){
 | 
			
		||||
                    Predicate customerCodePredicate = criteriaBuilder.like(root.get("customerCode"), "%" + customerName + "%");
 | 
			
		||||
                    targetPredicateList.add(customerCodePredicate);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if(CollectionUtils.isEmpty(targetPredicateList)){
 | 
			
		||||
                    return null;
 | 
			
		||||
                }else{
 | 
			
		||||
| 
						 | 
				
			
			@ -86,7 +72,32 @@ public class CustomerInfoServiceImpl implements CustomerInfoService {
 | 
			
		|||
            }
 | 
			
		||||
        };
 | 
			
		||||
        Page<CustomerInfo> page = customerInfoRepository.findAll(specification, pageable);
 | 
			
		||||
        return PageUtil.toPage(page.map(customerInfoMapper::toDto));
 | 
			
		||||
        Page<CustomerInfoDTO> customerInfoDTOPage = page.map(customerInfoMapper::toDto);
 | 
			
		||||
        if(null != customerInfoDTOPage){
 | 
			
		||||
            List<CustomerInfoDTO> customerInfoDtoList = customerInfoDTOPage.getContent();
 | 
			
		||||
            if(!CollectionUtils.isEmpty(customerInfoDtoList)){
 | 
			
		||||
                for(CustomerInfoDTO customerInfoDTO : customerInfoDtoList){
 | 
			
		||||
                    Long customerInfoDTOId = customerInfoDTO.getId();
 | 
			
		||||
                    Optional<CustomerInfo> customerInfoOptional = customerInfoRepository.findById(customerInfoDTOId);
 | 
			
		||||
                    if(null != customerInfoOptional){
 | 
			
		||||
                        CustomerInfo customerInfo = customerInfoOptional.get();
 | 
			
		||||
                        if(null != customerInfo){
 | 
			
		||||
                            String customerContactJsonStr = customerInfo.getCustomerContact();
 | 
			
		||||
                            List<CustomerContact> customerContactList = new Gson().fromJson(customerContactJsonStr,new TypeToken<ArrayList<CustomerContact>>() {}.getType());
 | 
			
		||||
                            if(!CollectionUtils.isEmpty(customerContactList)){
 | 
			
		||||
                                for(CustomerContact customerContact : customerContactList){
 | 
			
		||||
                                    if(customerContact.getFirstTag() == 1){
 | 
			
		||||
                                        customerInfoDTO.setFirstContactMobile(customerContact.getMobile());
 | 
			
		||||
                                        customerInfoDTO.setFirstContactName(customerContact.getName());
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return PageUtil.toPage(customerInfoDTOPage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			@ -138,13 +149,13 @@ public class CustomerInfoServiceImpl implements CustomerInfoService {
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public CustomerInfoDTO create(CreateCustomerInfoRequest createCustomerInfoRequest) {
 | 
			
		||||
    public CustomerInfoDetailDTO create(CreateCustomerInfoRequest createCustomerInfoRequest) {
 | 
			
		||||
        CustomerInfoDetailDTO customerInfoDetailDTO = new CustomerInfoDetailDTO();
 | 
			
		||||
 | 
			
		||||
        CustomerInfo customerInfo = new CustomerInfo();
 | 
			
		||||
        BeanUtils.copyProperties(createCustomerInfoRequest, customerInfo);
 | 
			
		||||
        customerInfo.setStatus(true);
 | 
			
		||||
        List<CustomerAddress> customerAddressList = createCustomerInfoRequest.getSupplierAddress();
 | 
			
		||||
        List<CustomerAddress> customerAddressList = createCustomerInfoRequest.getCustomerAddress();
 | 
			
		||||
        if(!CollectionUtils.isEmpty(customerAddressList)){
 | 
			
		||||
            String customerAddressStr = new Gson().toJson(customerAddressList);
 | 
			
		||||
            customerInfo.setCustomerAddress(customerAddressStr);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,17 @@
 | 
			
		|||
package me.zhengjie.modules.wms.bd.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.google.gson.Gson;
 | 
			
		||||
import me.zhengjie.exception.BadRequestException;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.CustomerInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.OutSourceCompanyInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.domain.SupplierInfo;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.request.*;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.*;
 | 
			
		||||
import me.zhengjie.utils.ValidationUtil;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.repository.OutSourceCompanyInfoRepository;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.OutSourceCompanyInfoService;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoDTO;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.dto.OutSourceCompanyInfoQueryCriteria;
 | 
			
		||||
import me.zhengjie.modules.wms.bd.service.mapper.OutSourceCompanyInfoMapper;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.data.jpa.domain.Specification;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
| 
						 | 
				
			
			@ -124,9 +127,29 @@ public class OutSourceCompanyInfoServiceImpl implements OutSourceCompanyInfoServ
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public OutSourceCompanyInfoDTO create(OutSourceCompanyInfo resources) {
 | 
			
		||||
        resources.setStatus(true);
 | 
			
		||||
        return outSourceCompanyInfoMapper.toDto(outSourceCompanyInfoRepository.save(resources));
 | 
			
		||||
    public OutSourceCompanyInfoDTO create(CreateOutSourceCompanyInfoRequest createOutSourceCompanyInfoRequest) {
 | 
			
		||||
        OutSourceCompanyInfoDetailDTO outSourceCompanyInfoDetailDTO = new OutSourceCompanyInfoDetailDTO();
 | 
			
		||||
 | 
			
		||||
        OutSourceCompanyInfo outSourceCompanyInfo = new OutSourceCompanyInfo();
 | 
			
		||||
        BeanUtils.copyProperties(createOutSourceCompanyInfoRequest, outSourceCompanyInfo);
 | 
			
		||||
        outSourceCompanyInfo.setStatus(true);
 | 
			
		||||
        List<OutSourceCompanyAddress> outSourceCompanyAddressList = createOutSourceCompanyInfoRequest.getOutSourceCompanyAddress();
 | 
			
		||||
        if(!CollectionUtils.isEmpty(outSourceCompanyAddressList)){
 | 
			
		||||
            String outSourceCompanyAddressStr = new Gson().toJson(outSourceCompanyAddressList);
 | 
			
		||||
            outSourceCompanyInfo.setOutSourceCompanyAddress(outSourceCompanyAddressStr);
 | 
			
		||||
            outSourceCompanyInfoDetailDTO.setOutSourceCompanyAddress(outSourceCompanyAddressList);
 | 
			
		||||
        }
 | 
			
		||||
        List<OutSourceCompanyContact> outSourceCompanyContactList = createOutSourceCompanyInfoRequest.getOutSourceCompanyContact();
 | 
			
		||||
        if(!CollectionUtils.isEmpty(outSourceCompanyContactList)){
 | 
			
		||||
            String outSourceCompanyContactStr = new Gson().toJson(outSourceCompanyContactList);
 | 
			
		||||
            outSourceCompanyInfo.setOutSourceCompanyContact(outSourceCompanyContactStr);
 | 
			
		||||
            outSourceCompanyInfoDetailDTO.setOutSourceCompanyContact(outSourceCompanyContactList);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        outSourceCompanyInfo = outSourceCompanyInfoRepository.save(outSourceCompanyInfo);
 | 
			
		||||
        OutSourceCompanyInfoDTO outSourceCompanyInfoDTO = outSourceCompanyInfoMapper.toDto(outSourceCompanyInfo);
 | 
			
		||||
        BeanUtils.copyProperties(outSourceCompanyInfoDTO, outSourceCompanyInfoDetailDTO);
 | 
			
		||||
        return outSourceCompanyInfoDetailDTO;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -159,7 +159,7 @@ public class SupplierInfoServiceImpl implements SupplierInfoService {
 | 
			
		|||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public SupplierInfoDTO create(CreateSupplierInfoRequest createSupplierInfoRequest) {
 | 
			
		||||
    public SupplierInfoDetailDTO create(CreateSupplierInfoRequest createSupplierInfoRequest) {
 | 
			
		||||
        Long supplierCategoryId = createSupplierInfoRequest.getSupplierCategoryId();
 | 
			
		||||
        if(null == supplierCategoryId){
 | 
			
		||||
            throw new BadRequestException("供应商类别不存在!");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue