Browse Source

修改页面和修改解析经销商

qxp 4 years ago
parent
commit
e4c621dc69
19 changed files with 773 additions and 171 deletions
  1. 0 1
      suishenbang-admin/pom.xml
  2. 1 1
      suishenbang-admin/src/main/java/com/dgtly/web/controller/system/SysUserController.java
  3. 20 3
      suishenbang-admin/src/main/resources/templates/system/user/add.html
  4. 42 18
      suishenbang-admin/src/main/resources/templates/system/user/edit.html
  5. 3 1
      suishenbang-admin/src/main/resources/templates/system/user/selectUser.html
  6. 3 0
      suishenbang-admin/src/main/resources/templates/system/user/user.html
  7. 2 2
      suishenbang-order/src/main/java/com/dgtly/order/controller/OrderBaseController.java
  8. 18 18
      suishenbang-order/src/main/java/com/dgtly/order/domain/OrderDetailModel.java
  9. 72 113
      suishenbang-order/src/main/resources/templates/order/orderbase/orderbase.html
  10. 211 0
      suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/domain/Customers.java
  11. 67 0
      suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/mapper/CustomersMapper.java
  12. 19 9
      suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/AnalysisDiyCustomerComponent.java
  13. 62 0
      suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/ICustomersService.java
  14. 97 0
      suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/impl/CustomersServiceImpl.java
  15. 137 0
      suishenbang-sync/suishenbang-sync-common/src/main/resources/mapper/sync/CustomersMapper.xml
  16. 7 0
      suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserExtService.java
  17. 8 0
      suishenbang-system/src/main/java/com/dgtly/system/service/impl/SysUserExtServiceImpl.java
  18. 4 0
      suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml
  19. 0 5
      suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/qywxutils/QyWxSendMessageUtil.java

+ 0 - 1
suishenbang-admin/pom.xml

@@ -34,7 +34,6 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
         </dependency>
 
 		<!-- swagger2-->

+ 1 - 1
suishenbang-admin/src/main/java/com/dgtly/web/controller/system/SysUserController.java

@@ -212,7 +212,7 @@ public class SysUserController extends BaseController
         if(user.getSysUserExt().getIsChangeExt()>0){
             SysUserExt ext =user.getSysUserExt();
             ext.setUserId(user.getUserId());
-            userExtService.insertOrUpSysUserExt(ext);
+            userExtService.delAndInsertSysUserExt(ext);
         }
 
         int rows = userService.updateUser(user);

+ 20 - 3
suishenbang-admin/src/main/resources/templates/system/user/add.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
 	<th:block th:include="include :: header('新增用户')" />
 	<th:block th:include="include :: select2-css" />
@@ -114,8 +114,8 @@
                 </div>
             </div>
             <h4 class="form-header h4" style="line-height: 2.1;">扩展信息
-                <div style="float: right">
-                    <!--<button type="button" class="btn btn-sm btn-primary" onclick="editExt()"><i class="fa fa-check"></i>自定义</button>&nbsp;-->
+                <div style="float: right" shiro:hasPermission="system.user.editExt">
+                    <button type="button" class="btn btn-sm btn-primary" onclick="seletDiyExt()"><i class="fa fa-check"></i>设置为自定义</button>&nbsp;
                     <button type="button" class="btn btn-sm btn-primary" onclick="selectExt()"><i class="fa fa-check"></i>选择扩展信息</button>&nbsp;
                 </div>
             </h4>
@@ -412,6 +412,23 @@
             }
         }
 
+        function seletDiyExt(){
+            $("input[name='sysUserExt.salesLevel']").val("diy_level");
+
+            changeLevelText();
+            changeLevel();
+            $("input[name='sysUserExt.postName']").val("");
+            $("input[name='sysUserExt.orgCode']").val("");
+            $("input[name='sysUserExt.postCode']").val("");
+            $("input[name='sysUserExt.orgName']").val("");
+            $("input[name='sysUserExt.bossName']").val("");
+            $("input[name='sysUserExt.bossEmployeeId']").val("");
+            $("input[name='sysUserExt.customerCode']").val("");
+            $("input[name='sysUserExt.sapEmployeeId']").val("");
+            $("input[name='sysUserExt.isCustomerManager']").val("");
+            $("input[name='sysUserExt.isChangeExt']").val(1);
+        }
+
 		$(function() {
             $('#post').select2({
                 placeholder:"请选择岗位",

+ 42 - 18
suishenbang-admin/src/main/resources/templates/system/user/edit.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
 	<th:block th:include="include :: header('修改用户')" />
 	<th:block th:include="include :: select2-css" />
@@ -105,15 +105,16 @@
                 </div>
             </div>
             <h4 class="form-header h4" style="line-height: 2.1;">扩展信息
-                <div style="float: right">
-                    <!--<button type="button" class="btn btn-sm btn-primary" onclick="editExt()"><i class="fa fa-check"></i>自定义</button>&nbsp;-->
+                <div style="float: right" shiro:hasPermission="system.user.editExt">
+                    <button type="button" class="btn btn-sm btn-primary" onclick="seletDiyExt()"><i class="fa fa-check"></i>设置为自定义</button>&nbsp;
                     <button type="button" class="btn btn-sm btn-primary" onclick="selectExt()"><i class="fa fa-check"></i>选择扩展信息</button>&nbsp;
                 </div>
             </h4>
 
             <input  type="hidden" readonly="true" th:field="*{sysUserExt.isChangeExt}" />
+            <input  type="hidden" readonly="true" th:field="*{sysUserExt.sapEmployeeId}" />
             <div class="row">
-                <div class="col-sm-4">
+                <div class="col-sm-6">
                     <div class="form-group">
                         <label class="col-sm-4 control-label">用户类别:</label>
                         <input type="hidden" th:field="*{sysUserExt.salesLevel}" onchange="changeLevelText">
@@ -122,19 +123,23 @@
                         </div>
                     </div>
                 </div>
-                <div class="col-sm-4">
-                    <div class="form-group">
-                        <label class="col-sm-4 control-label">岗位名称:</label>
-                        <div class="col-sm-8">
-                            <input class="form-control" type="text" readonly="true" th:field="*{sysUserExt.postName}" />
+            </div>
+            <div id="diyDiv">
+                <div class="row">
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-4 control-label">岗位名称:</label>
+                            <div class="col-sm-8">
+                                <input class="form-control" type="text" readonly="true" th:field="*{sysUserExt.postName}" />
+                            </div>
                         </div>
                     </div>
-                </div>
-                <div class="col-sm-4">
-                    <div class="form-group">
-                        <label class="col-sm-4 control-label">组织Code:</label>
-                        <div class="col-sm-8">
-                            <input class="form-control" type="text" readonly="true" th:field="*{sysUserExt.orgCode}" />
+                    <div class="col-sm-6">
+                        <div class="form-group">
+                            <label class="col-sm-4 control-label">组织Code:</label>
+                            <div class="col-sm-8">
+                                <input class="form-control" type="text" readonly="true" th:field="*{sysUserExt.orgCode}" />
+                            </div>
                         </div>
                     </div>
                 </div>
@@ -312,13 +317,15 @@
 		function changeLevel(){
             var level = $("input[name='sysUserExt.salesLevel']").val();
             if(level=="customer_level"){
+                $("#diyDiv").show();
                 $("#customerDiv").show();
                 $("#salesDiv").hide();
             }else if(level=="diy_level"){
-
-                $("#customerDiv").show();
-                $("#salesDiv").show();
+                $("#diyDiv").hide();
+                $("#customerDiv").hide();
+                $("#salesDiv").hide();
             }else{
+                $("#diyDiv").show();
                 $("#customerDiv").hide();
                 $("#salesDiv").show();
             }
@@ -361,6 +368,7 @@
                         $("input[name='sysUserExt.bossName']").val(result.data.bossName);
                         $("input[name='sysUserExt.bossEmployeeId']").val(result.data.bossEmployeeId);
                         $("input[name='sysUserExt.customerCode']").val(result.data.customerCode);
+                        $("input[name='sysUserExt.sapEmployeeId']").val(result.data.sapEmployeeId);
                         $("input[name='sysUserExt.isCustomerManager']").val(result.data.isCustomerManager);
 
                         $("input[name='sysUserExt.isChangeExt']").val(1);
@@ -386,6 +394,22 @@
 
             }
         }
+        function seletDiyExt(){
+            $("input[name='sysUserExt.salesLevel']").val("diy_level");
+
+            changeLevelText();
+            changeLevel();
+            $("input[name='sysUserExt.postName']").val("");
+            $("input[name='sysUserExt.orgCode']").val("");
+            $("input[name='sysUserExt.postCode']").val("");
+            $("input[name='sysUserExt.orgName']").val("");
+            $("input[name='sysUserExt.bossName']").val("");
+            $("input[name='sysUserExt.bossEmployeeId']").val("");
+            $("input[name='sysUserExt.customerCode']").val("");
+            $("input[name='sysUserExt.sapEmployeeId']").val("");
+            $("input[name='sysUserExt.isCustomerManager']").val("");
+            $("input[name='sysUserExt.isChangeExt']").val(1);
+        }
 
 		$(function() {
             $('#post').select2({

+ 3 - 1
suishenbang-admin/src/main/resources/templates/system/user/selectUser.html

@@ -84,9 +84,11 @@
                 singleSelect:true,
                 onClickRow:function (row,$element) {
                     $("#selectUserId").val(row.userId);
+                    $('.info').removeClass('info');
+                    $($element).addClass('info')
                 },
 		        columns: [{
-		            checkbox: true
+		            checkbox: false
 		        },
 				{
 					field: 'userId',

+ 3 - 0
suishenbang-admin/src/main/resources/templates/system/user/user.html

@@ -43,6 +43,9 @@
 								<li>
 									手机号码:<input type="text" name="phonenumber"/>
 								</li>
+								<li>
+									组织Code:<input type="text" name="sysUserExt.orgCode"/>
+								</li>
 								<li>
 									用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
 										<option value="">所有</option>

+ 2 - 2
suishenbang-order/src/main/java/com/dgtly/order/controller/OrderBaseController.java

@@ -86,8 +86,8 @@ public class OrderBaseController extends BaseController {
             str = restTemplate.getForObject(url, String.class);
             JSONObject json = JSONObject.parseObject(str);
             if(json.getInteger("code")==200){
-
-                mmap.put("orderBase", json.getObject("data",OrderDetailModel.class));
+                OrderDetailModel order = json.getObject("data",OrderDetailModel.class);
+                mmap.put("orderBase",order);
             }else{
                 throw new BaseException("order",json.getString("message"));
             }

+ 18 - 18
suishenbang-order/src/main/java/com/dgtly/order/domain/OrderDetailModel.java

@@ -25,17 +25,17 @@ public class OrderDetailModel extends BaseEntity
     //创建时间
     private String orderCreationTime;
     //总重量
-    private BigDecimal orderWeight = new BigDecimal("0.00000");
+    private String orderWeight ="0.0";
     //订单金额
-    private BigDecimal orderAmount = new BigDecimal("0.00000");
+    private String orderAmount = "0.0";
     //发货过账
-    private BigDecimal shipmentPosted = new BigDecimal("0.00000");
+    private String shipmentPosted = "0.0";
     //发货未过账
-    private BigDecimal shipmentNotPosted = new BigDecimal("0.00000");
+    private String shipmentNotPosted = "0.0";
     //未清金额
-    private BigDecimal unclearAmount = new BigDecimal("0.00000");
+    private String unclearAmount = "0.0";
     //冻结金额
-    private BigDecimal freezeAmount = new BigDecimal("0.00000");
+    private String freezeAmount = "0.0";
     /**
      * 订单状态 (ui上需要只需要11 12 14 15 16)
      * 10 订单初建
@@ -66,51 +66,51 @@ public class OrderDetailModel extends BaseEntity
         this.orderCreationTime = orderCreationTime;
     }
 
-    public BigDecimal getOrderWeight() {
+    public String getOrderWeight() {
         return orderWeight;
     }
 
-    public void setOrderWeight(BigDecimal orderWeight) {
+    public void setOrderWeight(String orderWeight) {
         this.orderWeight = orderWeight;
     }
 
-    public BigDecimal getOrderAmount() {
+    public String getOrderAmount() {
         return orderAmount;
     }
 
-    public void setOrderAmount(BigDecimal orderAmount) {
+    public void setOrderAmount(String orderAmount) {
         this.orderAmount = orderAmount;
     }
 
-    public BigDecimal getShipmentPosted() {
+    public String getShipmentPosted() {
         return shipmentPosted;
     }
 
-    public void setShipmentPosted(BigDecimal shipmentPosted) {
+    public void setShipmentPosted(String shipmentPosted) {
         this.shipmentPosted = shipmentPosted;
     }
 
-    public BigDecimal getShipmentNotPosted() {
+    public String getShipmentNotPosted() {
         return shipmentNotPosted;
     }
 
-    public void setShipmentNotPosted(BigDecimal shipmentNotPosted) {
+    public void setShipmentNotPosted(String shipmentNotPosted) {
         this.shipmentNotPosted = shipmentNotPosted;
     }
 
-    public BigDecimal getUnclearAmount() {
+    public String getUnclearAmount() {
         return unclearAmount;
     }
 
-    public void setUnclearAmount(BigDecimal unclearAmount) {
+    public void setUnclearAmount(String unclearAmount) {
         this.unclearAmount = unclearAmount;
     }
 
-    public BigDecimal getFreezeAmount() {
+    public String getFreezeAmount() {
         return freezeAmount;
     }
 
-    public void setFreezeAmount(BigDecimal freezeAmount) {
+    public void setFreezeAmount(String freezeAmount) {
         this.freezeAmount = freezeAmount;
     }
 

+ 72 - 113
suishenbang-order/src/main/resources/templates/order/orderbase/orderbase.html

@@ -32,18 +32,18 @@
 
                     </div>
                     <div class="row">
-                        <div class="form-group col-sm-4 row">
-                            <label class="control-label col-sm-4">销售组织:</label>
-                            <div class="input-group col-sm-8">
-                                <input class="form-control" type="text" name="salesOrgName"/>
-                            </div>
-                        </div>
-                        <div class="form-group col-sm-4">
-                            <label class="control-label col-sm-4">销售编码:</label>
-                            <div class="input-group col-sm-8">
-                                <input class="form-control" type="text" name="salesOrg"/>
-                            </div>
-                        </div>
+                        <!--<div class="form-group col-sm-4 row">-->
+                            <!--<label class="control-label col-sm-4">销售组织:</label>-->
+                            <!--<div class="input-group col-sm-8">-->
+                                <!--<input class="form-control" type="text" name="salesOrgName"/>-->
+                            <!--</div>-->
+                        <!--</div>-->
+                        <!--<div class="form-group col-sm-4">-->
+                            <!--<label class="control-label col-sm-4">销售编码:</label>-->
+                            <!--<div class="input-group col-sm-8">-->
+                                <!--<input class="form-control" type="text" name="salesOrg"/>-->
+                            <!--</div>-->
+                        <!--</div>-->
                         <div class="form-group col-sm-4 row">
                             <label class="control-label col-sm-4">信用状态:</label>
                             <div class="input-group col-sm-8">
@@ -54,17 +54,19 @@
                                 </select>
                             </div>
                         </div>
+                        <div class="form-group col-sm-4 row">
 
-                    </div>
-                    <div class="row">
-
-                        <div class="col-sm-1"></div>
-                        <div class="form-group col-sm-2">
-                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
-                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                         </div>
+                        <div class="form-group col-sm-4 row">
+                            <div class="form-group" style="float: right;">
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </div>
+                        </div>
+
                     </div>
 
+
                 </form>
             </div>
 
@@ -105,39 +107,55 @@
                     checkbox: false
                 },
                 {
-                    field : 'docNumber',
-                    title : '订单号'
+                    field : 'DOC_NUMBER',
+                    title : '订单号'
                 },
                 {
-                    field : 'customerName',
-                    title : '经销商'
+                    field : 'CUSTOMER_CODE',
+                    title : '经销商编号'
                 },
                 {
-                    field : 'salesOrgName',
-                    title : '销售组织名字'
+                    field : 'CUSTOMER_NAME',
+                    title : '经销商名字'
                 },
                 {
-                    field : 'createDate',
-                    title : '订单生成时间'
+                    field : 'CREATE_DATE',
+                    title : '订单创建时间'
                 },
+                // {
+                //     field : 'SALES_ORG_NAME',
+                //     title : '销售组织名字'
+                // },
+
+                // {
+                //     field : 'DOC_TYPE',
+                //     title : '订单类型'
+                // },
                 {
-                    field : 'docType',
-                    title : '订单类型'
+                    field : 'CREDIT_STATUS',
+                    title : '信用状态'
                 },
                 {
-                    field : 'creditStatus',
-                    title : '信用状态'
+                    field : 'CREDIT_DATE',
+                    title : '信用通过时间'
                 },
                 {
-                    field : 'creditStatus',
-                    title : '信用状态'
+                    field : 'expected_time',
+                    title : '期望到货时间',
+                    formatter :function(value,row,index){
+                        if(value==null||value==""){
+                            return "";
+                        }
+                        var d = new Date(value);
+                        return dateFormat("YYYY年mm月dd日",d);
+                    }
                 },
                 {
                     title: '操作',
                     align: 'center',
                     formatter: function(value, row, index) {
                         var actions = [];
-                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.docNumber + '\')"><i class="fa fa-edit"></i>详情</a> ');
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.DOC_NUMBER + '\')"><i class="fa fa-edit"></i>详情</a> ');
                         return actions.join('');
                     }
                 }
@@ -147,91 +165,32 @@
 
             //失去焦点事件
             //去除前后空格
-            $(".select-list input").blur(function (event){
+            $("input").blur(function (event){
                 var val =  $(event.target).val();
                 val = val.replace(/^\s+|\s+$/g,"")
                 $(event.target).val(val);
             })
         });
-        //订单开始时间
-        $("#dp-s-orderCreate").datetimepicker({
-            format: 'yyyy-mm-dd',
-            minView: "month",
-            todayBtn:  true,
-            autoclose: true,
-            endDate : new Date(),
-        }).on('changeDate', function(event) {
-            event.preventDefault();
-            event.stopPropagation();
-            var startTime = event.date;
-            $('#dp-e-orderCreate').datetimepicker('setStartDate', startTime);
-        });
-        $("#dp-e-orderCreate").datetimepicker({
-            format: 'yyyy-mm-dd',
-            minView: "month",
-            todayBtn:  true,
-            autoclose: true,
-            endDate : new Date(),
-        }).on('changeDate', function(event) {
-            event.preventDefault();
-            event.stopPropagation();
-            var endTime = event.date;
-            $("#dp-s-orderCreate").datetimepicker('setEndDate', endTime);
-        });
-
-
-        //订单结束时间
-        $("#dp-s-orderEnd").datetimepicker({
-            format: 'yyyy-mm-dd',
-            minView: "month",
-            todayBtn:  true,
-            autoclose: true,
-            endDate : new Date(),
-        }).on('changeDate', function(event) {
-            event.preventDefault();
-            event.stopPropagation();
-            var startTime = event.date;
-            $('#dp-e-orderEnd').datetimepicker('setStartDate', startTime);
-        });
-        $("#dp-e-orderEnd").datetimepicker({
-            format: 'yyyy-mm-dd',
-            minView: "month",
-            todayBtn:  true,
-            autoclose: true,
-            endDate : new Date(),
-        }).on('changeDate', function(event) {
-            event.preventDefault();
-            event.stopPropagation();
-            var endTime = event.date;
-            $("#dp-s-orderEnd").datetimepicker('setEndDate', endTime);
-        });
-
-        //订单过信用时间
-        $("#dp-s-passCredit").datetimepicker({
-            format: 'yyyy-mm-dd',
-            minView: "month",
-            todayBtn:  true,
-            autoclose: true,
-            endDate : new Date(),
-        }).on('changeDate', function(event) {
-            event.preventDefault();
-            event.stopPropagation();
-            var startTime = event.date;
-            $('#dp-e-passCredit').datetimepicker('setStartDate', startTime);
-        });
-        $("#dp-e-passCredit").datetimepicker({
-            format: 'yyyy-mm-dd',
-            minView: "month",
-            todayBtn:  true,
-            autoclose: true,
-            endDate : new Date(),
-        }).on('changeDate', function(event) {
-            event.preventDefault();
-            event.stopPropagation();
-            var endTime = event.date;
-            $("#dp-s-passCredit").datetimepicker('setEndDate', endTime);
-        });
 
+        function dateFormat(fmt, date) {
+            var ret;
+            var opt = {
+                "Y+": date.getFullYear().toString(),        // 年
+                "m+": (date.getMonth() + 1).toString(),     // 月
+                "d+": date.getDate().toString(),            // 日
+                "H+": date.getHours().toString(),           // 时
+                "M+": date.getMinutes().toString(),         // 分
+                "S+": date.getSeconds().toString()          // 秒
+                // 有其他格式化字符需求可以继续添加,必须转化成字符串
+            };
+            for (var k in opt) {
+                ret = new RegExp("(" + k + ")").exec(fmt);
+                if (ret) {
+                    fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
+                };
+            };
+            return fmt;
+        }
     </script>
 </body>
 </html>

+ 211 - 0
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/domain/Customers.java

@@ -0,0 +1,211 @@
+package com.dgtly.sync.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.dgtly.common.annotation.Excel;
+import com.dgtly.common.core.domain.BaseEntity;
+
+/**
+ * 经销商 对象 customers
+ * 
+ * @author dgtly
+ * @date 2020-08-27
+ */
+public class Customers extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long id;
+
+    /** 是否删除 */
+
+    private String isDelete;
+
+    /** 经销商 */
+    private String chainsName;
+
+    /** 经销商代号 */
+    private String chainsCode;
+
+    /** 省份 */
+    private String stateName;
+
+    /** 市 */
+    private String cityName;
+
+    /** 区 */
+    private String districtName;
+
+    /** 用户账号 */
+    private String userAccount;
+
+    /** 用户名称 */
+    private String userName;
+
+    /** 用户号 */
+    private String userNo;
+
+    /** 信用分 */
+    private Long creditScore;
+
+    /** 当前信用分 */
+    private Long currentScore;
+
+    /** $column.columnComment */
+    private String code;
+
+    /** $column.columnComment */
+    private String lineId;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setIsDelete(String isDelete)
+    {
+        this.isDelete = isDelete;
+    }
+
+    public String getIsDelete()
+    {
+        return isDelete;
+    }
+    public void setChainsName(String chainsName) 
+    {
+        this.chainsName = chainsName;
+    }
+
+    public String getChainsName() 
+    {
+        return chainsName;
+    }
+    public void setChainsCode(String chainsCode) 
+    {
+        this.chainsCode = chainsCode;
+    }
+
+    public String getChainsCode() 
+    {
+        return chainsCode;
+    }
+    public void setStateName(String stateName) 
+    {
+        this.stateName = stateName;
+    }
+
+    public String getStateName() 
+    {
+        return stateName;
+    }
+    public void setCityName(String cityName) 
+    {
+        this.cityName = cityName;
+    }
+
+    public String getCityName() 
+    {
+        return cityName;
+    }
+    public void setDistrictName(String districtName) 
+    {
+        this.districtName = districtName;
+    }
+
+    public String getDistrictName() 
+    {
+        return districtName;
+    }
+    public void setUserAccount(String userAccount) 
+    {
+        this.userAccount = userAccount;
+    }
+
+    public String getUserAccount() 
+    {
+        return userAccount;
+    }
+    public void setUserName(String userName) 
+    {
+        this.userName = userName;
+    }
+
+    public String getUserName() 
+    {
+        return userName;
+    }
+    public void setUserNo(String userNo) 
+    {
+        this.userNo = userNo;
+    }
+
+    public String getUserNo() 
+    {
+        return userNo;
+    }
+    public void setCreditScore(Long creditScore) 
+    {
+        this.creditScore = creditScore;
+    }
+
+    public Long getCreditScore() 
+    {
+        return creditScore;
+    }
+    public void setCurrentScore(Long currentScore) 
+    {
+        this.currentScore = currentScore;
+    }
+
+    public Long getCurrentScore() 
+    {
+        return currentScore;
+    }
+    public void setCode(String code) 
+    {
+        this.code = code;
+    }
+
+    public String getCode() 
+    {
+        return code;
+    }
+    public void setLineId(String lineId) 
+    {
+        this.lineId = lineId;
+    }
+
+    public String getLineId() 
+    {
+        return lineId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("isDelete", getIsDelete())
+            .append("chainsName", getChainsName())
+            .append("chainsCode", getChainsCode())
+            .append("stateName", getStateName())
+            .append("cityName", getCityName())
+            .append("districtName", getDistrictName())
+            .append("userAccount", getUserAccount())
+            .append("userName", getUserName())
+            .append("userNo", getUserNo())
+            .append("creditScore", getCreditScore())
+            .append("currentScore", getCurrentScore())
+            .append("code", getCode())
+            .append("lineId", getLineId())
+            .toString();
+    }
+}

+ 67 - 0
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/mapper/CustomersMapper.java

@@ -0,0 +1,67 @@
+package com.dgtly.sync.mapper;
+
+import com.dgtly.sync.domain.Customers;
+import org.apache.ibatis.annotations.MapKey;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 经销商 Mapper接口
+ * 
+ * @author dgtly
+ * @date 2020-08-27
+ */
+public interface CustomersMapper 
+{
+    /**
+     * 查询经销商 
+     * 
+     * @param id 经销商 ID
+     * @return 经销商 
+     */
+    public Customers selectCustomersById(Long id);
+
+    /**
+     * 查询经销商 列表
+     * 
+     * @param customers 经销商 
+     * @return 经销商 集合
+     */
+    public List<Customers> selectCustomersList(Customers customers);
+
+    /**
+     * 新增经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    public int insertCustomers(Customers customers);
+
+    /**
+     * 修改经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    public int updateCustomers(Customers customers);
+
+    /**
+     * 删除经销商 
+     * 
+     * @param id 经销商 ID
+     * @return 结果
+     */
+    public int deleteCustomersById(Long id);
+
+    /**
+     * 批量删除经销商 
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCustomersByIds(String[] ids);
+
+    @MapKey("code")
+    public Map<String,Customers> selectCustomerMap();
+}

+ 19 - 9
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/AnalysisDiyCustomerComponent.java

@@ -6,8 +6,10 @@ import com.dgtly.common.exception.BusinessException;
 import com.dgtly.common.utils.ShiroSaltUtil;
 import com.dgtly.common.utils.http.HttpUtils;
 import com.dgtly.common.utils.security.EncryptPassWordClass;
+import com.dgtly.sync.domain.Customers;
 import com.dgtly.sync.domain.SyncFailDetail;
 import com.dgtly.sync.domain.SyncLog;
+import com.dgtly.sync.mapper.CustomersMapper;
 import com.dgtly.sync.mapper.SyncFailDetailMapper;
 import com.dgtly.sync.utils.CustomerAccessTokenUtil;
 import com.dgtly.sync.utils.CustomerAccessTokenUtil.UrlType;
@@ -26,10 +28,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 @Component
 public class AnalysisDiyCustomerComponent {
@@ -39,6 +38,9 @@ public class AnalysisDiyCustomerComponent {
 
     @Autowired
     private CustomerAccessTokenUtil customerAccessTokenUtil;
+
+    @Autowired
+    private CustomersMapper customersMapper;
     @Autowired
     private SysUserServiceImpl sysUserService;
     @Autowired
@@ -81,10 +83,10 @@ public class AnalysisDiyCustomerComponent {
         Set<String> loginNameSet = sysUserService.selectAllUserLoginName();
         String managerJson = HttpUtils.sendSSLGet(customerAccessTokenUtil.getUrl(UrlType.MANAGER));
         JSONObject mjson = JSONObject.parseObject(managerJson);
-
+        Map<String,Customers> cusMap = customersMapper.selectCustomerMap();
         int code = mjson.getInteger("code");
         if(code==0){
-            success+=buildSysUser(mjson,loginNameSet,1,failDetails,packageId);
+            success+=buildSysUser(mjson,loginNameSet,1,failDetails,packageId,cusMap);
             total+=mjson.getJSONArray("userlist").size();
         }
 
@@ -95,7 +97,7 @@ public class AnalysisDiyCustomerComponent {
         JSONObject gjson = JSONObject.parseObject(guideJson);
         code = gjson.getInteger("code");
         if(code==0){
-            success+=buildSysUser(gjson,loginNameSet,0,failDetails,packageId);
+            success+=buildSysUser(gjson,loginNameSet,0,failDetails,packageId,cusMap);
             total+=gjson.getJSONArray("userlist").size();
         }
 
@@ -129,7 +131,7 @@ public class AnalysisDiyCustomerComponent {
      * @param isManager
      * @return
      */
-    public Integer buildSysUser(JSONObject json, Set<String> loginNameSet, int isManager, List<SyncFailDetail> failDetails,String packageId){
+    public Integer buildSysUser(JSONObject json, Set<String> loginNameSet, int isManager, List<SyncFailDetail> failDetails,String packageId, Map<String,Customers> cusMap){
         JSONArray jsonArray = json.getJSONArray("userlist");
         int count = 0;
 
@@ -165,8 +167,16 @@ public class AnalysisDiyCustomerComponent {
                     userExt.setCustomerCode(jo.getString("depCode"));
                     userExt.setIsCustomerManager(isManager + "");
                     userExt.setSapEmployeeId(userNo);
-                    userExt.setOrgCode(jo.getString("depCode"));
+
                     userExt.setPostName("DIY经销商");
+                    String orgCode = jo.getString("depCode");
+                    if(cusMap.containsKey(orgCode)){
+                        Customers c = cusMap.get(orgCode);
+                        userExt.setOrgCode(c.getChainsCode());
+                        userExt.setOrgName(c.getChainsName());
+
+                    }
+
                     /**======== 构建diy用户wx信息表 start===============*/
                     WxQyUser wxQyUser = new WxQyUser();
                     wxQyUser.setUserid(jo.getString("userid"));

+ 62 - 0
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/ICustomersService.java

@@ -0,0 +1,62 @@
+package com.dgtly.sync.service;
+
+import com.dgtly.sync.domain.Customers;
+
+import java.util.List;
+
+/**
+ * 经销商 Service接口
+ * 
+ * @author dgtly
+ * @date 2020-08-27
+ */
+public interface ICustomersService 
+{
+    /**
+     * 查询经销商 
+     * 
+     * @param id 经销商 ID
+     * @return 经销商 
+     */
+    public Customers selectCustomersById(Long id);
+
+    /**
+     * 查询经销商 列表
+     * 
+     * @param customers 经销商 
+     * @return 经销商 集合
+     */
+    public List<Customers> selectCustomersList(Customers customers);
+
+    /**
+     * 新增经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    public int insertCustomers(Customers customers);
+
+    /**
+     * 修改经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    public int updateCustomers(Customers customers);
+
+    /**
+     * 批量删除经销商 
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteCustomersByIds(String ids);
+
+    /**
+     * 删除经销商 信息
+     * 
+     * @param id 经销商 ID
+     * @return 结果
+     */
+    public int deleteCustomersById(Long id);
+}

+ 97 - 0
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/impl/CustomersServiceImpl.java

@@ -0,0 +1,97 @@
+package com.dgtly.sync.service.impl;
+
+import java.util.List;
+import com.dgtly.common.utils.DateUtils;
+import com.dgtly.sync.domain.Customers;
+import com.dgtly.sync.mapper.CustomersMapper;
+import com.dgtly.sync.service.ICustomersService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.dgtly.common.core.text.Convert;
+
+/**
+ * 经销商 Service业务层处理
+ * 
+ * @author dgtly
+ * @date 2020-08-27
+ */
+@Service
+public class CustomersServiceImpl implements ICustomersService
+{
+    @Autowired
+    private CustomersMapper customersMapper;
+
+    /**
+     * 查询经销商 
+     * 
+     * @param id 经销商 ID
+     * @return 经销商 
+     */
+    @Override
+    public Customers selectCustomersById(Long id)
+    {
+        return customersMapper.selectCustomersById(id);
+    }
+
+    /**
+     * 查询经销商 列表
+     * 
+     * @param customers 经销商 
+     * @return 经销商 
+     */
+    @Override
+    public List<Customers> selectCustomersList(Customers customers)
+    {
+        return customersMapper.selectCustomersList(customers);
+    }
+
+    /**
+     * 新增经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    @Override
+    public int insertCustomers(Customers customers)
+    {
+        customers.setCreateTime(DateUtils.getNowDate());
+        return customersMapper.insertCustomers(customers);
+    }
+
+    /**
+     * 修改经销商 
+     * 
+     * @param customers 经销商 
+     * @return 结果
+     */
+    @Override
+    public int updateCustomers(Customers customers)
+    {
+        customers.setUpdateTime(DateUtils.getNowDate());
+        return customersMapper.updateCustomers(customers);
+    }
+
+    /**
+     * 删除经销商 对象
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomersByIds(String ids)
+    {
+        return customersMapper.deleteCustomersByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除经销商 信息
+     * 
+     * @param id 经销商 ID
+     * @return 结果
+     */
+    @Override
+    public int deleteCustomersById(Long id)
+    {
+        return customersMapper.deleteCustomersById(id);
+    }
+}

+ 137 - 0
suishenbang-sync/suishenbang-sync-common/src/main/resources/mapper/sync/CustomersMapper.xml

@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dgtly.sync.mapper.CustomersMapper">
+    
+    <resultMap type="Customers" id="CustomersResult">
+        <result property="id"    column="id"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="isDelete"    column="is_delete"    />
+        <result property="chainsName"    column="chains_name"    />
+        <result property="chainsCode"    column="chains_code"    />
+        <result property="stateName"    column="state_name"    />
+        <result property="cityName"    column="city_name"    />
+        <result property="districtName"    column="district_name"    />
+        <result property="userAccount"    column="user_account"    />
+        <result property="userName"    column="user_name"    />
+        <result property="userNo"    column="user_no"    />
+        <result property="creditScore"    column="credit_score"    />
+        <result property="currentScore"    column="current_score"    />
+        <result property="code"    column="code"    />
+        <result property="lineId"    column="line_id"    />
+    </resultMap>
+
+    <sql id="selectCustomersVo">
+        select id, create_by, create_time, update_by, update_time, is_delete, chains_name, chains_code, state_name, city_name, district_name, user_account, user_name, user_no, credit_score, current_score, code, line_id from customers
+    </sql>
+
+    <select id="selectCustomersList" parameterType="Customers" resultMap="CustomersResult">
+        <include refid="selectCustomersVo"/>
+        <where>  
+            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
+            <if test="chainsName != null  and chainsName != ''"> and chains_name like concat('%', #{chainsName}, '%')</if>
+            <if test="chainsCode != null  and chainsCode != ''"> and chains_code = #{chainsCode}</if>
+            <if test="stateName != null  and stateName != ''"> and state_name like concat('%', #{stateName}, '%')</if>
+            <if test="cityName != null  and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
+            <if test="districtName != null  and districtName != ''"> and district_name like concat('%', #{districtName}, '%')</if>
+            <if test="userAccount != null  and userAccount != ''"> and user_account = #{userAccount}</if>
+            <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
+            <if test="userNo != null  and userNo != ''"> and user_no = #{userNo}</if>
+            <if test="creditScore != null "> and credit_score = #{creditScore}</if>
+            <if test="currentScore != null "> and current_score = #{currentScore}</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="lineId != null  and lineId != ''"> and line_id = #{lineId}</if>
+        </where>
+    </select>
+    
+    <select id="selectCustomersById" parameterType="Long" resultMap="CustomersResult">
+        <include refid="selectCustomersVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertCustomers" parameterType="Customers" useGeneratedKeys="true" keyProperty="id">
+        insert into customers
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">create_by,</if>
+            <if test="createTime != null ">create_time,</if>
+            <if test="updateBy != null  and updateBy != ''">update_by,</if>
+            <if test="updateTime != null ">update_time,</if>
+            <if test="isDelete != null ">is_delete,</if>
+            <if test="chainsName != null  and chainsName != ''">chains_name,</if>
+            <if test="chainsCode != null  and chainsCode != ''">chains_code,</if>
+            <if test="stateName != null  and stateName != ''">state_name,</if>
+            <if test="cityName != null  and cityName != ''">city_name,</if>
+            <if test="districtName != null  and districtName != ''">district_name,</if>
+            <if test="userAccount != null  and userAccount != ''">user_account,</if>
+            <if test="userName != null  and userName != ''">user_name,</if>
+            <if test="userNo != null  and userNo != ''">user_no,</if>
+            <if test="creditScore != null ">credit_score,</if>
+            <if test="currentScore != null ">current_score,</if>
+            <if test="code != null  and code != ''">code,</if>
+            <if test="lineId != null  and lineId != ''">line_id,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">#{createBy},</if>
+            <if test="createTime != null ">#{createTime},</if>
+            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
+            <if test="updateTime != null ">#{updateTime},</if>
+            <if test="isDelete != null ">#{isDelete},</if>
+            <if test="chainsName != null  and chainsName != ''">#{chainsName},</if>
+            <if test="chainsCode != null  and chainsCode != ''">#{chainsCode},</if>
+            <if test="stateName != null  and stateName != ''">#{stateName},</if>
+            <if test="cityName != null  and cityName != ''">#{cityName},</if>
+            <if test="districtName != null  and districtName != ''">#{districtName},</if>
+            <if test="userAccount != null  and userAccount != ''">#{userAccount},</if>
+            <if test="userName != null  and userName != ''">#{userName},</if>
+            <if test="userNo != null  and userNo != ''">#{userNo},</if>
+            <if test="creditScore != null ">#{creditScore},</if>
+            <if test="currentScore != null ">#{currentScore},</if>
+            <if test="code != null  and code != ''">#{code},</if>
+            <if test="lineId != null  and lineId != ''">#{lineId},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCustomers" parameterType="Customers">
+        update customers
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
+            <if test="createTime != null ">create_time = #{createTime},</if>
+            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="updateTime != null ">update_time = #{updateTime},</if>
+            <if test="isDelete != null ">is_delete = #{isDelete},</if>
+            <if test="chainsName != null  and chainsName != ''">chains_name = #{chainsName},</if>
+            <if test="chainsCode != null  and chainsCode != ''">chains_code = #{chainsCode},</if>
+            <if test="stateName != null  and stateName != ''">state_name = #{stateName},</if>
+            <if test="cityName != null  and cityName != ''">city_name = #{cityName},</if>
+            <if test="districtName != null  and districtName != ''">district_name = #{districtName},</if>
+            <if test="userAccount != null  and userAccount != ''">user_account = #{userAccount},</if>
+            <if test="userName != null  and userName != ''">user_name = #{userName},</if>
+            <if test="userNo != null  and userNo != ''">user_no = #{userNo},</if>
+            <if test="creditScore != null ">credit_score = #{creditScore},</if>
+            <if test="currentScore != null ">current_score = #{currentScore},</if>
+            <if test="code != null  and code != ''">code = #{code},</if>
+            <if test="lineId != null  and lineId != ''">line_id = #{lineId},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteCustomersById" parameterType="Long">
+        delete from customers where id = #{id}
+    </delete>
+
+    <delete id="deleteCustomersByIds" parameterType="String">
+        delete from customers where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectCustomerMap" resultMap="CustomersResult">
+       select code ,chains_name,chains_code from customers
+    </select>
+    
+</mapper>

+ 7 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/ISysUserExtService.java

@@ -75,4 +75,11 @@ public interface ISysUserExtService
      * @return 结果
      */
     public int insertOrUpSysUserExt(SysUserExt ext);
+    /**
+     * 删除后插入用户扩展信息
+     *
+     * @param sysUserExt 用户销售信息扩展
+     * @return 结果
+     */
+    public int delAndInsertSysUserExt(SysUserExt ext);
 }

+ 8 - 0
suishenbang-system/src/main/java/com/dgtly/system/service/impl/SysUserExtServiceImpl.java

@@ -7,6 +7,7 @@ import com.dgtly.system.mapper.SysUserExtMapper;
 import com.dgtly.system.domain.SysUserExt;
 import com.dgtly.system.service.ISysUserExtService;
 import com.dgtly.common.core.text.Convert;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 用户销售信息扩展Service业务层处理
@@ -112,4 +113,11 @@ public class SysUserExtServiceImpl implements ISysUserExtService
     public int insertOrUpSysUserExt(SysUserExt ext) {
         return sysUserExtMapper.insertOrUpSysUserExt(ext);
     }
+
+    @Override
+    @Transactional
+    public int delAndInsertSysUserExt(SysUserExt ext) {
+        sysUserExtMapper.deleteSysUserExtById(ext.getUserId());
+        return sysUserExtMapper.insertSysUserExt(ext);
+    }
 }

+ 4 - 0
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -109,6 +109,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and sysUserExt.salesLevel != ''">
             AND suse.sales_level = #{sysUserExt.salesLevel}
         </if>
+		<if test="sysUserExt != null and sysUserExt.orgCode !=null
+        and sysUserExt.orgCode != ''">
+			AND suse.org_code = #{sysUserExt.orgCode}
+		</if>
 		<if test="userName != null and userName != ''">
 			AND u.user_name like concat('%', #{userName}, '%')
 		</if>

+ 0 - 5
suishenbang-wxportal/suishenbang-wxportal-common/src/main/java/com/dgtly/wxportal/utils/qywxutils/QyWxSendMessageUtil.java

@@ -54,11 +54,6 @@ public class QyWxSendMessageUtil {
 
     @Async
     public void sendNoticeMessage(Set<String> customerCodes,JSONObject obj, Map<String,Map<String,Object>> maps,String temple){
-        try {
-            Thread.sleep((long)10000);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
         if(customerCodes.size()>0){
             for(String code:customerCodes){
                 if(maps.containsKey(code)&&maps.get(code).get("touser")!=null&&!maps.get(code).get("touser").toString().trim().equals("")){