chengcm 5 gadi atpakaļ
vecāks
revīzija
8c7aaaf781

+ 44 - 0
wjj-api/src/main/java/com/demo/wjj/controller/CertificationController.java

@@ -1,6 +1,7 @@
 package com.demo.wjj.controller;
 
 import com.demo.wjj.po.Agent;
+import com.demo.wjj.po.Sale;
 import com.demo.wjj.po.UserInfo;
 import com.demo.wjj.service.*;
 import com.demo.wjj.utils.ApiResult;
@@ -28,6 +29,9 @@ public class CertificationController {
     @Autowired
     QiNiuService qiNiuService;
 
+    @Autowired
+    SaleService saleService;
+
 
 
     /**
@@ -136,6 +140,46 @@ public class CertificationController {
         }
     }
 
+
+    @GetMapping("/getUserInfoBySaleId")
+    public ApiResult getUserInfoBySaleId(String agentId,String saleId) {
+        LOG.info("调用获取用户信息(/certification/getUserInfoBySaleId)接口");
+        try {
+            //获取销售员信息
+            Sale sale=saleService.getSale(saleId);
+            if(sale==null){
+                LOG.info("销售员信息不存在");
+            }
+            UserInfo userInfo = certificationService.getUserInfoBySaleId(agentId,sale.getWxOpenId());
+
+            if (userInfo != null) {
+                if (StringUtils.isNotBlank(userInfo.getIdcarddfrontpic())) {
+                    String Idcarddfrontpic = qiNiuService.getUrl(userInfo.getIdcarddfrontpic());
+                    userInfo.setIdcarddfrontpic(Idcarddfrontpic);
+                }
+                if (StringUtils.isNotBlank(userInfo.getIdcarddbackpic())) {
+                    String Idcarddbackpic = qiNiuService.getUrl(userInfo.getIdcarddbackpic());
+                    userInfo.setIdcarddbackpic(Idcarddbackpic);
+                }
+                if (StringUtils.isNotBlank(userInfo.getPic())) {
+                    String pic = qiNiuService.getUrl(userInfo.getPic());
+                    userInfo.setPic(pic);
+                }
+                if (StringUtils.isNotBlank(userInfo.getBankcardpic())) {
+                    String bankcardpic = qiNiuService.getUrl(userInfo.getBankcardpic());
+                    userInfo.setBankcardpic(bankcardpic);
+                }
+            }
+            ApiResult<UserInfo> apiResult = ApiResult.createSuccess(userInfo);
+            LOG.info("调用获取用户信息(/certification/getUserInfoBySaleId)接口成功");
+            LOG.debug("调用获取用户信息(/certification/getUserInfoBySaleId), apiResult:{}", apiResult);
+            return apiResult;
+        } catch (Exception e) {
+            LOG.error("调用获取用户信息(/certification/getUserInfoBySaleId)接口异常", e);
+            return ApiResult.createFailure();
+        }
+    }
+
     /**,
      * 四要素验证
      *

+ 10 - 0
wjj-api/src/main/java/com/demo/wjj/controller/DisplaceController.java

@@ -22,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.annotation.*;
@@ -65,6 +66,12 @@ public class DisplaceController {
     @Autowired
     QiNiuService qiNiuService;
 
+    /**
+     * 精品机账号
+     */
+    @Value("ZHXTCS")
+    private String excellentAccount;
+
     @InitBinder
     protected void initBinder(WebDataBinder binder) {
         Object target = binder.getTarget();
@@ -88,6 +95,9 @@ public class DisplaceController {
     @PostMapping("/save")
     public ApiResult save(@Valid SaveDisplaceQo saveDisplaceQo, BindingResult bindingResult) {
         LOG.info("调用保存置换(/displace/save)接口, saveDisplaceQo:{}", saveDisplaceQo);
+        if(saveDisplaceQo.getAgentId().equals(excellentAccount)){
+            saveDisplaceQo.setIs_good("2");
+        }
 
         if (CollectionUtils.isNotEmpty(bindingResult.getAllErrors())) {
             LOG.warn("请求参数错误");

+ 10 - 0
wjj-api/src/main/java/com/demo/wjj/controller/UserController.java

@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.ObjectError;
 import org.springframework.web.bind.WebDataBinder;
@@ -45,6 +46,12 @@ public class UserController {
     @Autowired
     private UserRegisterConverter userRegisterConverter;
 
+    /**
+     * 精品机账号
+     */
+    @Value("ZHXTCS")
+    private String excellentAccount;
+
     @InitBinder
     protected void initBinder(WebDataBinder binder) {
         Object target = binder.getTarget();
@@ -65,6 +72,9 @@ public class UserController {
     @PostMapping("/register")
     public ApiResult register(@Valid UserRegisterQo userRegisterQo, BindingResult bindingResult) {
         LOG.info("调用用户注册(/user/register)接口, userRegisterQo:{}", userRegisterQo);
+        if(excellentAccount.equals(userRegisterQo.getAgentId())){
+            userRegisterQo.setRegistType("2");
+        }
         String nickname = userRegisterQo.getNickname();
         String filterName = EmojiFilterUtil.filterEmoji(nickname);
         String regEx="[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";

+ 5 - 0
wjj-api/src/main/resources/application.properties

@@ -21,6 +21,8 @@ displaceAuditTemplateName=\u7b49\u5f85\u5ba1\u6838\u901a\u77e5
 #平台可见agentId
 platformAgentId=WGC000
 
+
+
 platform.appId=wx6af4ca6c083a5918
 platform.appSecret=515bb52094b522fd958bee043b42a9ec
 platform.token=BensF7xcrZBFnHOnSuAL
@@ -30,6 +32,9 @@ weixin.appId=wx0cb0cbc34027621f
 #第三方授权模板id
 weixin.templateId=2
 
+#精品机工号
+jpjgh=ZHXTCS
+
 
 
 #sms.url=http://web.cr6868.com/asmx/smsservice.aspx

+ 9 - 0
wjj-api/src/test/java/com/demo/wjj/controller/CertificationControllerTest.java

@@ -42,6 +42,15 @@ public class CertificationControllerTest extends BaseTest {
                 .andExpect(status().isOk());
     }
 
+    @Test
+    public void getUserInfoBySaleId() throws Exception {
+        mockMvc.perform(get("/certification/getUserInfoBySaleId")
+                .param("status", "2")
+                .param("angentId", "ZHXTCS")
+                .param("saleId", "ZHXTCS-XS5021"))
+                .andExpect(status().isOk());
+    }
+
 
 //    {
 //        "code": 1,

+ 1 - 3
wjj-api/src/test/java/com/demo/wjj/controller/DisplaceControllerTest.java

@@ -97,9 +97,7 @@ public class DisplaceControllerTest extends BaseTest {
         mockMvc.perform(get("/displace/getDisplaceGoodBuyList")
                 .param("openId", "o5C8F1bsANIpREV4ThGib-ixh0xs")
                 .param("agentId", "ZHXTCS")
-                .param("type", "1")
-                .param("pageSize", "5")
-                .param("pageNum", "1"))
+                .param("type", "1"))
                 .andExpect(status().isOk());
     }
 }

+ 2 - 0
wjj-core/src/main/java/com/demo/wjj/mapper/UserInfoMapper.java

@@ -9,6 +9,8 @@ public interface UserInfoMapper {
     List<UserInfo> getUserInfoByAgent(@Param("status") String status, @Param("agentId") String agentId);
     UserInfo getUserInfoByAgentAndOpenId(@Param("status") String status, @Param("agentId") String agentId, @Param("openId") String openId);
 
+    UserInfo getUserInfoBySaleId(@Param("agentId") String agentId, @Param("openId") String openId);
+
     UserInfo selectUserInfo(@Param("idcard") String idcard, @Param("status") String status);
 
     UserInfo selectUserInfoByIdCard(@Param("idcard") String idcard);

+ 11 - 0
wjj-core/src/main/java/com/demo/wjj/po/DisplaceAudit.java

@@ -142,6 +142,9 @@ public class DisplaceAudit extends BasePo {
      */
     private String storage;//1-完成;2-暂存
 
+    private int bill;
+
+
     public String getIs_good() {
         return is_good;
     }
@@ -158,6 +161,14 @@ public class DisplaceAudit extends BasePo {
         this.storage = storage;
     }
 
+    public int getBill() {
+        return bill;
+    }
+
+    public void setBill(int bill) {
+        this.bill = bill;
+    }
+
     public void setPersist_price(Integer persist_price) {
         this.persist_price = persist_price;
     }

+ 1 - 0
wjj-core/src/main/java/com/demo/wjj/service/CertificationService.java

@@ -16,6 +16,7 @@ public interface CertificationService {
     UserInfo getUserInfo(String idCard,String status);
     List<UserInfo> getUserInfoByAgent(String status,String agentId);
     UserInfo getUserInfoByAgentAndOpenId(String status,String agentId,String openId);
+    UserInfo getUserInfoBySaleId(String agentId,String openId);
 
     int deleteUserInfo(String idCard);
 

+ 33 - 6
wjj-core/src/main/java/com/demo/wjj/service/impl/CertificationServiceImpl.java

@@ -5,11 +5,9 @@ import com.alibaba.fastjson.JSONObject;
 import com.demo.wjj.bo.SaveDisplaceBo;
 import com.demo.wjj.mapper.DiggerAgentMapper;
 import com.demo.wjj.mapper.ExplainMapper;
+import com.demo.wjj.mapper.SaleMapper;
 import com.demo.wjj.mapper.UserInfoMapper;
-import com.demo.wjj.po.Agent;
-import com.demo.wjj.po.DiggerAgent;
-import com.demo.wjj.po.Explain;
-import com.demo.wjj.po.UserInfo;
+import com.demo.wjj.po.*;
 import com.demo.wjj.service.CertificationService;
 import com.demo.wjj.service.WeiXinMsgPushService;
 import com.demo.wjj.utils.ApiResult;
@@ -71,6 +69,9 @@ public class CertificationServiceImpl implements CertificationService {
     @Autowired
     DiggerAgentMapper diggerAgentMapper;
 
+    @Autowired
+    SaleMapper saleMapper;
+
     @ReadOnlyTransactional
     @Override
     public UserInfo getUserInfo(String idCard,String status) {
@@ -96,7 +97,14 @@ public class CertificationServiceImpl implements CertificationService {
         if(users.size()>0){
             for(UserInfo user:users){
                 DiggerAgent agent=diggerAgentMapper.selectDiggerAgent(agentId,user.getUseropenid());
-                user.setWxnc(agent.getDaWxnc());
+                if(agent!=null){
+                    user.setWxnc(agent.getDaWxnc());
+                    continue;
+                }
+                Sale sale=saleMapper.selectSale(agentId,user.getUseropenid());
+                if(sale!=null){
+                    user.setWxnc(sale.getSaleWxnc());
+                }
             }
         }
         LOG.info("退出获取用户信息");
@@ -111,13 +119,32 @@ public class CertificationServiceImpl implements CertificationService {
         UserInfo user= userInfoMapper.getUserInfoByAgentAndOpenId(status,agentId,openId);
         if(user!=null){
             DiggerAgent agent=diggerAgentMapper.selectDiggerAgent(agentId,user.getUseropenid());
-            user.setWxnc(agent.getDaWxnc());
+            if(agent!=null){
+                user.setWxnc(agent.getDaWxnc());
+                return user;
+            }
+            Sale sale=saleMapper.selectSale(agentId,user.getUseropenid());
+            if(agent!=null){
+                user.setWxnc(sale.getSaleWxnc());
+                return user;
+            }
         }
         LOG.info("退出获取用户信息");
         LOG.debug("获取取用户信息, brands:{}", user);
         return user;
     }
 
+    @ReadOnlyTransactional
+    @Override
+    public UserInfo getUserInfoBySaleId(String agentId,String openId) {
+        LOG.info("获取用户信息");
+        UserInfo user= userInfoMapper.getUserInfoBySaleId(agentId,openId);
+
+        LOG.info("退出获取用户信息");
+        LOG.debug("获取取用户信息, brands:{}", user);
+        return user;
+    }
+
 
     @Override
     public int deleteUserInfo(String idCard) {

+ 14 - 0
wjj-core/src/main/java/com/demo/wjj/service/impl/DisplaceAuditServiceImpl.java

@@ -3,7 +3,9 @@ package com.demo.wjj.service.impl;
 import com.demo.wjj.bo.DisplaceDetailBo;
 import com.demo.wjj.bo.DisplaceListBo;
 import com.demo.wjj.mapper.DisplaceAuditMapper;
+import com.demo.wjj.mapper.ExplainMapper;
 import com.demo.wjj.po.DisplaceAudit;
+import com.demo.wjj.po.Explain;
 import com.demo.wjj.service.*;
 import com.demo.wjj.utils.CommitTransactional;
 import com.demo.wjj.utils.PageBean;
@@ -35,11 +37,23 @@ public class DisplaceAuditServiceImpl implements DisplaceAuditService {
     @Autowired
     private DisplaceAssemblyService displaceAssemblyService;
 
+    @Autowired
+    private ExplainMapper explainMapper;
+
     @CommitTransactional
     @Override
     public boolean save(DisplaceAudit displaceAudit, boolean updateOperate) {
         LOG.info("进入保存置换审核, displaceAudit:{}, updateOperate:{}", displaceAudit, updateOperate);
         boolean result;
+        //判断是否精品机
+        if("2".equals(displaceAudit.getIs_good())){
+            //获取保证金
+            List<Explain> explains=explainMapper.selectExplain();
+            if(explains.size()>0&&explains.get(0)!=null){
+                Explain explain=explains.get(0);
+                displaceAudit.setBill(Integer.parseInt(explain.getDeposit()));
+            }
+        }
         if (updateOperate) {
             //存在置换id
             result = displaceAuditMapper.update(displaceAudit) > 0;

+ 3 - 2
wjj-core/src/main/java/com/demo/wjj/service/impl/WeiXinMsgPushImpl.java

@@ -447,9 +447,10 @@ public class WeiXinMsgPushImpl implements WeiXinMsgPushService {
         //模板消息推送成功后更新用户实名认证状态
         if("1".equals(status)) {
             certificationService.updateUserInfoByIdCard("2", idCard);
-        }else{
-            certificationService.updateUserInfoByIdCard("3", idCard);
         }
+//        else{
+//            certificationService.updateUserInfoByIdCard("3", idCard);
+//        }
         return true;
     }
 }

+ 3 - 0
wjj-core/src/main/resources/mybatis/DiggerAgentDisplaceManageMapper.xml

@@ -32,6 +32,7 @@
             <if test="!hasAuthority">
                 AND a.agent_id = #{agentId}
             </if>
+        AND is_good !='2'
         ORDER BY a.start_time DESC
     </select>
 
@@ -47,6 +48,7 @@
         <if test="!hasAuthority">
             AND a.agent_id = #{agentId}
         </if>
+        AND is_good !='2'
         ORDER BY a.start_time DESC
     </select>
 
@@ -71,6 +73,7 @@
         <if test="date  eq  'WeekEnd' ">
             AND YEARWEEK(a.end_time) = YEARWEEK(now())-1
         </if>
+        AND is_good !='2'
         ORDER BY a.start_time DESC
     </select>
 

+ 7 - 6
wjj-core/src/main/resources/mybatis/DisplaceAuditMapper.xml

@@ -10,8 +10,8 @@
             WHERE agent_id = #{agentId}
         </selectKey>
 
-        INSERT INTO tb_displace_audit(id, agent_id, agent_name, displace_id, idea_price, pub_time, audit_time, journalist_name, journalist_tel, audit_status, state, sale_id, others_desc, first_pic_url,is_good,storage)
-        VALUES(#{id}, #{agentId}, #{agentName}, #{displaceId}, #{ideaPrice}, #{pubTime}, #{auditTime}, #{joumalistName}, #{joumalistTel}, #{auditStatus}, #{state}, #{saleId}, #{othersDesc}, #{firstPicUrl}, #{is_good}, #{storage})
+        INSERT INTO tb_displace_audit(id, agent_id, agent_name, displace_id, idea_price, pub_time, audit_time, journalist_name, journalist_tel, audit_status, state, sale_id, others_desc, first_pic_url,is_good,storage,bail)
+        VALUES(#{id}, #{agentId}, #{agentName}, #{displaceId}, #{ideaPrice}, #{pubTime}, #{auditTime}, #{joumalistName}, #{joumalistTel}, #{auditStatus}, #{state}, #{saleId}, #{othersDesc}, #{firstPicUrl}, #{is_good}, #{storage},#{bill})
     </insert>
 
     <!--更新置换审核-->
@@ -27,7 +27,8 @@
                 sale_id = #{saleId},
                 storage = #{storage},
                 is_good = #{is_good},
-                first_pic_url = #{firstPicUrl}
+                first_pic_url = #{firstPicUrl},
+                bail=#{bill}
         WHERE id = #{id}
     </update>
 
@@ -105,7 +106,7 @@
     <!--在售设备-->
     <select id="selectDisplaceOnList" resultType="com.demo.wjj.bo.DisplaceListBo">
         SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(d.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(d.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
-        FROM tb_displace_audit a JOIN tb_offer d ON d.displace_id=a.displace_id
+        FROM tb_displace_audit a left JOIN tb_offer d ON d.displace_id=a.displace_id
         WHERE
         a.audit_status IN ('1', '3')
         AND  #{now} BETWEEN a.start_time AND a.end_time
@@ -119,7 +120,7 @@
     <!--已售设备-->
     <select id="selectDisplaceSaleList" resultType="com.demo.wjj.bo.DisplaceListBo">
         SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(b.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(b.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
-        FROM tb_displace_audit a JOIN tb_offer b ON b.displace_id=a.displace_id
+        FROM tb_displace_audit a left JOIN tb_offer b ON b.displace_id=a.displace_id
         WHERE
         a.audit_status IN ('1', '3')
         AND  #{now} > a.end_time
@@ -135,7 +136,7 @@
     <!--停售设备-->
     <select id="selectDisplaceHaltList" resultType="com.demo.wjj.bo.DisplaceListBo">
         SELECT a.id,a.is_kxc isKxc, a.up_type upType, a.displace_id displaceId, IFNULL(a.look_times, 0) lookTimes, IFNULL(b.offer_times, 0) offerTimes, a.first_pic_url picUrl, a.start_time , a.end_time startTime, IFNULL(b.max_offer, a.min_money) currentPrice,a.storage,a.is_good,a.min_price,a.max_price,a.persist_price
-        FROM tb_displace_audit a JOIN tb_offer b ON b.displace_id=a.displace_id
+        FROM tb_displace_audit a left JOIN tb_offer b ON b.displace_id=a.displace_id
         WHERE
         a.audit_status IN ('1', '3')
         AND  #{now} > a.end_time

+ 2 - 1
wjj-core/src/main/resources/mybatis/SaleMapper.xml

@@ -36,6 +36,7 @@
         <result column="sale_name" property="saleName"/>
         <result column="sale_phone" property="salePhone"/>
         <result column="sale_wxnc" property="saleWxnc"/>
+        <result column="wx_openid" property="wxOpenId"/>
     </resultMap>
 
     <!--查询销售员-->
@@ -46,7 +47,7 @@
     </select>
 
     <select id="selectSaleOfId" resultMap="sale">
-        SELECT s.id, s.agent_id, s.agent_name, s.sale_id, s.sale_name, s.sale_phone, s.sale_wxnc
+        SELECT s.id, s.agent_id, s.agent_name, s.sale_id, s.sale_name, s.sale_phone, s.sale_wxnc,s.wx_openid
         FROM tb_sales s
         WHERE s.regeister_status = '1' AND s.agent_opt = '1' AND s.sale_id = #{saleId}
     </select>

+ 7 - 0
wjj-core/src/main/resources/mybatis/UserInfoMapper.xml

@@ -19,6 +19,13 @@
         from tb_user_info
         where status = #{status} and agent_id= #{agentId} and useropenid= #{openId}
     </select>
+    <select id="getUserInfoBySaleId" resultType="com.demo.wjj.po.UserInfo">
+        select  *
+        from tb_user_info
+        where agent_id= #{agentId} and useropenid= #{openId}
+    </select>
+
+
 
     <select id="selectUserInfoByIdCard" resultType="com.demo.wjj.po.UserInfo">
         select  *