LG88888888 3 年之前
父节点
当前提交
d0ca55008f

+ 14 - 0
src/main/java/net/chenlin/dp/modules/api/controller/CustomerController.java

@@ -6,6 +6,7 @@ import net.chenlin.dp.common.utils.SpringContextUtils;
 import net.chenlin.dp.modules.api.dao.CustomerMapper;
 import net.chenlin.dp.modules.api.service.CustomerService;
 import net.chenlin.dp.modules.api.vo.ICustomer;
+import net.chenlin.dp.modules.api.vo.ICustomerEdit;
 
 import java.util.List;
 
@@ -36,4 +37,17 @@ public class CustomerController {
         }
 
     }
+
+
+    public List<ICustomerEdit> ls() throws OpenAPIException {
+        DynamicDataSource.setDataSource("last-data-source");
+        List<ICustomerEdit> iCustomerEdits = customerMapper.ICustomerEditList();
+        DynamicDataSource.setDataSource("");
+        if (iCustomerEdits!=null&&iCustomerEdits.size()>0){
+            for (ICustomerEdit i:iCustomerEdits){
+                String s = customerService.editCustomer(i);
+            }
+        }
+        return iCustomerEdits;
+    }
 }

+ 6 - 0
src/main/java/net/chenlin/dp/modules/api/dao/CustomerMapper.java

@@ -66,4 +66,10 @@ public interface CustomerMapper extends BaseMapper<Customer> {
 	 * @return
 	 */
 	int UpdateCustomer(@Param("id")String id);
+
+	/**
+	 * 客户档案修改
+	 * @return
+	 */
+	List<ICustomerEdit>ICustomerEditList();
 }

+ 14 - 1
src/main/java/net/chenlin/dp/modules/api/mapper/CustomerMapper.xml

@@ -29,6 +29,16 @@
 		<result column="cCusCode" jdbcType="VARCHAR" property="ccuscode" />
 		<result column="cInvoiceCompany" jdbcType="VARCHAR" property="cinvoicecompany" />
 	</resultMap>
+
+	<resultMap id="ICustomerEdit" type="net.chenlin.dp.modules.api.vo.ICustomerEdit">
+		<result column="ccuscode" jdbcType="VARCHAR" property="code" />
+		<result column="ccusname" jdbcType="VARCHAR" property="name" />
+		<result column="ccusabbname" jdbcType="VARCHAR" property="abbrname" />
+		<result column="ccccode" jdbcType="VARCHAR" property="sort_code" />
+		<result column="cbranch" jdbcType="VARCHAR" property="bank_open" />
+		<result column="caccountnum" jdbcType="VARCHAR" property="bank_acc_number" />
+		<result column="cdeliveradd" jdbcType="VARCHAR" property="devliver_site" />
+	</resultMap>
 	<insert id="UAddCustomer">
 		insert into Customer (cCusCode,cCusName,cCusAbbName,cCCCode,cCusRegCode ,cCusBank,cCusAccount ,dCusCreateDatetime,cCusPPerson,iCusCreLine ,iCusCreDate ,cCusOAddress ,cInvoiceCompany )values
 		(
@@ -89,7 +99,10 @@
 	<select id="ICustomerList" resultMap="BaseResultMap">
 		select cCusCode ,cCusName ,cCusAbbName ,cCCCode ,cCusOAddress  from crm_u8_customer where issyu8 =0 or issyu8 is null
 	</select>
-
+	<select id="ICustomerEditList" resultMap="ICustomerEdit">
+		select  a.ccuscode ,a.ccusname ,a.ccusabbname,a.ccccode,c.cbranch ,
+				c.caccountnum ,b.cdeliveradd  from CRM_U8_Customer a left join CRM_U8_customEntity14__c b on a.cCusCode=b.cCusCode left join CRM_U8_customEntity15__c c on a.cCusCode=c.cCusCode where a.issyu8 =2
+	</select>
 	<update id="UpdateCustomer">
 		update CRM_U8_Customer set issyu8='1' where cCusCode=#{id}
 	</update>

+ 17 - 3
src/main/java/net/chenlin/dp/modules/api/service/CustomerService.java

@@ -127,14 +127,28 @@ public class CustomerService {
 
     /**
      * 客户编辑接口
-     * @param map
+     * @param
      * @throws OpenAPIException
      */
-    public void editCustomer(String jb){
+    public String editCustomer(ICustomerEdit customer)throws OpenAPIException {
         try {
-            JSONObject edit = customerService.edit(jb, getToaccount);
+            Map<String,Object>map=new HashMap<>();
+            map.put("customer",customer);
+            String s = JSONObject.toJSONString(map);
+            JSONObject edit = customerService.edit(s, getToaccount);
+            HashMap hashMap = JSONObject.parseObject(edit.toString(), HashMap.class);
+            Object tradeid = hashMap.get("tradeid");
+            if (!tradeid.equals("")&&tradeid!=null){
+                String result = ResultService.getResult(tradeid.toString());
+                HashMap m = JSONObject.parseObject(result, HashMap.class);
+                return m.get("errcode").toString();
+            }else{
+                return "";
+            }
         }catch (Exception e){
+            throw new OpenAPIException(e.getMessage(), e);
         }
+
     }
     //获取to_account
     public void getToaccount(){

+ 5 - 1
src/main/java/net/chenlin/dp/modules/api/service/SaleOrderService.java

@@ -56,7 +56,11 @@ public class SaleOrderService {
                     if (!tradeid.equals("")&&tradeid!=null){
                         String result = ResultService.getResult(tradeid.toString());
                         HashMap t = JSONObject.parseObject(result, HashMap.class);
-                         return t.get("errcode").toString();
+                        if (t.get("errcode")==null){
+                            return "0";
+                        }else {
+                            return t.get("errcode").toString();
+                        }
                     }else {
                         return "";
                     }

+ 154 - 0
src/main/java/net/chenlin/dp/modules/api/vo/ICustomerEdit.java

@@ -0,0 +1,154 @@
+package net.chenlin.dp.modules.api.vo;
+
+/**
+ * u8客户编辑实体
+ */
+public class ICustomerEdit {
+    private  String code;//客户编码
+    private  String name;//客户名称
+    private  String abbrname;//客户简称
+    private  String sort_code;//客户分类码
+    private  String industry;//所属行业
+    private  String address;//地址
+    private  String bank_open;//开户银行
+    private  String bank_acc_number;//银行帐号
+    private  String phone;//电话
+    private  String fax;//传真
+    private  String email;//Email地址
+    private  String contact;//联系人
+    private  String mobile;//手机
+    private  String devliver_site;//到货地址
+    private  String end_date;//停用日期
+//    private  String bvencargo;//
+//    private  String bproxyforeign;//
+//    private  String bvenservice;//
+    private  String memo;//备注
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAbbrname() {
+        return abbrname;
+    }
+
+    public void setAbbrname(String abbrname) {
+        this.abbrname = abbrname;
+    }
+
+    public String getSort_code() {
+        return sort_code;
+    }
+
+    public void setSort_code(String sort_code) {
+        this.sort_code = sort_code;
+    }
+
+    public String getIndustry() {
+        return industry;
+    }
+
+    public void setIndustry(String industry) {
+        this.industry = industry;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getBank_open() {
+        return bank_open;
+    }
+
+    public void setBank_open(String bank_open) {
+        this.bank_open = bank_open;
+    }
+
+    public String getBank_acc_number() {
+        return bank_acc_number;
+    }
+
+    public void setBank_acc_number(String bank_acc_number) {
+        this.bank_acc_number = bank_acc_number;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getFax() {
+        return fax;
+    }
+
+    public void setFax(String fax) {
+        this.fax = fax;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getContact() {
+        return contact;
+    }
+
+    public void setContact(String contact) {
+        this.contact = contact;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getDevliver_site() {
+        return devliver_site;
+    }
+
+    public void setDevliver_site(String devliver_site) {
+        this.devliver_site = devliver_site;
+    }
+
+    public String getEnd_date() {
+        return end_date;
+    }
+
+    public void setEnd_date(String end_date) {
+        this.end_date = end_date;
+    }
+
+    public String getMemo() {
+        return memo;
+    }
+
+    public void setMemo(String memo) {
+        this.memo = memo;
+    }
+}