dcs пре 1 месец
родитељ
комит
15298a6cac

+ 6 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/controller/OrderInfoController.java

@@ -129,4 +129,10 @@ public class OrderInfoController {
         return Response.ok(orderInfoService.countPay(organizationId));
     }
 
+    @ApiOperation("创建过程订单")
+    @RequestMapping(value = "/create/proce/{proceId}/{payOrganizationId}", method = RequestMethod.GET)
+    public Response createOrderByProceId(@PathVariable long proceId, @PathVariable long payOrganizationId) {
+        return Response.ok(orderInfoService.createOrderByProceId(proceId, payOrganizationId));
+    }
+
 }

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/dao/ProceDao.java

@@ -16,6 +16,8 @@ public interface ProceDao {
 
     public int updateStatus(Integer status, List<Long> ids);
 
+    public int updatePayStatus(Proce proce);
+
     public int delete(long id);
 
     List<Proce> getList(long orderId);

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/OrderInfo.java

@@ -126,6 +126,11 @@ public class OrderInfo {
      */
     private Invoice invoice;
 
+    /**
+     * 过程id
+     */
+    private long proceId;
+
     public Long getId() {
         return id;
     }
@@ -309,4 +314,12 @@ public class OrderInfo {
     public void setInvoice(Invoice invoice) {
         this.invoice = invoice;
     }
+
+    public long getProceId() {
+        return proceId;
+    }
+
+    public void setProceId(long proceId) {
+        this.proceId = proceId;
+    }
 }

+ 40 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/Proce.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.api.workark.model;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -68,6 +69,21 @@ public class Proce {
      */
     private Integer status;
 
+    /**
+     * 0-默认 1-附件  2-收费
+     */
+    private Integer type;
+
+    /**
+     * 金额(元)
+     */
+    private BigDecimal totalFee;
+
+    /**
+     * 支付状态
+     */
+    private String payStatus;
+
     public long getId() {
         return id;
     }
@@ -179,4 +195,28 @@ public class Proce {
     public void setStatus(Integer status) {
         this.status = status;
     }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public BigDecimal getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(BigDecimal totalFee) {
+        this.totalFee = totalFee;
+    }
+
+    public String getPayStatus() {
+        return payStatus;
+    }
+
+    public void setPayStatus(String payStatus) {
+        this.payStatus = payStatus;
+    }
 }

+ 27 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/ProceModel.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.api.workark.model;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -46,6 +47,16 @@ public class ProceModel {
      */
     private String remark;
 
+    /**
+     * 0-默认 1-附件  2-收费
+     */
+    private Integer type;
+
+    /**
+     * 金额(元)
+     */
+    private BigDecimal totalFee;
+
     private List<ProceModel> children;
 
     public long getId() {
@@ -127,4 +138,20 @@ public class ProceModel {
     public void setChildren(List<ProceModel> children) {
         this.children = children;
     }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public BigDecimal getTotalFee() {
+        return totalFee;
+    }
+
+    public void setTotalFee(BigDecimal totalFee) {
+        this.totalFee = totalFee;
+    }
 }

+ 34 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/service/OrderInfoService.java

@@ -131,6 +131,8 @@ public class OrderInfoService {
         proce.setAttachmentNumber(proceModel.getAttachmentNumber());
         proce.setRoleId(proceModel.getRoleId());
         proce.setRemark(proceModel.getRemark());
+        proce.setType(proceModel.getType());
+        proce.setTotalFee(proceModel.getTotalFee());
         proceDao.save(proce);
         if (proceModel.getChildren().size() > 0) {
             for (ProceModel model : proceModel.getChildren()) {
@@ -205,6 +207,12 @@ public class OrderInfoService {
         orderInfo.setOrderStatus(orderStatus.getType());
         orderInfo.setPaymentType(PayType.WXPAY.getType());
         orderInfoDao.update(orderInfo);
+
+        if(orderInfo.getProceId() != 0){
+            Proce proce = proceDao.get(orderInfo.getProceId());
+            proce.setPayStatus(orderStatus.getType());
+            proceDao.updatePayStatus(proce);
+        }
     }
 
     public JSONObject calculateDetails(long productId, List<ProductCoupon> productCouponList) {
@@ -361,4 +369,30 @@ public class OrderInfoService {
         return map;
     }
 
+    @Transactional
+    public OrderInfo createOrderByProceId(long proceId, long payOrganizationId) {
+
+        long userId = ContextUtils.getUserContext().getUserId();
+
+        //获取过程支付信息
+        Proce proce = proceDao.get(proceId);
+
+        Product product = productDao.get(proce.getProductId());
+
+        //生成订单
+        OrderInfo orderInfo = new OrderInfo();
+        orderInfo.setTitle(proce.getName());
+        orderInfo.setOrderNo(OrderNoUtils.getOrderNo()); //订单号
+        orderInfo.setTotalFee(proce.getTotalFee()); //元
+        orderInfo.setOrderStatus(OrderStatus.NOTPAY.getType());
+        orderInfo.setUserId(userId);
+        orderInfo.setProductId(product.getId());
+        orderInfo.setOrganizationId(product.getOrganizationId());
+        orderInfo.setProductLevelId(proce.getProductLevelId());
+        orderInfo.setPayOrganizationId(payOrganizationId);
+        orderInfoDao.save(orderInfo);
+
+        return orderInfo;
+
+    }
 }

+ 11 - 2
virgo.api/src/main/resources/mapper/ProceMapper.xml

@@ -18,6 +18,9 @@
         <result column="roleId" property="roleId"/>
         <result column="remark" property="remark"/>
         <result column="status" property="status"/>
+        <result column="type" property="type"/>
+        <result column="totalFee" property="totalFee"/>
+        <result column="payStatus" property="payStatus"/>
     </resultMap>
 
     <select id="get" resultMap="result">
@@ -37,8 +40,8 @@
     </select>
 
     <insert id="save" parameterType="com.bosshand.virgo.api.workark.model.ProceModel" useGeneratedKeys="true" keyProperty="id">
-        INSERT into workark_proce(name, parentId, orderId, productId, productLevelId, sequence, attachment, attachmentNumber, attachmentContent, roleId, remark)
-        values(#{name}, #{parentId}, #{orderId}, #{productId}, #{productLevelId}, #{sequence}, #{attachment}, #{attachmentNumber}, #{attachmentContent}, #{roleId}, #{remark})
+        INSERT into workark_proce(name, parentId, orderId, productId, productLevelId, sequence, attachment, attachmentNumber, attachmentContent, roleId, remark, type, totalFee)
+        values(#{name}, #{parentId}, #{orderId}, #{productId}, #{productLevelId}, #{sequence}, #{attachment}, #{attachmentNumber}, #{attachmentContent}, #{roleId}, #{remark}, #{type}, #{totalFee)
     </insert>
 
     <update id="update" parameterType="com.bosshand.virgo.api.workark.model.ProceModel">
@@ -53,6 +56,8 @@
             <if test="roleId!=0">roleId=#{roleId},</if>
             <if test="remark!=null">remark=#{remark},</if>
             <if test="attachmentContent!=null">attachmentContent=#{attachmentContent},</if>
+            <if test="type!=null">type=#{type},</if>
+            <if test="totalFee!=null">totalFee=#{totalFee},</if>
             attachmentNumber=#{attachmentNumber},
             sequence=#{sequence},
         </trim>
@@ -66,6 +71,10 @@
         </foreach>
     </update>
 
+    <update id="updatePayStatus" parameterType="com.bosshand.virgo.api.workark.model.ProceModel">
+        UPDATE workark_proce set payStatus = #{payStatus} WHERE id = #{id}
+    </update>
+
     <delete id="delete">
         DELETE FROM workark_proce where id = #{id}
     </delete>

+ 6 - 2
virgo.api/src/main/resources/mapper/ProceModelMapper.xml

@@ -14,6 +14,8 @@
         <result column="attachmentNumber" property="attachmentNumber"/>
         <result column="roleId" property="roleId"/>
         <result column="remark" property="remark"/>
+        <result column="type" property="type"/>
+        <result column="totalFee" property="totalFee"/>
     </resultMap>
 
     <select id="get" resultMap="result">
@@ -33,8 +35,8 @@
     </select>
 
     <insert id="save" parameterType="com.bosshand.virgo.api.workark.model.ProceModel" useGeneratedKeys="true" keyProperty="id">
-        INSERT into workark_proce_model(name, parentId, productLevelId, sequence, attachment, attachmentNumber, roleId, remark)
-        values(#{name}, #{parentId}, #{productLevelId}, #{sequence}, #{attachment}, #{attachmentNumber}, #{roleId}, #{remark})
+        INSERT into workark_proce_model(name, parentId, productLevelId, sequence, attachment, attachmentNumber, roleId, remark, type, totalFee)
+        values(#{name}, #{parentId}, #{productLevelId}, #{sequence}, #{attachment}, #{attachmentNumber}, #{roleId}, #{remark}, #{type}, #{totalFee})
     </insert>
 
     <update id="update" parameterType="com.bosshand.virgo.api.workark.model.ProceModel">
@@ -46,6 +48,8 @@
             <if test="attachment!=null">attachment=#{attachment},</if>
             <if test="roleId!=0">roleId=#{roleId},</if>
             <if test="remark!=null">remark=#{remark},</if>
+            <if test="type!=null">type=#{type},</if>
+            <if test="totalFee!=null">totalFee=#{totalFee},</if>
             attachmentNumber=#{attachmentNumber},
             sequence=#{sequence},
         </trim>