|
@@ -166,7 +166,90 @@ public class IndexController extends BaseController {
|
|
|
return JsonMessage.success("设备申请中,请耐心等待");
|
|
|
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 设备申请
|
|
|
+ *
|
|
|
+ * @param clientId 个推
|
|
|
+ * @param managerId 管理系统id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/initNew", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public JsonMessage initNew(String clientId, String managerId, String gtClientId,String equimentType) {
|
|
|
+
|
|
|
+ long size = equipmentService.count(Filter.eq("clientId", clientId));
|
|
|
+
|
|
|
+ if (size > 0) {
|
|
|
+ return JsonMessage.error("该设备已经初始化");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(gtClientId)) {
|
|
|
+ return JsonMessage.error("设备不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ EquipmentApply equipmentApply = new EquipmentApply();
|
|
|
+ equipmentApply.setStatusType(EquipmentApply.StatusType.applying);
|
|
|
+ equipmentApply.setClientId(clientId);
|
|
|
+ equipmentApply.setManagerId(managerId);
|
|
|
+ equipmentApply.setGtClientId(gtClientId);
|
|
|
+ Long adminId = AdminUtils.decrypt(false, managerId);
|
|
|
+
|
|
|
+ Admin admin = adminService.find(adminId);
|
|
|
+ if (admin == null) {
|
|
|
+ return JsonMessage.error("找不到商家");
|
|
|
+ }
|
|
|
+ //所属商家
|
|
|
+ String username = admin.getUsername();
|
|
|
+
|
|
|
+ Long agencyId = admin.getAgencyId();
|
|
|
+
|
|
|
+ Long merchantId = admin.getMerchantId();
|
|
|
+ Long personageId = admin.getPersonageId();
|
|
|
+ Admin.Type type = admin.getType();
|
|
|
+ EquipmentApply.Type eApplyType = null;
|
|
|
+ switch (type) {
|
|
|
+ case personage:
|
|
|
+ if (admin.getType() != Admin.Type.personage) {
|
|
|
+ return JsonMessage.error("设备商家类型错误");
|
|
|
+ }
|
|
|
+ eApplyType = EquipmentApply.Type.personage;
|
|
|
+ break;
|
|
|
+ case merchant:
|
|
|
+ if (admin.getType() != Admin.Type.merchant) {
|
|
|
+ return JsonMessage.error("设备商家类型错误");
|
|
|
+ }
|
|
|
+ eApplyType = EquipmentApply.Type.merchant;
|
|
|
+ break;
|
|
|
+ case agency:
|
|
|
+ if (admin.getType() != Admin.Type.agency) {
|
|
|
+ return JsonMessage.error("设备商家类型错误");
|
|
|
+ }
|
|
|
+ eApplyType = EquipmentApply.Type.agency;
|
|
|
+ break;
|
|
|
+ case admin:
|
|
|
+ if (admin.getType() != Admin.Type.admin) {
|
|
|
+ return JsonMessage.error("设备商家类型错误");
|
|
|
+ }
|
|
|
+ eApplyType = EquipmentApply.Type.admin;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取商家级别
|
|
|
+ String adminLevel = type.toValue();
|
|
|
+ equipmentApply.setAdminId(adminId);
|
|
|
+ equipmentApply.setAdminUserName(username);
|
|
|
+ equipmentApply.setAdminLevel(adminLevel);
|
|
|
+ equipmentApply.setAgencyId(agencyId);
|
|
|
+ equipmentApply.setMerchantId(merchantId);
|
|
|
+ equipmentApply.setPersonageId(personageId);
|
|
|
+ equipmentApply.setType(eApplyType);
|
|
|
+ equipmentApply.setEquimentType(equimentType);
|
|
|
|
|
|
+ equipmentApplyService.save(equipmentApply);
|
|
|
+ return JsonMessage.success("设备申请中,请耐心等待");
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 商品调价
|
|
@@ -556,13 +639,13 @@ public class IndexController extends BaseController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/updateEqeStatusNew", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
- public JsonMessage updateEqeStatusNew(String clientId, Integer eqeStatus,String network) {
|
|
|
+ public JsonMessage updateEqeStatusNew(String clientId, Integer eqeStatus,String netTime) {
|
|
|
Equipment equipment = equipmentService.findByClientId(clientId);
|
|
|
if (equipment == null) {
|
|
|
|
|
|
return JsonMessage.error("该设备不存在");
|
|
|
}
|
|
|
- equipment.setNetwork(network);
|
|
|
+ equipment.setNetwork(netTime);
|
|
|
equipment.setEqeStatus(eqeStatus);
|
|
|
equipmentService.update(equipment);
|
|
|
return JsonMessage.success("修改成功");
|