wangxiaoming 6 vuotta sitten
vanhempi
commit
5207ad995d

+ 6 - 6
watero-common-core/src/main/java/com/iamberry/wechat/core/entity/WechatUtils.java

@@ -71,12 +71,12 @@ public class WechatUtils {
 	 */
 	public static Member getUserBySession(HttpServletRequest request) {
 
-//		Member m = new Member();
-//		m.setUserId(1);
-//		m.setUserOpenid("xxx");
-//		if(true){
-//			return m;
-//		}
+		Member m = new Member();
+		m.setUserId(1);
+		m.setUserOpenid("xxx");
+		if(true){
+			return m;
+		}
 
 		//获取一个cookie数组
 		Cookie[] cookies = request.getCookies();

+ 55 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/approval/ApprovalProductionContractService.java

@@ -0,0 +1,55 @@
+package com.iamberry.rst.faces.approval;
+
+import com.iamberry.rst.core.approval.ApprovalProductionContract;
+
+import java.util.List;
+
+/**
+ *  接口
+ * @author
+ * @Date 2018-10-22
+ */
+public interface ApprovalProductionContractService {
+    /**
+     * 获取集合
+     * @param  approvalProductionContract
+     * @return List
+     */
+    List<ApprovalProductionContract> getApprovalProductionContractList(ApprovalProductionContract  approvalProductionContract);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  approvalProductionContract
+     */
+    ApprovalProductionContract  getApprovalProductionContractById(Integer  id);
+    /**
+     * 增加数据
+     * @param  approvalProductionContract
+     * @return Integer
+     */
+    Integer  save(ApprovalProductionContract  approvalProductionContract);
+    /**
+     * 修改数据
+     * @param  approvalProductionContract
+     * @return Integer
+     */
+    Integer  update(ApprovalProductionContract  approvalProductionContract);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+    /**
+     * 增加数据 <集合>
+     * @param  approvalProductionContractList
+     * @return Integer
+     */
+    Integer  saveList(List<ApprovalProductionContract>  approvalProductionContractList);
+    /**
+     * 删除数据 <集合>
+     * @param  ids
+     * @return Integer
+     */
+    Integer  deleteList(Integer[]  ids);
+}

+ 83 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/ApprovalProductionContractServiceImpl.java

@@ -0,0 +1,83 @@
+package com.iamberry.rst.service.approval;
+
+import com.iamberry.rst.core.approval.ApprovalProductionContract;
+import com.iamberry.rst.faces.approval.ApprovalProductionContractService;
+import com.iamberry.rst.service.approval.mapper.ApprovalProductionContractMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  接口
+ * @author
+ * @Date 2018-10-22
+ */
+@Service
+public class ApprovalProductionContractServiceImpl  implements ApprovalProductionContractService {
+    @Autowired
+    private ApprovalProductionContractMapper approvalProductionContractMapper;
+    /**
+     * 获取集合
+     * @param  approvalProductionContract
+     * @return List
+     */
+    @Override
+    public List<ApprovalProductionContract> getApprovalProductionContractList(ApprovalProductionContract  approvalProductionContract){
+        return  approvalProductionContractMapper.getApprovalProductionContractList(approvalProductionContract);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  approvalProductionContract
+     */
+    @Override
+    public  ApprovalProductionContract  getApprovalProductionContractById(Integer  id){
+        return  approvalProductionContractMapper.getApprovalProductionContractById(id);
+    }
+    /**
+     * 增加数据
+     * @param  approvalProductionContract
+     * @return Integer
+     */
+    @Override
+    public  Integer  save(ApprovalProductionContract  approvalProductionContract){
+        return  approvalProductionContractMapper.save(approvalProductionContract);
+    }
+    /**
+     * 修改数据
+     * @param  approvalProductionContract
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(ApprovalProductionContract  approvalProductionContract){
+        return  approvalProductionContractMapper.update(approvalProductionContract);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  approvalProductionContractMapper.delete(id);
+    }
+    /**
+     * 增加数据 <集合>
+     * @param  approvalProductionContractList
+     * @return Integer
+     */
+    @Override
+    public  Integer  saveList(List<ApprovalProductionContract>  approvalProductionContractList){
+        return  approvalProductionContractMapper.saveList(approvalProductionContractList);
+    }
+    /**
+     * 删除数据 <集合>
+     * @param  ids
+     * @return Integer
+     */
+    @Override
+    public  Integer  deleteList(Integer[]  ids){
+        return  approvalProductionContractMapper.deleteList(ids);
+    }
+}

+ 55 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/mapper/ApprovalProductionContractMapper.java

@@ -0,0 +1,55 @@
+package com.iamberry.rst.service.approval.mapper;
+
+import com.iamberry.rst.core.approval.ApprovalProductionContract;
+
+import java.util.List;
+
+/**
+ *  接口
+ * @author
+ * @Date 2018-10-22
+ */
+public interface ApprovalProductionContractMapper {
+    /**
+     * 获取集合
+     * @param  approvalProductionContract
+     * @return List
+     */
+    List<ApprovalProductionContract> getApprovalProductionContractList(ApprovalProductionContract  approvalProductionContract);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  approvalProductionContract
+     */
+    ApprovalProductionContract  getApprovalProductionContractById(Integer  id);
+    /**
+     * 增加数据
+     * @param  approvalProductionContract
+     * @return Integer
+     */
+    Integer  save(ApprovalProductionContract  approvalProductionContract);
+    /**
+     * 修改数据
+     * @param  approvalProductionContract
+     * @return Integer
+     */
+    Integer  update(ApprovalProductionContract  approvalProductionContract);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+    /**
+     * 增加数据 <集合>
+     * @param  approvalProductionContractList
+     * @return Integer
+     */
+    Integer  saveList(List<ApprovalProductionContract>  approvalProductionContractList);
+    /**
+     * 删除数据 <集合>
+     * @param  ids
+     * @return Integer
+     */
+    Integer  deleteList(Integer[]  ids);
+}

+ 101 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/approval/mapper/approvalProductionContractMapper.xml

@@ -0,0 +1,101 @@
+<?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.iamberry.rst.service.approval.mapper.ApprovalProductionContractMapper">
+    <resultMap  id="BaseResultMap" type="ApprovalProductionContract" >
+        <result    column="contract_id"    property="contractId" />
+        <result    column="approval_id"    property="approvalId" />
+        <result    column="contract_url"    property="contractUrl" />
+        <result    column="contract_create_time"    property="contractCreateTime" />
+        <result    column="contract_name"    property="contractName" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.contract_id,
+        t.approval_id,
+        t.contract_url,
+        t.contract_create_time,
+        t.contract_name
+    </sql>
+    <select id="getApprovalProductionContractList" resultMap="BaseResultMap" parameterType="ApprovalProductionContract" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_approval_production_contract t
+        <where>
+            <if test="contractId != null ">
+                AND t.contract_id = #{contractId}
+            </if >
+            <if test="approvalId != null ">
+                AND t.approval_id = #{approvalId}
+            </if >
+            <if test="contractName != null and contractName != ''">
+                AND t.contract_name  like  CONCAT ('%',#{contractName},'%')
+            </if >
+        </where>
+    </select>
+    <select id="getApprovalProductionContractById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_approval_production_contract t
+        where t.contract_id= #{contractId}
+    </select>
+    <insert id="save" parameterType="ApprovalProductionContract" >
+        insert into
+        tb_rst_approval_production_contract
+        (
+        approval_id,
+        contract_url,
+        contract_name
+        )
+        values
+        (
+        #{approvalId},
+        #{contractUrl},
+        #{contractName}
+        )
+    </insert>
+    <update id="update" parameterType="ApprovalProductionContract" >
+        update
+        tb_rst_approval_production_contract
+        <set >
+            <if test="approvalId != null ">
+                approval_id = #{approvalId},
+            </if >
+            <if test="contractUrl != null and contractUrl != ''">
+                contract_url = #{contractUrl},
+            </if >
+            <if test="contractName != null and contractName != ''">
+                contract_name = #{contractName},
+            </if >
+        </set >
+        where contract_id= #{contractId}
+    </update>
+    <delete id="delete" parameterType="Integer" >
+        delete FROM
+        tb_rst_approval_production_contract
+        where contract_id=#{contractId}
+    </delete>
+    <insert id="saveList" parameterType="java.util.List" >
+        insert into
+        tb_rst_approval_production_contract
+        (
+        approval_id,
+        contract_url,
+        contract_name
+        )
+        values
+        <foreach collection="list" item="node" index="index" separator="," open="" close="">
+            (
+            #{node.approvalId},
+            #{node.contractUrl},
+            #{node.contractName}
+            )
+        </foreach >
+    </insert>
+    <delete id="deleteList" parameterType="String" >
+        delete FROM
+        tb_rst_approval_production_contract
+        where contract_id  in
+        <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
+            #{item}
+        </foreach >
+    </delete>
+</mapper>

+ 1 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/SalesOrderServiceImpl.java

@@ -121,7 +121,7 @@ public class SalesOrderServiceImpl implements SalesOrderService {
     @Override
     public PagedResult<SalesOrder> listSalesOrderPage(int pageNO, int pageSize, SalesOrder salesOrder, boolean isTotalNum) {
         salesOrder.setStartOrderNO((pageNO-1) * pageSize);
-        salesOrder.setEndOrderNO(pageNO * pageSize);
+        salesOrder.setEndOrderNO(pageSize);
         //查询订单列表信息
         List<SalesOrder> orderList = salesOrderMapper.listSalesOrderNew(salesOrder);
         for(SalesOrder so : orderList){

+ 8 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/approval/ApplyPickController.java

@@ -14,6 +14,7 @@ import com.iamberry.rst.faces.approval.ApplyPickService;
 import com.iamberry.rst.faces.approval.ApprovalOrderService;
 import com.iamberry.rst.faces.approval.ApprovalTaskService;
 import com.iamberry.rst.faces.sys.SysService;
+import com.iamberry.rst.service.approval.ApprovalProductionContractServiceImpl;
 import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.core.entity.WechatUtils;
 import com.iamberry.wechat.tools.ResponseJson;
@@ -44,6 +45,8 @@ public class ApplyPickController {
     private SysService sysService;
     @Autowired
     private ApprovalOrderService approvalOrderService;
+    @Autowired
+    private ApprovalProductionContractServiceImpl approvalProductionContractService;
 
     /**
      * 获取已审批通过的订单
@@ -174,8 +177,13 @@ public class ApplyPickController {
         List<ApprovalApplyPickItem> approvalApplyPickItemList = applyPickItemService.getApprovalApplyPickItemList(approvalApplyPickItem);
         approvalApplyPick.setListApplyPickItem(approvalApplyPickItemList);
 
+        ApprovalProductionContract approvalProductionContract = new ApprovalProductionContract();
+        approvalProductionContract.setApprovalId(approvalApplyPick.getApprovalId());
+        List<ApprovalProductionContract>  approvalProductionContractList = approvalProductionContractService.getApprovalProductionContractList(approvalProductionContract);
+
         ResponseJson rj = ResponseJson.getSUCCESS();
         rj.addResponseKeyValue("approvalApplyPick",approvalApplyPick);
+        rj.addResponseKeyValue("productionContractList",approvalProductionContractList);
         return rj;
     }
 

+ 0 - 1
watero-rst-web/src/main/java/com/iamberry/rst/filters/WechatFilter.java

@@ -30,7 +30,6 @@ public class WechatFilter implements Filter {
 	public void doFilter(ServletRequest request, ServletResponse response,
 						 FilterChain chain) throws IOException, ServletException {
 
-//		chain.doFilter(request, response);
 		// 权限拦截类
 		HttpServletRequest req = (HttpServletRequest) request;
 		HttpServletResponse resp = (HttpServletResponse) response;

+ 1 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -243,6 +243,7 @@
 		<mapper resource="com/iamberry/rst/service/approval/mapper/applyPickItemMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/approval/mapper/applyPickMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/approval/mapper/approvalOrderMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/approval/mapper/approvalProductionContractMapper.xml"/>
 
 		<!--member-->
 		<mapper resource="com/iamberry/rst/service/member/mapper/memberMapper.xml"/>

+ 5 - 4
watero-rst-web/src/main/webapp/WEB-INF/views/order/salesOrder/add_order.ftl

@@ -129,13 +129,13 @@
                 <label class="form-label col-1 col-sm-1">地址信息:</label>
                 <div class="formControls col-2 col-sm-2" style="">
                     <span class="select-box">
-                        <select class="select init_province" id="addressProvince"  >
+                        <select class="select init_province" id="addressProvince"  ulcName="河北"  >
                         </select>
 				    </span>
                 </div>
                 <div class="formControls col-2 col-sm-2">
                     <span class="select-box">
-                        <select  class="select init_city" id="addressCity">
+                        <select  class="select init_city" id="addressCity" ulcName="沧州市" >
                         </select>
                     </span>
                 </div>
@@ -281,9 +281,10 @@
     /*初始化省市区*/
     var address = $(".address_info").initAddress();
 
-   /* $(function (){
+  /* $(function (){
         var ulc = initAddress($(".address_info"));
-        ulc.setUlcById($("#addressProvince"),13000000);
+//        ulc.setUlcById($("#addressProvince"),13000000);
+//        ulc.setUlcById($("#addressCity"),13060000);
 //
 //        var s = $("#addressProvince").attr("ulclevel");
 //        alert(s);

+ 2 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/order/salesOrder/sales_order_list.ftl

@@ -33,8 +33,8 @@
 
             <div style="position: relative;float: left;display: block;width: 110px;height: 30px;" id="addOrderDiv" >
                 <button type="button" style="height: 30px;top: 0px;" class="my-btn-search my-order" id="addOrderType" >录入订单</button>
-                <button type="button" style="height: 30px;top: 32px;display: none;" class="my-btn-search my-order" id="addOrderManual" onclick="toAddOrderManual();">手动录入</button>
-                <button type="button" style="height: 30px;top: 64px;display: none;" class="my-btn-search my-order" id="addOrderExcel" onclick="upFiles();">Excel导入</button>
+                <button type="button" style="height: 30px;top: 30px;display: none;" class="my-btn-search my-order" id="addOrderManual" onclick="toAddOrderManual();">手动录入</button>
+                <button type="button" style="height: 30px;top: 60px;display: none;" class="my-btn-search my-order" id="addOrderExcel" onclick="upFiles();">Excel导入</button>
             </div>
 
             <div style="width: 90%;text-align: left;margin-left: 10%;">

+ 61 - 25
watero-rst-web/src/main/webapp/common/js/common/address.js

@@ -365,35 +365,35 @@ function listDistrict(cityId,districtName){
         this.$element = ele,
             this.ulcInfo = {
                 urlPrefix : "",
-                ulcLevel :  [],
-                execution:{
-                    // executionType : {
-                    //     A:initUlcLevel
-                    // } ,
-                    executionFun : []
-                }
+                ulcLevel : [],
+                judgeNameShield : []
             },
             this.options = $.extend({}, this.ulcInfo, opt)  //opt并入ulcInfo集合组成新的集合,然后赋值给 options ,所以一切调用options
     }
     //定义Address的方法
     UnlimitedLevelContact.prototype = {
         init: function() {
+            var ulc = this;
             this.initUlcLevel();
             if(this.options.ulcLevel.length > 0){
-                this.initUlc(0,"",null);
+                this.initUlcHtml(0,"",ulc.options.ulcLevel[0].ulcId);
             }
             return this;
         },
         initUlcLevel : function(){
             $(this.options.ulcLevel).each(function (index){
-                //是否选中数据  1:选中  2:未选中
+                //是否选中数据  1:选中  2:未选中 -- 初始化出来,是否需要选中第一个
                 this.isSelected = 1;
 
+                // this.isSelected attr("ulcId");
+
                 /*初始化层次结构*/
                 $(this.ulcNode).attr("ulclevel",index);
             })
         },
-        initUlc : function(level,id,thisId){
+        initUlcHtml : function(level,id,thisId){
+            level = Number(level);
+            $.ajaxSettings.async = false;
             //初始化联动
             var ulc = this;
             var node = ulc.options.ulcLevel[level];
@@ -414,23 +414,33 @@ function listDistrict(cityId,districtName){
                         var data =  node.parseData(this);
                         $(node.ulcNode).append("<option value='"+ data.id +"'>"+ data.val +"</option>");
                     })
-                    if(thisId != null){
+                    if(thisId != null && typeof thisId != "undefined" && thisId != ""){
                         //赋值本下拉框的id
                         $(node.ulcNode).val(thisId);
-                    }
-                    if(res.data.length > 0){
+                        node.ulcId = thisId;
+                    }else if(res.data.length > 0){
                         node.ulcId = node.parseData(res.data[0]).id;
-                        if(ulc.options.ulcLevel.length-1 > level &&  node.isSelected == 1){
-                            $(node.ulcNode).change(function (){
-                                ulc.initUlc(level+1,$(node.ulcNode).val());
-                            })
-                            ulc.initUlc(level+1,node.ulcId);
+                    }
+
+                    if(ulc.options.ulcLevel.length-1 > level &&  node.isSelected == 1){
+                        $(node.ulcNode).change(function (){
+                            /*点击事件*/
+                            ulc.initUlcHtml(level+1,$(node.ulcNode).val(),ulc.options.ulcLevel[level+1]);
+                        })
+                        var ulcId = ulc.options.ulcLevel[level+1].ulcId,ulcName=ulc.options.ulcLevel[level+1].ulcName;
+                        if(ulcName != null && typeof ulcName != "undefined" && ulcName != ""){
+                            ulcId = ulc.getUlcIdByName(ulc.options.ulcLevel[level+1]);
                         }
+                        if(ulcId != null && typeof ulcId != "undefined" && ulcId != ""){
+                            ulcId = ulc.options.ulcLevel[level+1].ulcId;
+                        }
+                        ulc.initUlcHtml(level+1,node.ulcId,ulcId);
                     }
                 }else{
                     console.log(res.msg);
                 }
             });
+            $.ajaxSettings.async = true;
         },
         setUlcById: function(){
             /**
@@ -443,11 +453,9 @@ function listDistrict(cityId,districtName){
                 level = arguments[0];
             }else{
                 //节点,传入节点,将进行取值ulclevel
-                level = $("#addressProvince").prop("ulclevel");
-                //https://www.cnblogs.com/zhuchenglin/p/7651990.html   异步取不到值
-                //https://blog.csdn.net/u013063153/article/details/52457307   异步取不到值
+                level = arguments[0].attr("ulclevel");
             }
-            if(level = -1){
+            if(level == -1){
                 console.log("setUlcId error!!!");
                 return ulc;
             }
@@ -455,11 +463,38 @@ function listDistrict(cityId,districtName){
             if(level != 0){
                 upperLevelId = ulc.options.ulcLevel[level-1].ulcId;
             }
-            ulc.initUlc(level,upperLevelId,arguments[1]);
+            ulc.initUlcHtml(level,upperLevelId,arguments[1]);
             return this;
         },
-        execute:function(){
-
+        getUlcIdByName:function(node,name){
+            /**
+             *  形参 1:level级别
+             *  形参 2:名称,非必填,为空的时候,使用节点获取名称
+             */
+            var $node = node.ulcNode;
+            if(name == null){
+                name = $node.attr("ulcName");
+            }
+            var ulc = this;
+            for (var i=0;i<ulc.options.judgeNameShield.length;i++){
+                name = name.replace(ulc.options.judgeNameShield[i],"");
+            }
+            var max = 0,maxValue="";
+            $node.find("option").each(function(){
+                var number=0,attrName = "";
+                if($(this).text().indexOf(name) > -1){
+                    number ++
+                    if($(this).text() == name){
+                        number ++
+                    }
+                    attrName = $(this).val();
+                }
+                if(max < number){
+                    max = number;
+                    maxValue = attrName;
+                }
+            })
+            return maxValue;
         }
     }
     // initAddress 调用
@@ -477,6 +512,7 @@ function initAddress(addressNode){
     var $country = $(".address_info").find(".init_country");
     var ulc = $(".address_info").initUlc({
         urlPrefix: root_path,
+        judgeNameShield : ["省","市","县","乡","镇","市","自治区"],
         ulcLevel :  [
             {
                 ulcNode: $provice,	//节点