ソースを参照

修改广告规则

李天标 5 年 前
コミット
84453c0724

+ 32 - 0
app-api/src/main/java/com/hboxs/control/api/equipment/ADIndexController.java

@@ -64,7 +64,39 @@ public class ADIndexController {
         jsonObject.put("errmsg", "");
         return jsonObject;
     }
+    /**
+     * 设备获取广告NEW
+     */
+    @GetMapping(value = "/getAdNew", produces = "application/json;charset=UTF-8")
+    @ResponseBody
+    public Object getAdNew(String clientId) {
+        Equipment equipment = equipmentService.findByClientId(clientId);
+        String adminId = String.valueOf(equipment.getAdminId());
+        List<AD> ads = aDService.findAll();
+        ArrayList<AdVo> list = new ArrayList<>();
+        for (AD ad : ads) {
+            if(adminId.equals(ad.getAdminId())||ad.getAdminId()==null){
+                AdVo adVo = new AdVo();
+                adVo.setAdType(ad.getAdType().toValue());
+                adVo.setLocationType(ad.getLocationType().toValue());
+                adVo.setName(ad.getName());
+                adVo.setOrder(ad.getOrder());
+                adVo.setUrl(ad.getUrl());
+                adVo.setCreateDate(ad.getCreateDate());
+                adVo.setId(ad.getId());
+                adVo.setMediaPreview(ad.getMediaPreview());
+                adVo.setDuration(ad.getDuration());
+                adVo.setScreenType(ad.getScreenType());
+                list.add(adVo);
+            }
 
+        }
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("code", 0);
+        jsonObject.put("data", JSONObject.toJSON(list).toString());
+        jsonObject.put("errmsg", "");
+        return jsonObject;
+    }
     /**
      * 获取时间规则
      *

+ 2 - 1
app-api/src/main/java/com/hboxs/control/api/order/OrderController.java

@@ -819,7 +819,8 @@ public class OrderController extends BaseController {
 
 
             PushUtils.push(equipmentService.findByClientId(order.getClientId()).getGtClientId(), "支付成功", "您的订单支付成功", PushUtils.buildJson("pay_success", kindData.toString()).toString());
-
+            order.setNote(equipmentService.findByClientId(order.getClientId()).getGtClientId()+"已推送");
+            orderService.update(order);
             return "success";
         }
 

+ 20 - 3
app-backend-web/src/main/java/com/hboxs/control/admin/AdController.java

@@ -136,7 +136,13 @@ public class AdController extends BaseController {
      * 保存
      */
     @RequestMapping(value = "/save", method = RequestMethod.POST)
-    public String save(AD aD, RedirectAttributes redirectAttributes) {
+    public String save(AD aD,String username, RedirectAttributes redirectAttributes) {
+        if(username!=null){
+            Admin byUsername = adminService.findByUsername(username);
+            if(byUsername!=null){
+                aD.setAdminId(String.valueOf(byUsername.getId()));
+            }
+        }
         aDService.save(aD);
         addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
         return "redirect:list.htm";
@@ -147,6 +153,11 @@ public class AdController extends BaseController {
      */
     @RequestMapping(value = "/edit", method = RequestMethod.GET)
     public String edit(Long id, ModelMap model, HttpSession session) {
+        AD ad = aDService.find(id);
+        if(ad.getAdminId()!=null&&ad.getAdminId()!=""){
+            Admin admin = adminService.find(Long.valueOf(ad.getAdminId()));
+            model.addAttribute("username", admin.getUsername());
+        }
 
         model.addAttribute("aD", aDService.find(id));
         return "/admin/ad/edit";
@@ -156,7 +167,13 @@ public class AdController extends BaseController {
      * 更新
      */
     @RequestMapping(value = "/update", method = RequestMethod.POST)
-    public String update(AD aD, RedirectAttributes redirectAttributes) {
+    public String update(AD aD,String username, RedirectAttributes redirectAttributes) {
+        if(username!=null){
+            Admin byUsername = adminService.findByUsername(username);
+            if(byUsername!=null){
+                aD.setAdminId(String.valueOf(byUsername.getId()));
+            }
+        }
         aDService.update(aD, "");
         addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
         return "redirect:list.htm";
@@ -196,7 +213,7 @@ public class AdController extends BaseController {
         for (Equipment e : all) {
             Admin admin = adminService.find(e.getAdminId());
             if(admin.getIfForeign().equals("0")){
-//                PushUtils.push(e.getGtClientId(), "", "", PushUtils.buildJson("push", "更新广告").toString());
+                PushUtils.push(e.getGtClientId(), "", "", PushUtils.buildJson("push", "更新广告").toString());
             }
         }
         addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);

+ 1 - 0
app-backend-web/src/main/java/com/hboxs/control/admin/EquipmentApplyController.java

@@ -179,6 +179,7 @@ public class EquipmentApplyController extends BaseController {
                         equipment.setManagerId(equipmentApply.getManagerId());
                         equipment.setAdminId(adminId);
                         equipment.setAdminLevel(adminLevel);
+                        equipment.setGtClientId(gtClientId);
                         equipment.setAdminUserName(adminUserName);
                         equipment.setIsUsing(true);
                         equipment.setIsNetWork(true);

+ 8 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/add.ftl

@@ -89,6 +89,14 @@
         </tr>
         <tr>
             <th>
+                所属商家:
+            </th>
+            <td>
+                <input type="text" name="username" value="${username}" class="text" maxlength="200" />
+            </td>
+        </tr>
+        <tr>
+            <th>
                 <span class="requiredField">*</span>广告顺序:
             </th>
             <td>

+ 8 - 0
app-backend-web/src/main/webapp/WEB-INF/template/admin/ad/edit.ftl

@@ -43,6 +43,14 @@
         </tr>
         <tr>
             <th>
+                所属商家:
+            </th>
+            <td>
+                <input type="text" name="username" value="${username}" class="text" maxlength="200" />
+            </td>
+        </tr>
+        <tr>
+            <th>
                 <span class="requiredField">*</span>广告顺序:
             </th>
             <td>

+ 12 - 0
app-entity/src/main/java/com/hboxs/entity/Order.java

@@ -80,6 +80,10 @@ public class Order extends BaseEntity {
     private String clientId;
 
     /**
+     * 备注
+     */
+    private String note;
+    /**
      * 设备id
      */
     private Long equipmentId;
@@ -280,6 +284,14 @@ public class Order extends BaseEntity {
         this.sn = sn;
     }
 
+    public String getNote() {
+        return note;
+    }
+
+    public void setNote(String note) {
+        this.note = note;
+    }
+
     public String getProductName() {
         return productName;
     }