|
@@ -1,10 +1,25 @@
|
|
|
package com.szwl.controller;
|
|
|
|
|
|
|
|
|
+import com.mysql.cj.util.StringUtils;
|
|
|
+import com.szwl.model.bo.R;
|
|
|
+import com.szwl.model.bo.ResponseModel;
|
|
|
+import com.szwl.model.entity.IDRequest;
|
|
|
+import com.szwl.model.entity.TEquipment;
|
|
|
+import com.szwl.model.entity.TLogo;
|
|
|
+import com.szwl.service.TAdminService;
|
|
|
+import com.szwl.service.TEquipmentService;
|
|
|
+import com.szwl.service.TLogoService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import static com.szwl.constant.ResponseCodesEnum.P0001;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 前端控制器
|
|
@@ -17,5 +32,44 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("/tLogo")
|
|
|
public class TLogoController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ TEquipmentService tEquipmentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TAdminService tAdminService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TLogoService tLogoService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "定制logo")
|
|
|
+ @PostMapping("/customLogo")
|
|
|
+ public ResponseModel<?> customLogo(@RequestBody TEquipment equipment) {
|
|
|
+
|
|
|
+
|
|
|
+ // 获取当前设备id
|
|
|
+// Long equipmentId = idRequest.getEquipmentId();
|
|
|
+// String adminId = idRequest.getAdminId();
|
|
|
+// TEquipment equipment = tEquipmentService.getById(equipmentId);
|
|
|
+
|
|
|
+ // 根据id找到当前设备
|
|
|
+ TEquipment tEquipment = tEquipmentService.getById(equipment.getId());
|
|
|
+ if (tEquipment == null) {
|
|
|
+ return R.fail("设备为空");
|
|
|
+ }
|
|
|
+ // 当前设备的用户id
|
|
|
+ Long adminId = tEquipment.getAdminId();
|
|
|
+ // 根据用户id查看用户类型
|
|
|
+ Integer userType = tAdminService.getById(adminId).getType();
|
|
|
+ // 仅管理员可修改logo
|
|
|
+ if (userType != null && (userType == 0 || userType == 1)) {
|
|
|
+ // 获取当前logo信息
|
|
|
+ TLogo tLogo = tLogoService.getById(adminId);
|
|
|
+ System.out.println(tLogo);
|
|
|
+ // 修改logo
|
|
|
+ tLogoService.updateById(tLogo);
|
|
|
+ return R.ok(null,"logo已修改");
|
|
|
+ }
|
|
|
+ return R.fail(P0001,"仅管理员可修改logo");
|
|
|
+ }
|
|
|
}
|
|
|
|