Browse Source

【贝腾】【获取客户资料接口】

wub 1 month ago
parent
commit
89e307f3c3

+ 5 - 0
src/main/java/com/uas/eis/controller/STKController.java

@@ -40,6 +40,11 @@ public class STKController {
         return stkService.getBusinessChanceList(productPageDTO);
     }
 
+    @PostMapping("/api/getCustomerList")
+    public Result getCustomerList(HttpServletRequest request, @RequestBody ProductPageDTO productPageDTO){
+        return stkService.getCustomerList(productPageDTO);
+    }
+
     @PostMapping("/api/getProduct")
     public Result getProduct(HttpServletRequest request, @RequestBody ProductReq productReq){
         return stkService.getProduct(request, productReq);

+ 47 - 0
src/main/java/com/uas/eis/convertor/CustomerConvertor.java

@@ -0,0 +1,47 @@
+package com.uas.eis.convertor;
+
+import com.uas.eis.sdk.dto.CustomerDTO;
+import com.uas.eis.sdk.dto.CustomerResp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CustomerConvertor {
+
+    public static List<CustomerResp> toCustomerRespListByCustomerDTOS(List<CustomerDTO> customerDTOList) {
+        List<CustomerResp> resps = new ArrayList<>();
+
+        for (CustomerDTO customerDTO : customerDTOList) {
+            CustomerResp customerResp = toCustomerResp(customerDTO);
+            resps.add(customerResp);
+        }
+        return resps;
+    }
+
+    public static CustomerResp toCustomerResp(CustomerDTO customerDTO) {
+        CustomerResp customerResp = new CustomerResp();
+        customerResp.setCode(customerDTO.getCu_code());
+        customerResp.setName(customerDTO.getCu_name());
+        customerResp.setAgency(customerDTO.getCu_agency());
+        customerResp.setShortname(customerDTO.getCu_shortname());
+        customerResp.setAuditstatus(customerDTO.getCu_auditstatus());
+        customerResp.setStatus(customerDTO.getCu_status());
+        customerResp.setKind(customerDTO.getCu_kind());
+        customerResp.setSellercode(customerDTO.getCu_sellercode());
+        customerResp.setSellername(customerDTO.getCu_sellername());
+        customerResp.setCurrency(customerDTO.getCu_currency());
+        customerResp.setTaxrate(customerDTO.getCu_taxrate());
+        customerResp.setPayments(customerDTO.getCu_payments());
+        customerResp.setArname(customerDTO.getCu_arname());
+        customerResp.setShcustname(customerDTO.getCu_shcustname());
+        customerResp.setAdd1(customerDTO.getCu_add1());
+        customerResp.setRecordman(customerDTO.getCu_recordman());
+        customerResp.setRecorddate(customerDTO.getCu_recorddate());
+        customerResp.setCop(customerDTO.getCu_cop());
+        customerResp.setRemark(customerDTO.getCu_remark());
+        customerResp.setId(customerDTO.getCu_id());
+        customerResp.setEnablecredit(customerDTO.getCu_enablecredit());
+        customerResp.setCredit(customerDTO.getCu_credit());
+        return customerResp;
+    }
+}

+ 43 - 0
src/main/java/com/uas/eis/sdk/dto/CustomerDTO.java

@@ -0,0 +1,43 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+/**
+ * dto说明
+ * */
+
+@Data
+@NoArgsConstructor
+public class CustomerDTO {
+
+    /**
+     *主键ID
+     * */
+    private String cu_code;
+    private String cu_name;
+    private String cu_agency;
+    private String cu_shortname;
+    private String cu_auditstatus;
+    private String cu_status;
+    private String cu_kind;
+    private String cu_sellercode;
+    private String cu_sellername;
+    private String cu_currency;
+    private String cu_taxrate;
+    private String cu_payments;
+    private String cu_arname;
+    private String cu_shcustname;
+    private String cu_add1;
+    private String cu_recordman;
+    private String cu_recorddate;
+    private String cu_cop;
+    private String cu_remark;
+    private String cu_id;
+    private String cu_enablecredit;
+    private String cu_credit;
+    private String cu_uu;
+    private String cu_contact2;
+    private String cu_tel2;
+}

+ 43 - 0
src/main/java/com/uas/eis/sdk/dto/CustomerResp.java

@@ -0,0 +1,43 @@
+package com.uas.eis.sdk.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+/**
+ * dto说明
+ * */
+
+@Data
+@NoArgsConstructor
+public class CustomerResp {
+
+    /**
+     *主键ID
+     * */
+    private String code;
+    private String name;
+    private String agency;
+    private String shortname;
+    private String auditstatus;
+    private String status;
+    private String kind;
+    private String sellercode;
+    private String sellername;
+    private String currency;
+    private String taxrate;
+    private String payments;
+    private String arname;
+    private String shcustname;
+    private String add1;
+    private String recordman;
+    private String recorddate;
+    private String cop;
+    private String remark;
+    private String id;
+    private String enablecredit;
+    private String credit;
+    private String uu;
+    private String contact2;
+    private String tel2;
+}

+ 29 - 0
src/main/java/com/uas/eis/service/Impl/STKServiceImpl.java

@@ -120,6 +120,35 @@ public class STKServiceImpl implements STKService {
         return Result.success(map);
     }
 
+    @Override
+    public Result getCustomerList(ProductPageDTO productPageDTO) {
+        int pageNum = 1;
+        int pageSize = 20;
+        if (productPageDTO !=null){
+            pageNum = Integer.valueOf(productPageDTO.getPageNum());
+            pageSize = Integer.valueOf(productPageDTO.getPageSize());
+        }else{
+            return Result.error("参数错误!");
+        }
+        int start = ((pageNum - 1) * pageSize + 1);
+        int end = pageNum * pageSize;
+
+        List<CustomerDTO> customerDTOS = baseDao.query("select * from (select rownum rn,AA.* from (select cu_code,cu_name,cu_agency,cu_shortname,cu_auditstatus,cu_status,cu_kind,cu_sellercode,cu_sellername,cu_currency,cu_taxrate,cu_payments,cu_arname,cu_shcustname,cu_add1,cu_recordman,cu_recorddate,cu_cop,cu_remark,cu_id,cu_enablecredit,cu_credit,cu_uu,cu_contact2,cu_tel2 from customer where cu_auditstatuscode in ('AUDITED','DISABLE') order by cu_id desc)  AA ) where rn>="+start+" and rn<="+end , CustomerDTO.class);
+
+        if (customerDTOS.size() == 0 ){
+            return Result.error("员工资料无数据!");
+        }
+        int count = baseDao.getCount("select count(1) from customer where cu_auditstatuscode in ('AUDITED','DISABLE')");
+
+        List<CustomerResp> customerResps = CustomerConvertor.toCustomerRespListByCustomerDTOS(customerDTOS);
+        Map<String,Object> map = new HashMap<>();
+        map.put("pageNum", pageNum);
+        map.put("pageSize", pageSize);
+        map.put("size", count);
+        map.put("list", customerResps);
+        return Result.success(map);
+    }
+
     @Override
     public Result getProduct(HttpServletRequest request, ProductReq req) {
         String code = req.getCode();

+ 2 - 0
src/main/java/com/uas/eis/service/STKService.java

@@ -21,6 +21,8 @@ public interface STKService {
 
     Result getBusinessChanceList(ProductPageDTO productPageDTO);
 
+    Result getCustomerList(ProductPageDTO productPageDTO);
+
     Result getProduct(HttpServletRequest request, ProductReq productReq);
 
     Result getBom(BomReq bomReq);