Shanks 6 лет назад
Родитель
Сommit
284f1e6b2d

+ 43 - 0
src/main/java/com/ygj/yuemum/controller/distributionchannel/MdjCalculate.java

@@ -0,0 +1,43 @@
+package com.ygj.yuemum.controller.distributionchannel;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ygj.yuemum.domain.admin.MdjCalculateOrder;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+@RestController
+public class MdjCalculate {
+    @PostMapping("/mdjCalculate")
+    public String mdjCalculate(@ModelAttribute MdjCalculateOrder mdjCalculateOrder) throws IOException {
+        HttpPost httpPost = new HttpPost("http://120.55.37.107:8763/introduce/activity");
+        CloseableHttpClient client = HttpClients.createDefault();
+        String respContent = null;
+        JSONObject jsonParam = new JSONObject();
+        jsonParam.put("odCityCode", "js");
+        jsonParam.put("odAmount", 10000);
+        jsonParam.put("odNo", "YS20181129150999");
+        jsonParam.put("odPhone", "15295794045");
+        jsonParam.put("odStatus", 1);
+        jsonParam.put("odIntroducerPhone", "15295795404");
+        jsonParam.put("odProductItem", "item_1");
+        StringEntity entity = new StringEntity(jsonParam.toString(),"utf-8");//解决中文乱码问题
+        entity.setContentEncoding("UTF-8");
+        entity.setContentType("application/json");
+        httpPost.setEntity(entity);
+        HttpResponse resp = client.execute(httpPost);
+        if(resp.getStatusLine().getStatusCode() == 200) {
+            HttpEntity he = resp.getEntity();
+            respContent = EntityUtils.toString(he,"UTF-8");
+        }
+        return respContent;
+    }
+}

+ 5 - 0
src/main/java/com/ygj/yuemum/controller/global/WeChatInfoController.java

@@ -36,6 +36,11 @@ public class WeChatInfoController {
     public int WXSendOrderMessage(@RequestParam("orderno") String orderno,@RequestParam("total") String total,@RequestParam("date") String date) throws IOException {
         return saveWeChatInfo.WXSendOrderMessage(orderno,total,date);
     }
+
+    @GetMapping("/WXSendYSOrderMessage")
+    public int WXSendYSOrderMessage(@RequestParam("orderno") String orderno,@RequestParam("total") String total,@RequestParam("date") String date,@RequestParam("type") String type) throws IOException {
+        return saveWeChatInfo.WXSendYSOrderMessage(orderno,total,date,type);
+    }
     @PostMapping("/WXSendBookingMessage")
     public int WXSendBookingMessage(@ModelAttribute CustomerBooking customerBooking) throws IOException {
         return saveWeChatInfo.WXSendBookingMessage(customerBooking);

+ 8 - 0
src/main/java/com/ygj/yuemum/controller/order/YSOrderController.java

@@ -34,6 +34,10 @@ public class YSOrderController {
     public List<YSOrder> getAllYSOrders() {
             return YSOrderService.getAll();
     }
+    @GetMapping("/queryMineOrder")
+    public List<YSOrder> queryMineOrder(@RequestParam("od_phone") String od_phone) {
+        return YSOrderService.queryMineOrder(od_phone);
+    }
 
     @GetMapping("/selectByOdNo")
     public YSOrder selectByOdNo(@RequestParam("od_no") String od_no) {
@@ -61,4 +65,8 @@ public class YSOrderController {
         return YSOrderService.getYSOrder(id);
     }
 
+    @GetMapping("/getOdno")
+    public String getOdno() {
+        return YSOrderService.getOdno();
+    }
 }

+ 2 - 0
src/main/java/com/ygj/yuemum/dao/order/YSOrderDao.java

@@ -12,6 +12,8 @@ public interface YSOrderDao {
 
     List<YSOrder> queryYSOrder(YSOrder YSOrder);
 
+    List<YSOrder> queryMineOrder(String od_phone);
+
     int deleteByPrimaryKey(Integer id);
 
     int insertSelective(YSOrder record);

+ 67 - 0
src/main/java/com/ygj/yuemum/domain/admin/MdjCalculateOrder.java

@@ -0,0 +1,67 @@
+package com.ygj.yuemum.domain.admin;
+
+public class MdjCalculateOrder {
+    private String odCityCode;;
+    private Float odAmount;
+    private String odNo;
+    private String odPhone;
+    private Integer odStatus;
+    private String odIntroducerPhone;
+    private String odProductItem;
+
+    public String getOdCityCode() {
+        return odCityCode;
+    }
+
+    public void setOdCityCode(String odCityCode) {
+        this.odCityCode = odCityCode;
+    }
+
+    public Float getOdAmount() {
+        return odAmount;
+    }
+
+    public void setOdAmount(Float odAmount) {
+        this.odAmount = odAmount;
+    }
+
+    public String getOdNo() {
+        return odNo;
+    }
+
+    public void setOdNo(String odNo) {
+        this.odNo = odNo;
+    }
+
+    public String getOdPhone() {
+        return odPhone;
+    }
+
+    public void setOdPhone(String odPhone) {
+        this.odPhone = odPhone;
+    }
+
+    public Integer getOdStatus() {
+        return odStatus;
+    }
+
+    public void setOdStatus(Integer odStatus) {
+        this.odStatus = odStatus;
+    }
+
+    public String getOdIntroducerPhone() {
+        return odIntroducerPhone;
+    }
+
+    public void setOdIntroducerPhone(String odIntroducerPhone) {
+        this.odIntroducerPhone = odIntroducerPhone;
+    }
+
+    public String getOdProductItem() {
+        return odProductItem;
+    }
+
+    public void setOdProductItem(String odProductItem) {
+        this.odProductItem = odProductItem;
+    }
+}

+ 62 - 0
src/main/java/com/ygj/yuemum/service/global/WeChatInfoService.java

@@ -179,6 +179,68 @@ public class WeChatInfoService {
         }
         return 1;
     }
+
+    public int WXSendYSOrderMessage(String orderno, String total, String date,String type) throws IOException {
+        ObjectMapper mapper = new ObjectMapper();
+
+//        String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");
+//        Map mapToken = JSON.parseObject(resultToken);
+//        String openid = String.valueOf(mapToken.get("wp_openid"));
+        Map<String,TemplateData> mapdata = new HashMap<>();
+
+        WechatTemplate wechatTemplate = new WechatTemplate();
+        wechatTemplate.setTemplate_id(OrderTemplateid);
+        wechatTemplate.setTouser(WPOPENID);
+        // 封装模板数据
+        TemplateData first = new TemplateData();
+        if (type.equals("2")) {
+            first.setValue("用户支付订单首付款成功!");
+            first.setColor("#173177");
+        } else if (type.equals("3")) {
+            first.setValue("用户支付订单尾款成功!");
+            first.setColor("#173177");
+        }
+        mapdata.put("first", first);
+
+        TemplateData keyword1 = new TemplateData();
+        keyword1.setValue(orderno);
+        keyword1.setColor("#fc6961");
+        mapdata.put("keyword1", keyword1);
+
+        TemplateData keyword2 = new TemplateData();
+        keyword2.setValue(total);
+        keyword2.setColor("#173177");
+        mapdata.put("keyword2", keyword2);
+
+        TemplateData keyword3 = new TemplateData();
+        keyword3.setValue(date);
+        keyword3.setColor("#173177");
+        mapdata.put("keyword3", keyword3);
+
+        TemplateData keyword5 = new TemplateData();
+        keyword5.setValue("请尽快安排顾问跟进!");
+        keyword5.setColor("#173177");
+        mapdata.put("remark", keyword5);
+
+        wechatTemplate.setData(mapdata);
+        String toString = mapper.writeValueAsString(wechatTemplate);
+        String result = "";
+        CloseableHttpClient httpClient = HttpClients.createDefault();
+        WeChatInfo weChatInfo = weChatInfoDao.getWeChatInfo();
+        HttpPost httpPost = new HttpPost(SENDMESSAGEURL+weChatInfo.getAccess_token());
+        StringEntity stringEntity = new StringEntity(toString, ContentType.APPLICATION_JSON);
+        stringEntity.setContentEncoding("utf-8");
+        httpPost.setEntity(stringEntity);
+        CloseableHttpResponse response = httpClient.execute(httpPost);
+        if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+            result = EntityUtils.toString(response.getEntity(), "utf-8");
+        } else {
+            return 0;
+        }
+        return 1;
+    }
+
+
     public int WXSendBookingMessage(CustomerBooking customerBooking) throws IOException {
         ObjectMapper mapper = new ObjectMapper();
 //        String resultToken = sendGet("http://yuesuo.yueguanjia.com/modoo-1/getWxPublicSender");

+ 16 - 5
src/main/java/com/ygj/yuemum/service/order/YSOrderService.java

@@ -48,18 +48,29 @@ public class YSOrderService {
         return tableData;
     }
 
+    public List<YSOrder> queryMineOrder(String od_phone){
+        return YSOrderDao.queryMineOrder(od_phone);
+    }
+
     public List<YSOrder> getAll() {
         List<YSOrder> YSOrders = YSOrderDao.getAll();
         return YSOrders;
     }
-
-    public int addYSOrder(YSOrder YSOrder) {
-        //生成订单号
-        DecimalFormat dfseq = new DecimalFormat("000");
+    public String getOdno() {
+        DecimalFormat dfseq = new DecimalFormat("000000");
         int seq = YSOrderDao.getAESeq() + 1;
         SimpleDateFormat dateFormat= new SimpleDateFormat("yyyyMMdd");
         Date date = new Date();
-        YSOrder.setOd_no("YSDD"+dateFormat.format(date)+dfseq.format(seq));
+        return "YSDD"+dateFormat.format(date)+dfseq.format(seq);
+    }
+
+    public int addYSOrder(YSOrder YSOrder) {
+        //生成订单号此处再生成
+//        DecimalFormat dfseq = new DecimalFormat("000000");
+//        int seq = YSOrderDao.getAESeq() + 1;
+//        SimpleDateFormat dateFormat= new SimpleDateFormat("yyyyMMdd");
+//        Date date = new Date();
+//        YSOrder.setOd_no("YSDD"+dateFormat.format(date)+dfseq.format(seq));
         //调用接口
         try {
             YSOrderDao.insertSelective(YSOrder);

+ 5 - 0
src/main/java/com/ygj/yuemum/shiro/ShiroConfig.java

@@ -30,6 +30,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/addEquipmenteHireHeadOnline'", "anon");
         filterChainDefinitionMap.put("/deleteEquipmenteHireHead", "anon");
         filterChainDefinitionMap.put("/deleteWXUserDefAddress", "anon");
+        filterChainDefinitionMap.put("/checkStockDate", "anon");
         filterChainDefinitionMap.put("/getBanners", "anon");
         filterChainDefinitionMap.put("/getConsultant", "anon");
         filterChainDefinitionMap.put("/getCustomerEq", "anon");
@@ -57,6 +58,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/updateWXUserDefAddress", "anon");
         filterChainDefinitionMap.put("/WXSendBookingMessage", "anon");
         filterChainDefinitionMap.put("/WXSendOrderMessage", "anon");
+        filterChainDefinitionMap.put("/WXSendYSOrderMessage", "anon");
         filterChainDefinitionMap.put("/getEquipmentAmount", "anon");
         filterChainDefinitionMap.put("/getValidPO", "anon");
         filterChainDefinitionMap.put("/getValidPosition", "anon");
@@ -72,6 +74,9 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/WXSendExtractMessage", "anon");
         filterChainDefinitionMap.put("/insertDcIntroduceLog", "anon");
         filterChainDefinitionMap.put("/getDcIntroducerConsultants", "anon");
+        filterChainDefinitionMap.put("/queryMineOrder", "anon");
+        filterChainDefinitionMap.put("/getYSOrder", "anon");
+        filterChainDefinitionMap.put("/insertYsOrderPay", "anon");
         //萌动开放权限
         filterChainDefinitionMap.put("/getNewUserCoupon", "anon");
         filterChainDefinitionMap.put("/getConsultTaskCoupon", "anon");

+ 69 - 1
src/main/resources/mybatis/mapper/order/YSOrder.xml

@@ -157,9 +157,77 @@
         order by id desc
     </select>
 
+
+    <select id="queryMineOrder" resultMap="BaseResultMap" parameterType="java.lang.String">
+        select
+        id,
+        od_no,
+        od_user_name,
+        od_user_address,
+        od_status,
+        od_phone,
+        od_startdate,
+        od_enddate,
+        od_mmid,
+        fgetmmname (od_mmid) od_mmname,
+        fgetpackagename (od_product_id) od_product_name,
+        od_product_id,
+        od_product_item_id,
+        od_cityid,
+        fgetbranches_name (od_cityid) od_cityidname,
+        od_contract,
+        od_consultantid,
+        fgetuser_name(od_consultantid) od_consultantname,
+        od_introducer_phone,
+        od_introducer_consultant,
+        od_order_amount,
+        od_mdj_amount,
+        od_vip_cash,
+        od_earnestpay,
+        od_balancepay,
+        od_ismdj,
+        od_mdjstartdate,
+        od_mdjenddate,
+        od_user,
+        fgetuser_name(od_user) od_username,
+        DATE_FORMAT(od_date, '%Y-%m-%d') od_date
+        from ys_order
+        where od_phone = #{od_phone,jdbcType=VARCHAR}
+        order by id desc
+    </select>
+
     <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
         select
-        <include refid="Base_Column_List" />
+        od_no,
+        od_user_name,
+        od_user_address,
+        od_status,
+        od_phone,
+        od_startdate,
+        od_enddate,
+        od_mmid,
+        fgetmmname (od_mmid) od_mmname,
+        fgetpackagename (od_product_id) od_product_name,
+        od_product_id,
+        od_product_item_id,
+        od_cityid,
+        fgetbranches_name (od_cityid) od_cityidname,
+        od_contract,
+        od_consultantid,
+        fgetuser_name(od_consultantid) od_consultantname,
+        od_introducer_phone,
+        od_introducer_consultant,
+        od_order_amount,
+        od_mdj_amount,
+        od_vip_cash,
+        od_earnestpay,
+        od_balancepay,
+        od_ismdj,
+        od_mdjstartdate,
+        od_mdjenddate,
+        od_user,
+        fgetuser_name(od_user) od_username,
+        DATE_FORMAT(od_date, '%Y-%m-%d') od_date
         from ys_order
         where id = #{id,jdbcType=INTEGER}
     </select>