zhs před 3 roky
rodič
revize
10f78a0c34

+ 2 - 2
src/main/java/com/travel/baidu/Translation.java

@@ -29,7 +29,7 @@ public class Translation {
      */
     @RequestMapping("translation")
     @ResponseBody
-    public String translation(String translationVal, String from, String to, HttpServletRequest request){
+    public JSONObject translation(String translationVal, String from, String to, HttpServletRequest request){
         // 请求url
         String url = "https://aip.baidubce.com/rpc/2.0/mt/texttrans/v1";
         Map<String, Object> mapVal = new HashMap<>();
@@ -49,7 +49,7 @@ public class Translation {
             JSONObject jsonObject = JSONObject.parseObject(result);
             JSONObject jsonObject1 = (JSONObject) jsonObject.get("result");
             List<Map<Object, Object>> list = (List<Map<Object, Object>>) jsonObject1.get("trans_result");
-            return (String) list.get(0).get("dst");
+            return jsonObject;
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 11 - 0
src/main/java/com/travel/controller/IndexController.java

@@ -2,6 +2,7 @@ package com.travel.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.travel.model.Complaints;
 import com.travel.model.IndexHome;
 import com.travel.model.LeaveWords;
 import com.travel.model.Travel;
@@ -117,4 +118,14 @@ public class IndexController {
         return indexService.addLeaveWord(leaveWords);
     }
 
+    /**
+     * 投诉
+     * @param complaints 参数
+     * @return 返回结果
+     */
+    @PostMapping("complaints")
+    public Map<String, Object> complaints(@RequestBody Complaints complaints){
+        return indexService.complaints(complaints);
+    }
+
 }

+ 47 - 7
src/main/java/com/travel/controller/SupplierController.java

@@ -117,6 +117,48 @@ public class SupplierController {
         return map;
     }
 
+    /**
+     * 注册信息提交
+     * @param supplier
+     * @return
+     */
+    @PostMapping("registered")
+    @ResponseBody
+    public Map<String, Object> registered(Supplier supplier){
+        Map<String, Object> map = new HashMap<>();
+        System.out.println(supplier.toString());
+        try{
+            supplier.setPhone(DesEncry.encrypt(supplier.getPhone()))
+                    .setIdNumber(DesEncry.encrypt(supplier.getIdNumber()));
+            Supplier user1 = supplierService.checkUser(supplier); //验证是否第一次登录
+            //判断账号是否被锁定
+            if(user1.getFlag().equals("1")){
+                map.put("msg", "500");
+                map.put("errMsg", "此账号发生异常 请联系网站管理员");
+                return map;
+            }
+            supplier.setName("TUYAGYS_" + user1.getId())
+                    .setCode(PersonalController.SerialNumber("SUP", user1.getId() + ""))
+                    .setHeadpir("https://lidaotech.oss-cn-beijing.aliyuncs.com/test/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220622112747.png")
+                    .setCaptcha("null");
+            supplierService.upddateSupplier(supplier);
+            //生成token传参
+            Map<String, String> payload = new HashMap<>();
+            payload.put("phone", supplier.getPhone());
+            payload.put("code", supplier.getCode());
+            // 生成jwt的令牌
+            String token = JWTUtil.getToken(payload);
+            supplier.setToken(token);
+            map.put("data", supplier);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+            map.put("msg", "500");
+        }
+        return map;
+    }
+
     /**
      * 手机号登录
      * @param supplier 参数
@@ -132,12 +174,10 @@ public class SupplierController {
             int count = supplierService.checkCaptcha(supplier);//校验验证码是否正确
             if(count > 0){
                 Supplier user1 = supplierService.checkUser(supplier); //验证是否第一次登录
-                if(user1.getHeadpir() == null){ //如果为空的话增加
-                    user1.setName("TUYAGYS_" + user1.getId())
-                            .setCode(PersonalController.SerialNumber("SUP", user1.getId() + ""))
-                            .setHeadpir("https://lidaotech.oss-cn-beijing.aliyuncs.com/test/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220622112747.png")
-                            .setCaptcha("null");
-                    supplierService.upddateSupplier(user1);
+                if(user1.getCode() == null){ //如果为空的话增加
+                    map.put("msg", "100");
+                    map.put("errMsg", "该账号无注册,请先注册");
+                    return map;
                 } else {
                     //登录清空验证码
                     user1.setCaptcha("null");
@@ -171,7 +211,7 @@ public class SupplierController {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            map.put("errMsg", "");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
             map.put("msg", "500");
         }
         return map;

+ 3 - 0
src/main/java/com/travel/mapper/IndexMapper.java

@@ -1,5 +1,6 @@
 package com.travel.mapper;
 
+import com.travel.model.Complaints;
 import com.travel.model.IndexHome;
 import com.travel.model.LeaveWords;
 import com.travel.model.Travel;
@@ -21,4 +22,6 @@ public interface IndexMapper {
     Map<String, Object> getSitesInfo();
 
     void addLeaveWord(LeaveWords leaveWords);
+
+    void complaints(Complaints complaints);
 }

+ 30 - 0
src/main/java/com/travel/model/Complaints.java

@@ -0,0 +1,30 @@
+package com.travel.model;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import java.io.Serializable;
+
+/**
+ * 投诉
+ */
+@Data
+@Accessors(chain = true)
+@SuppressWarnings("serial")
+public class Complaints implements Serializable {
+    /**
+     * 订单
+     */
+    private String uuid;
+    /**
+     * 姓名
+     */
+    private String talkName;
+    /**
+     * 手机号
+     */
+    private String phone;
+    /**
+     * 内容
+     */
+    private String noContent;
+}

+ 41 - 0
src/main/java/com/travel/model/Supplier.java

@@ -10,6 +10,7 @@ import java.io.Serializable;
  */
 @Data
 @Accessors(chain = true)
+@SuppressWarnings("serial")
 public class Supplier implements Serializable {
     /**
      * 主键
@@ -83,4 +84,44 @@ public class Supplier implements Serializable {
      * 余额
      */
     private String balanceOf;
+    /**
+     * 公司名称
+     */
+    private String company;
+    /**
+     * 法人
+     */
+    private String representative;
+    /**
+     * 证件类型
+     */
+    private String documentType;
+    /**
+     * 证件号码
+     */
+    private String idNumber;
+    /**
+     * 注册资本
+     */
+    private String registeredCapital;
+    /**
+     * 成立日期
+     */
+    private String setUpTheDate;
+    /**
+     * 住所
+     */
+    private String residence;
+    /**
+     * 营业执照
+     */
+    private String businessLicense;
+    /**
+     * 身份证正面
+     */
+    private String idCardJust;
+    /**
+     * 身份证反面
+     */
+    private String idCardReverse;
 }

+ 3 - 0
src/main/java/com/travel/service/IndexService.java

@@ -1,5 +1,6 @@
 package com.travel.service;
 
+import com.travel.model.Complaints;
 import com.travel.model.IndexHome;
 import com.travel.model.LeaveWords;
 import com.travel.model.Travel;
@@ -20,4 +21,6 @@ public interface IndexService {
     Map<String, Object> getSitesInfo();
 
     Map<String, Object> addLeaveWord(LeaveWords leaveWords);
+
+    Map<String, Object> complaints(Complaints complaints);
 }

+ 15 - 0
src/main/java/com/travel/service/impl/IndexServiceImpl.java

@@ -1,6 +1,7 @@
 package com.travel.service.impl;
 
 import com.travel.mapper.IndexMapper;
+import com.travel.model.Complaints;
 import com.travel.model.IndexHome;
 import com.travel.model.LeaveWords;
 import com.travel.model.Travel;
@@ -57,4 +58,18 @@ public class IndexServiceImpl implements IndexService {
         }
         return map;
     }
+
+    @Override
+    public Map<String, Object> complaints(Complaints complaints) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            indexMapper.complaints(complaints);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

+ 5 - 0
src/main/resources/config/mapping/IndexMapper.xml

@@ -71,4 +71,9 @@
         insert into tuya_leave_words(talk_name,phone,address,words_content,create_time,create_by,update_time,update_by,flag,remark)
         values(#{talkName},#{phone},#{address},#{wordsContent},SYSDATETIME(),#{createBy},SYSDATETIME(),#{updateBy},#{flag},#{remark})
     </insert>
+    <!-- 投诉 -->
+    <insert id="complaints" parameterType="Complaints">
+        insert into tuya_talk_no(uuid,talk_name,phone,address,no_content,create_time,create_by,update_time,update_by,flag,remark)
+        values(#{uuid},#{talkName},#{phone},null,#{noContent},SYSDATETIME(),null,SYSDATETIME(),null,null,null)
+    </insert>
 </mapper>

+ 0 - 1
src/main/resources/config/mapping/PrivateOrderMapper.xml

@@ -341,7 +341,6 @@
                     b.offer_name AS titleTravel,
                     b.title_img,
                     b.price_all as amount,
-                    ( b.start_time + '~' + b.end_time ) AS travelDate,
                     b.origin,
                     b.destination,
                     c.name,

+ 34 - 1
src/main/resources/config/mapping/SupplierMapper.xml

@@ -43,6 +43,36 @@
                 <if test="captcha != null and captcha != ''">
                     captcha = #{captcha},
                 </if>
+                <if test="company != null and company != ''">
+                    company = #{company},
+                </if>
+                <if test="representative != null and representative != ''">
+                    representative = #{representative},
+                </if>
+                <if test="documentType != null and documentType != ''">
+                    document_type = #{documentType},
+                </if>
+                <if test="idNumber != null and idNumber != ''">
+                    id_number = #{idNumber},
+                </if>
+                <if test="registeredCapital != null and registeredCapital != ''">
+                    registered_capital = #{registeredCapital},
+                </if>
+                <if test="setUpTheDate != null and setUpTheDate != ''">
+                    set_up_the_date = #{setUpTheDate},
+                </if>
+                <if test="residence != null and residence != ''">
+                    residence = #{residence},
+                </if>
+                <if test="businessLicense != null and businessLicense != ''">
+                    business_license = #{businessLicense},
+                </if>
+                <if test="idCardJust != null and idCardJust != ''">
+                    id_card_just = #{idCardJust},
+                </if>
+                <if test="idCardReverse != null and idCardReverse != ''">
+                    id_card_reverse = #{idCardReverse},
+                </if>
             </trim>
         </set>
         where phone=#{phone}
@@ -76,7 +106,10 @@
     <select id="checkUser" resultType="Supplier">
         select id,code,nature_supplier as natureSupplier,contact,phone,language,certificate_type as certificateType,certificate,headpir,jdrq,flag,captcha,invoice,name
         from sys_supplier
-        where phone=#{phone} and captcha=#{captcha}
+        where phone=#{phone}
+        <if test="captcha != null and captcha != ''">
+            and captcha=#{captcha}
+        </if>
     </select>
     <!-- 查询该用户跟指定供应商的目的地 -->
     <select id="getSupplierDestination" parameterType="ConfirmOrdering" resultType="ConfirmOrdering">