Bladeren bron

小程序兑换积分订单新增三字段,更新查询语句,积分兑换商品创建接口加入字段判断校验

yjwang 4 dagen geleden
bovenliggende
commit
93dd3b0b00

+ 17 - 1
fs-service/src/main/java/com/fs/his/domain/FsIntegralOrder.java

@@ -71,5 +71,21 @@ public class FsIntegralOrder extends BaseEntity
     @Excel(name = "发货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date deliveryTime;
 
-
+    /**
+     * 企业微信ID
+     * **/
+    @Excel(name = "企业微信ID")
+    private Long qwUserId;
+
+    /**
+     * 销售ID
+     * **/
+    @Excel(name = "销售ID")
+    private Long companyUserId;
+
+    /**
+     * 销售公司ID
+     * **/
+    @Excel(name = "销售公司ID")
+    private Long companyId;
 }

+ 4 - 9
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -3,17 +3,8 @@ package com.fs.his.domain;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
-import com.vdurmont.emoji.EmojiParser;
-import io.swagger.models.auth.In;
 import lombok.Data;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
 import java.math.BigDecimal;
-import java.util.Base64;
 import java.util.Date;
 
 /**
@@ -152,4 +143,8 @@ public class FsUser extends BaseEntity
 
     private Long qwExtId;
 
+    /**
+     * 企微销售ID
+     * **/
+    private Long qwUserId;
 }

+ 4 - 3
fs-service/src/main/java/com/fs/his/mapper/FsIntegralOrderMapper.java

@@ -1,7 +1,6 @@
 package com.fs.his.mapper;
 
 import com.fs.his.domain.FsIntegralOrder;
-import com.fs.his.domain.FsStoreOrder;
 import com.fs.his.param.FsIntegralOrderListUParam;
 import com.fs.his.param.FsIntegralOrderParam;
 import com.fs.his.vo.FsIntegralOrderListUVO;
@@ -9,7 +8,6 @@ import com.fs.his.vo.FsIntegralOrderListVO;
 import com.fs.his.vo.FsIntegralOrderPVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -68,7 +66,7 @@ public interface FsIntegralOrderMapper
      * @return 结果
      */
     public int deleteFsIntegralOrderByOrderIds(Long[] orderIds);
-    @Select({"<script> select order_id, order_code, user_id, user_name, user_phone, user_address, item_json, integral, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time, remark from fs_integral_order " +
+    @Select({"<script> select order_id, order_code, user_id, user_name, user_phone, user_address, item_json, integral, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time,qw_user_id,company_user_id,company_id, remark from fs_integral_order " +
             "<where>  \n" +
             "            <if test=\"orderCode != null  and orderCode != ''\"> and order_code = #{orderCode}</if>\n" +
             "            <if test=\"userName != null  and userName != ''\"> and user_name like concat('%', #{userName}, '%')</if>\n" +
@@ -76,6 +74,9 @@ public interface FsIntegralOrderMapper
             "            <if test=\"integral != null  and integral != ''\"> and integral = #{integral}</if>\n" +
             "            <if test=\"status != null  and status != ''\"> and status = #{status}</if>\n" +
             "            <if test=\"deliverySn != null  and deliverySn != ''\"> and delivery_sn like concat('%', #{deliverySn}, '%')</if>\n" +
+            "            <if test=\"qwUserId != null  and qwUserId != ''\"> and qw_user_id = #{qwUserId}</if>\n" +
+            "            <if test=\"companyUserId != null  and companyUserId != ''\"> and company_user_id = #{companyUserId}</if>\n" +
+            "            <if test=\"companyId != null  and companyId != ''\"> and company_id = #{companyId}</if>\n" +
             "            <if test=\"sTime != null \">  and DATE(create_time) &gt;= DATE(#{sTime})</if>\n" +
             "            <if test=\"eTime != null \">  and DATE(create_time) &lt;= DATE(#{eTime})</if>\n" +
             "        </where> order by order_id desc"+

+ 15 - 0
fs-service/src/main/java/com/fs/his/param/FsIntegralOrderParam.java

@@ -67,4 +67,19 @@ public class FsIntegralOrderParam {
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date sTime;
+
+    /**
+     * 企业微信ID
+     * **/
+    private Long qwUserId;
+
+    /**
+     * 销售ID
+     * **/
+    private Long companyUserId;
+
+    /**
+     * 销售公司ID
+     * **/
+    private Long companyId;
 }

+ 21 - 4
fs-service/src/main/java/com/fs/his/service/impl/FsIntegralOrderServiceImpl.java

@@ -1,10 +1,9 @@
 package com.fs.his.service.impl;
 
 import cn.hutool.core.date.DateTime;
-import cn.hutool.core.util.IdUtil;
-import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.ServiceException;
@@ -12,7 +11,6 @@ import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.core.utils.OrderCodeUtils;
 import com.fs.his.domain.*;
-import com.fs.his.enums.ShipperCodeEnum;
 import com.fs.his.mapper.*;
 import com.fs.his.param.FsIntegralOrderCreateParam;
 import com.fs.his.param.FsIntegralOrderListUParam;
@@ -22,6 +20,8 @@ import com.fs.his.vo.FsIntegralOrderListUVO;
 import com.fs.his.vo.FsIntegralOrderListVO;
 import com.fs.his.vo.FsIntegralOrderPVO;
 import com.fs.his.vo.FsStoreProductDeliverExcelVO;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.mapper.QwUserMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -52,6 +52,10 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService
     private FsIntegralGoodsMapper fsIntegralGoodsMapper;
     @Autowired
     private FsUserIntegralLogsMapper fsUserIntegralLogsMapper;
+
+    @Autowired
+    private QwUserMapper qwUserMapper;
+
     /**
      * 查询积分商品订单
      *
@@ -186,6 +190,19 @@ public class FsIntegralOrderServiceImpl implements IFsIntegralOrderService
         order.setUserAddress(address.getProvince()+address.getCity()+address.getDistrict()+address.getDetail());
         order.setUserPhone(address.getPhone());
         order.setCreateTime(new Date());
+
+        //判断当前用户是否有关联企微ID
+        if(ObjectUtil.isNotNull(user.getQwUserId())){
+            //获取企微信息
+            QwUser qwUser=qwUserMapper.selectOne(new LambdaQueryWrapper<QwUser>().select(QwUser::getId,QwUser::getCompanyId,QwUser::getCompanyUserId).eq(QwUser::getId,user.getQwUserId()));
+            if(ObjectUtil.isNotNull(qwUser)){
+                //写入企业微信ID、销售ID、公司id
+                order.setQwUserId(qwUser.getId());
+                order.setCompanyId(ObjectUtil.isNotNull(qwUser.getCompanyId())?qwUser.getCompanyId():null);
+                order.setCompanyUserId(ObjectUtil.isNotNull(qwUser.getCompanyUserId())?qwUser.getCompanyUserId():null);
+            }
+        }
+
         if(fsIntegralOrderMapper.insertFsIntegralOrder(order)>0){
             //写入日志
             FsUser userMap=new FsUser();

+ 14 - 0
fs-service/src/main/java/com/fs/his/vo/FsIntegralOrderListVO.java

@@ -62,4 +62,18 @@ public class FsIntegralOrderListVO {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
+    /**
+     * 企业微信ID
+     * **/
+    private Long qwUserId;
+
+    /**
+     * 销售ID
+     * **/
+    private Long companyUserId;
+
+    /**
+     * 销售公司ID
+     * **/
+    private Long companyId;
 }

+ 10 - 1
fs-service/src/main/resources/mapper/his/FsIntegralOrderMapper.xml

@@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectFsIntegralOrderVo">
-        select order_id, order_code, user_id,bar_code, user_name, user_phone, user_address, item_json, integral, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time, remark from fs_integral_order
+        select order_id, order_code, user_id,bar_code, user_name, user_phone, user_address, item_json, integral, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time,qw_user_id,company_user_id,company_id,remark from fs_integral_order
     </sql>
 
     <select id="selectFsIntegralOrderList" parameterType="FsIntegralOrder" resultMap="FsIntegralOrderResult">
@@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="integral != null  and integral != ''"> and integral = #{integral}</if>
             <if test="status != null  and status != ''"> and status = #{status}</if>
             <if test="deliverySn != null  and deliverySn != ''"> and delivery_sn like concat('%', #{deliverySn}, '%')</if>
+            <if test="qwUserId != null  and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
+            <if test="companyUserId != null  and companyUserId != ''"> and company_user_id = #{companyUserId}</if>
+            <if test="companyId != null  and companyId != ''"> and company_id = #{companyId}</if>
             <if test="createTime != null "> and create_time = #{createTime}</if>
         </where>
     </select>
@@ -63,6 +66,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="remark != null">remark,</if>
             <if test="barCode != null">bar_code,</if>
+            <if test="qwUserId != null">qw_user_id,</if>
+            <if test="companyUserId != null">company_user_id,</if>
+            <if test="companyId != null">company_id,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="orderId != null">#{orderId},</if>
@@ -81,6 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="remark != null">#{remark},</if>
             <if test="barCode != null">#{barCode},</if>
+            <if test="qwUserId != null">#{qwUserId},</if>
+            <if test="companyUserId != null">#{companyUserId},</if>
+            <if test="companyId != null">#{companyId},</if>
          </trim>
     </insert>
 

+ 2 - 1
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -45,10 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="parentId"    column="parent_id"    />
         <result property="courseMaOpenId"    column="course_ma_open_id"    />
         <result property="qwExtId"    column="qw_ext_id"    />
+        <result property="qwUserId"    column="qw_user_id"    />
     </resultMap>
 
     <sql id="selectFsUserVo">
-        select user_id,qw_ext_id,sex,is_buy,course_ma_open_id,is_push,is_add_qw,source,login_device,is_individuation_push,store_open_id,password,jpush_id, is_vip,vip_start_date,vip_end_date,vip_level,vip_status,nick_name,integral_status, avatar, phone, integral,sign_num, status, tui_user_id, tui_time, tui_user_count, ma_open_id, mp_open_id, union_id, is_del, user_code, remark, create_time, update_time, last_ip, balance,is_weixin_auth,parent_id from fs_user
+        select user_id,qw_ext_id,sex,is_buy,course_ma_open_id,is_push,is_add_qw,source,login_device,is_individuation_push,store_open_id,password,jpush_id, is_vip,vip_start_date,vip_end_date,vip_level,vip_status,nick_name,integral_status, avatar, phone, integral,sign_num, status, tui_user_id, tui_time, tui_user_count, ma_open_id, mp_open_id, union_id, is_del, user_code, remark, create_time, update_time, last_ip, balance,is_weixin_auth,parent_id,qw_user_id from fs_user
     </sql>
 
     <select id="selectFsUserList" parameterType="FsUser" resultMap="FsUserResult">