Browse Source

去掉旧的移动短信发送,增加供应商短信发送选择功能

ZC 4 weeks ago
parent
commit
6afbf24bef

+ 7 - 0
ruoyi-modules/hh-basic/src/main/java/com/hh/pms/sae/controller/BsSupplierController.java

@@ -580,4 +580,11 @@ public class BsSupplierController extends BaseController {
         }
         return toAjax(i);
     }
+
+    // 供应商接收短信状态更新
+    @Log(title = "供应商短信接收",businessType = BusinessType.UPDATE)
+    @PutMapping("/updateSupplierSms")
+    public AjaxResult updateSupplierSms(BsSupplier bsSupplier){
+        return toAjax(bsSupplierService.updateSupplierSms(bsSupplier));
+    }
 }

+ 2 - 0
ruoyi-modules/hh-basic/src/main/java/com/hh/pms/sae/mapper/BsSupplierMapper.java

@@ -130,4 +130,6 @@ public interface BsSupplierMapper {
     // 根据名称获取供应商信息
     public BsSupplier getSupplierByName(String company);
 
+    // 更新供应商接收短信状态
+    public int updateSupplierSms(BsSupplier bsSupplier);
 }

+ 2 - 0
ruoyi-modules/hh-basic/src/main/java/com/hh/pms/sae/service/IBsSupplierService.java

@@ -130,4 +130,6 @@ public interface IBsSupplierService {
 
     // 根据名称获取供应商信息
     public BsSupplier getSupplierByName(String company);
+
+    public int updateSupplierSms(BsSupplier bsSupplier);
 }

+ 5 - 0
ruoyi-modules/hh-basic/src/main/java/com/hh/pms/sae/service/impl/BsSupplierServiceImpl.java

@@ -164,4 +164,9 @@ public class BsSupplierServiceImpl implements IBsSupplierService {
     public BsSupplier getSupplierByName(String company) {
         return bsSupplierMapper.getSupplierByName(company);
     }
+
+    @Override
+    public int updateSupplierSms(BsSupplier bsSupplier) {
+        return bsSupplierMapper.updateSupplierSms(bsSupplier);
+    }
 }

+ 4 - 0
ruoyi-modules/hh-basic/src/main/resources/mapper/BsSupplierMapper.xml

@@ -489,4 +489,8 @@
         select * from bs_supplier where h_name like concat('%', #{company}, '%')
     </select>
 
+    <update id="updateSupplierSms">
+        update bs_supplier set h_sms = #{hSms} where hid = #{hid}
+    </update>
+
 </mapper>

+ 0 - 131
ruoyi-modules/hh-bidding/src/main/java/com/hh/bidding/controller/BidIvrController.java

@@ -241,137 +241,6 @@ public class BidIvrController extends BaseController
         bidMessageService.insertBidMessage(bidMessage);
     }
 
-    // 短信发送接口(专家)
-    @PostMapping("/sendSmsExpert")
-    public AjaxResult sendSmsExpert(SmsParam smsParam) throws UnsupportedEncodingException, NoSuchAlgorithmException {
-        String[] param = new String[8];
-        param[1] = smsParam.getYear();
-        param[2] = smsParam.getMonth();
-        param[3] = smsParam.getDay();
-        param[4] = smsParam.getHour();
-        param[5] = smsParam.getMinute();
-        param[6] = smsParam.getPosition();
-
-        List<String> list = smsParam.getjNameList();
-        List<String> phoneList = smsParam.getPhoneList();
-        List<BsExpert> expertList = smsParam.getExpertList();
-        SubmitTemplateReq submitTemplateReq = new SubmitTemplateReq();
-
-        for (int i = 0; i < expertList.size(); i++) {
-            param[0] = expertList.get(i).getjName();
-            submitTemplateReq.setApId("gm_bz");
-            submitTemplateReq.setEcName("黑龙江省国辰工程项目管理有限责任公司");
-            submitTemplateReq.setSecretKey("8Q@@Xmiu6");
-            submitTemplateReq.setParams(JSON.toJSONString(param));
-            submitTemplateReq.setMobiles(expertList.get(i).getjPhone());
-            submitTemplateReq.setAddSerial("");
-            submitTemplateReq.setSign("mQiMiDjdG");
-            submitTemplateReq.setTemplateId("278bcc53103241acac4b0f787a31c275");
-            StringBuffer stringBuffer = new StringBuffer();
-            stringBuffer.append(submitTemplateReq.getEcName());
-            stringBuffer.append(submitTemplateReq.getApId());
-            stringBuffer.append(submitTemplateReq.getSecretKey());
-            stringBuffer.append(submitTemplateReq.getTemplateId());
-            stringBuffer.append(submitTemplateReq.getMobiles());
-            stringBuffer.append(submitTemplateReq.getParams());
-            stringBuffer.append(submitTemplateReq.getSign());
-            stringBuffer.append(submitTemplateReq.getAddSerial());
-            submitTemplateReq.setMac(MD5Utils.md5Hex(stringBuffer.toString().getBytes("UTF-8")).toLowerCase());
-            String reqText = JSON.toJSONString(submitTemplateReq);
-            String encode = Base64.encodeBase64String(reqText.getBytes());
-            Map<String,String> map = new HashMap<>();
-            map.put("encode",encode);
-
-            // 向远程地址发送短信发送请求
-            try {
-                URL url = new URL("http://112.33.46.17:37891/sms/tmpsubmit");
-                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-                conn.setRequestMethod("POST");
-                conn.setDoOutput(true);
-                String postParams = encode;
-                byte[] outputInBytes = postParams.getBytes("UTF-8");
-                OutputStream os = conn.getOutputStream();
-                os.write(outputInBytes);
-                os.close();
-                int responseCode = conn.getResponseCode();
-                System.out.println("POST Response Code :: " + responseCode);
-                if (responseCode == HttpURLConnection.HTTP_OK) {
-                    // 处理服务器响应
-                    System.out.println("POST request succeeded");
-                } else {
-                    System.out.println("POST request failed");
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        return toAjax(expertList.size());
-    }
-
-    // 短信发送接口 (供应商)
-    @PostMapping("/sendSmsSupplier")
-    public AjaxResult sendSmsSupplier(@RequestBody SmsParam smsParam) throws UnsupportedEncodingException, NoSuchAlgorithmException {
-        String[] param = new String[6];
-        param[0] = smsParam.getCompany();
-        param[1] = smsParam.getYear();
-        param[2] = smsParam.getMonth();
-        param[3] = smsParam.getDay();
-        param[4] = smsParam.getMaterialName();
-
-        List<String> phoneList = smsParam.getPhoneList();
-        String mobiles = StringUtils.join(phoneList,",");
-
-        SubmitTemplateReq submitTemplateReq = new SubmitTemplateReq();
-        submitTemplateReq.setApId("gm_bz");
-        submitTemplateReq.setEcName("黑龙江省国辰工程项目管理有限责任公司");
-        submitTemplateReq.setSecretKey("8Q@@Xmiu6");
-        submitTemplateReq.setParams(JSON.toJSONString(param));
-        submitTemplateReq.setMobiles(mobiles);
-        submitTemplateReq.setAddSerial("");
-        submitTemplateReq.setSign("mQiMiDjdG");
-        submitTemplateReq.setTemplateId("9ec1d4578ad6451ebec1486f229c92c4");
-        StringBuffer stringBuffer = new StringBuffer();
-        stringBuffer.append(submitTemplateReq.getEcName());
-        stringBuffer.append(submitTemplateReq.getApId());
-        stringBuffer.append(submitTemplateReq.getSecretKey());
-        stringBuffer.append(submitTemplateReq.getTemplateId());
-        stringBuffer.append(submitTemplateReq.getMobiles());
-        stringBuffer.append(submitTemplateReq.getParams());
-        stringBuffer.append(submitTemplateReq.getSign());
-        stringBuffer.append(submitTemplateReq.getAddSerial());
-        submitTemplateReq.setMac(MD5Utils.md5Hex(stringBuffer.toString().getBytes("UTF-8")).toLowerCase());
-        String reqText = JSON.toJSONString(submitTemplateReq);
-        String encode = Base64.encodeBase64String(reqText.getBytes());
-
-        Map<String,String> map = new HashMap<>();
-        map.put("encode",encode);
-
-        // 向远程地址发送短信发送请求
-        try {
-            URL url = new URL("http://112.33.46.17:37891/sms/tmpsubmit");
-            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-            conn.setRequestMethod("POST");
-            conn.setDoOutput(true);
-            String postParams = encode;
-            byte[] outputInBytes = postParams.getBytes("UTF-8");
-            OutputStream os = conn.getOutputStream();
-            os.write(outputInBytes);
-            os.close();
-            int responseCode = conn.getResponseCode();
-            System.out.println("POST Response Code :: " + responseCode);
-            if (responseCode == HttpURLConnection.HTTP_OK) {
-                // 处理服务器响应
-                System.out.println("POST request succeeded");
-            } else {
-                System.out.println("POST request failed");
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-
-        return toAjax(phoneList.size());
-    }
-
     // 短信发送方法
     public static void main(String[] args) throws Exception {
         DyvmsUtil dyvmsUtil = new DyvmsUtil();

+ 1 - 1
ruoyi-modules/hh-bidding/src/main/resources/mapper/BidCommitteeMapper.xml

@@ -133,6 +133,6 @@
     </update>
 
     <update id="updateExpertStatus" parameterType="com.hh.bidding.domain.BidCommittee">
-        update bid_committee set status = 3 where pb_id = #{pbId}
+        update bid_committee set status = #{status} where pb_id = #{pbId}
     </update>
 </mapper>

+ 1 - 1
ruoyi-modules/hh-bidding/src/main/resources/mapper/BidTenderMapper.xml

@@ -490,7 +490,7 @@
     </select>
 
     <select id="selectSupplier" parameterType="String">
-        select hid from bs_supplier where material like concat('%[', #{materialId}, ',%') or material like concat('%,', #{materialId}, ',%') or material like concat('%,', #{materialId}, ']%') or material like concat('%[', #{materialId}, ']%')
+        select hid from bs_supplier where h_sms != 1 and (material like concat('%[', #{materialId}, ',%') or material like concat('%,', #{materialId}, ',%') or material like concat('%,', #{materialId}, ']%') or material like concat('%[', #{materialId}, ']%'))
     </select>
 
     <select id="selectPhones" parameterType="Integer">