厂家列表,电子厂等页面,鱼缸厂等页面
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.Interceptor;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class CheckSumBuilder {
|
||||
|
||||
// 计算并获取CheckSum
|
||||
public static String getCheckSum(String appSecret, String nonce, String curTime) {
|
||||
return encode("sha1", appSecret + nonce + curTime);
|
||||
}
|
||||
|
||||
// 计算并获取md5值
|
||||
public static String getMD5(String requestBody) {
|
||||
return encode("md5", requestBody);
|
||||
}
|
||||
|
||||
private static String encode(String algorithm, String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
MessageDigest messageDigest
|
||||
= MessageDigest.getInstance(algorithm);
|
||||
messageDigest.update(value.getBytes());
|
||||
return getFormattedText(messageDigest.digest());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getFormattedText(byte[] bytes) {
|
||||
int len = bytes.length;
|
||||
StringBuilder buf = new StringBuilder(len * 2);
|
||||
for (int j = 0; j < len; j++) {
|
||||
buf.append(HEX_DIGITS[(bytes[j] >> 4) & 0x0f]);
|
||||
buf.append(HEX_DIGITS[bytes[j] & 0x0f]);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.Interceptor;
|
||||
|
||||
import com.ifish.enums.ResultEnum;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class IfishException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 4182058914725642218L;
|
||||
|
||||
private String result;
|
||||
|
||||
public IfishException(ResultEnum resultEnum) {
|
||||
super(resultEnum.getValue());
|
||||
this.result = resultEnum.getKey();
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public class Tbl_Device implements java.io.Serializable {
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = -7095234476683939631L;
|
||||
private static final long serialVersionUID = 204106348073538365L;
|
||||
|
||||
/**
|
||||
* 设备Id
|
||||
@@ -80,12 +80,6 @@ public class Tbl_Device implements java.io.Serializable {
|
||||
@Column(name = "on_off", nullable = true, length = 1)
|
||||
private String onOff;
|
||||
|
||||
/**
|
||||
* 是否接收离线通知:1接收,0不接受
|
||||
*/
|
||||
@Column(name = "off_line", nullable = true, length = 1)
|
||||
private String offLine;
|
||||
|
||||
/**
|
||||
* 今天是否提醒:1提醒、0不提醒
|
||||
*/
|
||||
@@ -314,24 +308,6 @@ public class Tbl_Device implements java.io.Serializable {
|
||||
this.onOff = onOff;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否接收离线通知:1接收,0不接受
|
||||
*
|
||||
* @return 是否接收离线通知:1接收
|
||||
*/
|
||||
public String getOffLine() {
|
||||
return this.offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否接收离线通知:1接收,0不接受
|
||||
*
|
||||
* @param offLine 是否接收离线通知:1接收,0不接受
|
||||
*/
|
||||
public void setOffLine(String offLine) {
|
||||
this.offLine = offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今天是否提醒:1提醒、0不提醒
|
||||
*
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Tbl_Device_User implements java.io.Serializable {
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = -4018159739383033383L;
|
||||
private static final long serialVersionUID = 5123379244673522530L;
|
||||
|
||||
/**
|
||||
* id
|
||||
@@ -36,7 +36,7 @@ public class Tbl_Device_User implements java.io.Serializable {
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
@Column(name = "user_id", unique = true, nullable = false, length = 10)
|
||||
@Column(name = "user_id", nullable = false, length = 10)
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
@@ -93,6 +93,12 @@ public class Tbl_Device_User implements java.io.Serializable {
|
||||
@Column(name = "is_live", nullable = true, length = 1)
|
||||
private String isLive;
|
||||
|
||||
/**
|
||||
* 是否开启离线提醒,1开启,0关闭,默认1
|
||||
*/
|
||||
@Column(name = "off_line", nullable = true, length = 1)
|
||||
private String offLine;
|
||||
|
||||
/**
|
||||
* 获取id
|
||||
*
|
||||
@@ -290,4 +296,22 @@ public class Tbl_Device_User implements java.io.Serializable {
|
||||
public void setIsLive(String isLive) {
|
||||
this.isLive = isLive;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否开启离线提醒,1开启,0关闭,默认1
|
||||
*
|
||||
* @return 是否开启离线提醒
|
||||
*/
|
||||
public String getOffLine() {
|
||||
return this.offLine;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否开启离线提醒,1开启,0关闭,默认1
|
||||
*
|
||||
* @param offLine 是否开启离线提醒,1开启,0关闭,默认1
|
||||
*/
|
||||
public void setOffLine(String offLine) {
|
||||
this.offLine = offLine;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.bean;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
/**
|
||||
* 鱼缸场详情表(tbl_vender_list)
|
||||
*
|
||||
* @author bianj
|
||||
* @version 1.0.0 2017-06-27
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "tbl_vender_list")
|
||||
public class Tbl_Vender_List implements java.io.Serializable {
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final long serialVersionUID = 2462685903502867014L;
|
||||
|
||||
/**
|
||||
* 鱼缸厂编号
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "brand_code", unique = true, nullable = false, length = 20)
|
||||
private String brandCode;
|
||||
|
||||
/**
|
||||
* logo
|
||||
*/
|
||||
@Column(name = "brand_logo", nullable = true, length = 100)
|
||||
private String brandLogo;
|
||||
|
||||
/**
|
||||
* 鱼缸厂名称
|
||||
*/
|
||||
@Column(name = "brand_name", nullable = false, length = 20)
|
||||
private String brandName;
|
||||
|
||||
/**
|
||||
* 品牌介绍
|
||||
*/
|
||||
@Column(name = "brand_introduce", nullable = true, length = 100)
|
||||
private String brandIntroduce;
|
||||
|
||||
/**
|
||||
* app展示
|
||||
*/
|
||||
@Column(name = "app_show", nullable = true, length = 1)
|
||||
private String appShow;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Column(name = "contact_phone", nullable = true, length = 30)
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 联系地址
|
||||
*/
|
||||
@Column(name = "contact_address", nullable = true, length = 50)
|
||||
private String contactAddress;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(name = "update_time", nullable = true)
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(name = "create_time", nullable = true)
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 获取鱼缸厂编号
|
||||
*
|
||||
* @return 鱼缸厂编号
|
||||
*/
|
||||
public String getBrandCode() {
|
||||
return this.brandCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置鱼缸厂编号
|
||||
*
|
||||
* @param brandCode 鱼缸厂编号
|
||||
*/
|
||||
public void setBrandCode(String brandCode) {
|
||||
this.brandCode = brandCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取logo
|
||||
*
|
||||
* @return logo
|
||||
*/
|
||||
public String getBrandLogo() {
|
||||
return this.brandLogo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置logo
|
||||
*
|
||||
* @param brandLogo logo
|
||||
*/
|
||||
public void setBrandLogo(String brandLogo) {
|
||||
this.brandLogo = brandLogo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取鱼缸厂名称
|
||||
*
|
||||
* @return 鱼缸厂名称
|
||||
*/
|
||||
public String getBrandName() {
|
||||
return this.brandName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置鱼缸厂名称
|
||||
*
|
||||
* @param brandName 鱼缸厂名称
|
||||
*/
|
||||
public void setBrandName(String brandName) {
|
||||
this.brandName = brandName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌介绍
|
||||
*
|
||||
* @return 品牌介绍
|
||||
*/
|
||||
public String getBrandIntroduce() {
|
||||
return this.brandIntroduce;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置品牌介绍
|
||||
*
|
||||
* @param brandIntroduce 品牌介绍
|
||||
*/
|
||||
public void setBrandIntroduce(String brandIntroduce) {
|
||||
this.brandIntroduce = brandIntroduce;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app展示
|
||||
*
|
||||
* @return app展示
|
||||
*/
|
||||
public String getAppShow() {
|
||||
return this.appShow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置app展示
|
||||
*
|
||||
* @param appShow app展示
|
||||
*/
|
||||
public void setAppShow(String appShow) {
|
||||
this.appShow = appShow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取联系电话
|
||||
*
|
||||
* @return 联系电话
|
||||
*/
|
||||
public String getContactPhone() {
|
||||
return this.contactPhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置联系电话
|
||||
*
|
||||
* @param contactPhone 联系电话
|
||||
*/
|
||||
public void setContactPhone(String contactPhone) {
|
||||
this.contactPhone = contactPhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取联系地址
|
||||
*
|
||||
* @return 联系地址
|
||||
*/
|
||||
public String getContactAddress() {
|
||||
return this.contactAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置联系地址
|
||||
*
|
||||
* @param contactAddress 联系地址
|
||||
*/
|
||||
public void setContactAddress(String contactAddress) {
|
||||
this.contactAddress = contactAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取更新时间
|
||||
*
|
||||
* @return 更新时间
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return this.updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置更新时间
|
||||
*
|
||||
* @param updateTime 更新时间
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取创建时间
|
||||
*
|
||||
* @return 创建时间
|
||||
*/
|
||||
public Date getCreateTime() {
|
||||
return this.createTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置创建时间
|
||||
*
|
||||
* @param createTime 创建时间
|
||||
*/
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.multipart.MultipartResolver;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
import org.springframework.web.multipart.support.StandardServletMultipartResolver;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
|
||||
@@ -81,8 +82,8 @@ public class WebConfig extends WebMvcConfigurerAdapter {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MultipartResolver multipartResolver() throws IOException {
|
||||
return new StandardServletMultipartResolver();
|
||||
public CommonsMultipartResolver multipartResolver() {
|
||||
return new CommonsMultipartResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package com.ifish.controller;
|
||||
|
||||
import com.ifish.bean.Tbl_Factory_List;
|
||||
import com.ifish.helper.FactoryHelperI;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -72,7 +73,7 @@ public class Factory {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子厂
|
||||
* 修改(添加)电子厂
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -94,4 +95,23 @@ public class Factory {
|
||||
return factoryHelperI.deleteFactory(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加电子厂页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/addFactory"}, method = RequestMethod.GET)
|
||||
public ModelAndView addFactory() {
|
||||
return factoryHelperI.addFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/querylist"}, method = RequestMethod.GET)
|
||||
public ModelAndView querylist() {
|
||||
return factoryHelperI.addFactory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.controller;
|
||||
|
||||
import com.ifish.bean.Tbl_Vender_List;
|
||||
import com.ifish.helper.VenderHelperI;
|
||||
import java.io.File;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Controller
|
||||
public class Vender {
|
||||
|
||||
@Autowired
|
||||
private VenderHelperI venderHelperI;
|
||||
|
||||
/**
|
||||
* 鱼缸厂列表页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/venderlist"}, method = RequestMethod.GET)
|
||||
public ModelAndView getlist() {
|
||||
return venderHelperI.getlist();
|
||||
}
|
||||
|
||||
/**
|
||||
* 鱼缸厂列表页数据
|
||||
*
|
||||
* @param draw
|
||||
* @param start
|
||||
* @param length
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/venderdata"}, method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getlistData(String draw, Integer start, Integer length, String appShow, String sortField, String sortMode, String brandName) {
|
||||
return venderHelperI.getlistData(draw, start, length, appShow, sortField, sortMode, brandName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 鱼缸厂详情展示页
|
||||
*
|
||||
* @param brandCode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/venderdetail"}, method = RequestMethod.GET)
|
||||
public ModelAndView getvender(String brandCode) {
|
||||
return venderHelperI.getvender(brandCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改,插入 鱼缸厂信息
|
||||
*
|
||||
* @param brandLogoImg
|
||||
* @param tbl_Vender_List
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/updateVender"}, method = RequestMethod.POST, produces = " text/html;charset=utf-8")
|
||||
@ResponseBody
|
||||
public Object updateVender(Tbl_Vender_List tbl_Vender_List, MultipartFile brandLogoImg) {
|
||||
return venderHelperI.updateVender(brandLogoImg, tbl_Vender_List);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增鱼缸厂页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/addVender"}, method = RequestMethod.GET)
|
||||
public ModelAndView addVender() {
|
||||
return venderHelperI.addVender();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据鱼缸厂code删除鱼缸厂信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/deleteVender"}, method = RequestMethod.POST, produces = " text/html;charset=utf-8")
|
||||
@ResponseBody
|
||||
public Object deleteVender(String code) {
|
||||
return venderHelperI.deleteVender(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改鱼缸厂在APP端是否展示
|
||||
*
|
||||
* @param code
|
||||
* @param appshow
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/updateAppShow"}, method = RequestMethod.POST, produces = " text/html;charset=utf-8")
|
||||
@ResponseBody
|
||||
public Object updateAppShow(String code, String appshow) {
|
||||
return venderHelperI.updateAppShow(code, appshow);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -207,6 +207,8 @@ public class FactoryHelper implements FactoryHelperI {
|
||||
*/
|
||||
@Override
|
||||
public Object updateFactory(String[] brandCodes, String[] hardwareTypes, String factoryName, String factoryCode) {
|
||||
Tbl_Factory_List tbl_Factory_List = tbl_Factory_List_Mapper.getFactory_ListByCode(factoryCode);
|
||||
if (tbl_Factory_List != null) {
|
||||
int i = tbl_Factory_List_Mapper.updateFactory(factoryName, factoryCode);
|
||||
if (i > 0) {
|
||||
List<Tbl_HardWare_Type> allHardWare_Types = tbl_Factory_List_Mapper.getAllHardWare_TypeList();
|
||||
@@ -225,7 +227,71 @@ public class FactoryHelper implements FactoryHelperI {
|
||||
}
|
||||
return "修改成功!";
|
||||
|
||||
} else {
|
||||
return "修改失败";
|
||||
}
|
||||
return "修改失败!";
|
||||
} else {
|
||||
tbl_Factory_List = new Tbl_Factory_List();
|
||||
tbl_Factory_List.setFactoryCode(factoryCode);
|
||||
tbl_Factory_List.setFactoryName(factoryName);
|
||||
int i = tbl_Factory_List_Mapper.insertFactoryList(tbl_Factory_List);
|
||||
if (i > 0) {
|
||||
List<Tbl_HardWare_Type> allHardWare_Types = tbl_Factory_List_Mapper.getAllHardWare_TypeList();
|
||||
List<String> hardwareTypeslist = Arrays.asList(hardwareTypes);
|
||||
for (Tbl_HardWare_Type HardWare_Type : allHardWare_Types) {
|
||||
if (hardwareTypeslist.contains(HardWare_Type.getHardwareType()) && (StringUtils.isBlank(HardWare_Type.getFactoryCode()) || !HardWare_Type.getFactoryCode().equals(factoryCode))) {
|
||||
tbl_Factory_List_Mapper.updateHardWareType(factoryCode, HardWare_Type.getHardwareType());
|
||||
} else if (!hardwareTypeslist.contains(HardWare_Type.getHardwareType()) && (StringUtils.isNotBlank(HardWare_Type.getFactoryCode()) && HardWare_Type.getFactoryCode().equals(factoryCode))) {
|
||||
tbl_Factory_List_Mapper.updateHardWareType(null, HardWare_Type.getHardwareType());
|
||||
}
|
||||
}
|
||||
|
||||
tbl_Factory_List_Mapper.deleteFactoryVender(factoryCode);
|
||||
for (String brandCode : brandCodes) {
|
||||
tbl_Factory_List_Mapper.insertFactoryVender(factoryCode, brandCode);
|
||||
}
|
||||
return "添加电子厂成功!";
|
||||
}
|
||||
return "添加电子厂失败!";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加电子厂页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAndView addFactory() {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
|
||||
//所有鱼缸厂关系
|
||||
List<Map> vendList = tbl_Factory_List_Mapper.getAllVenderList();
|
||||
mv.addObject("vendlist", vendList);
|
||||
//设备信息
|
||||
List<Tbl_HardWare_Type> allHardWare_Types = tbl_Factory_List_Mapper.getAllHardWare_TypeList();
|
||||
mv.addObject("hardlist", allHardWare_Types);
|
||||
|
||||
mv.setViewName("factorydetail");
|
||||
mv.addObject("title", "添加电子厂");
|
||||
mv.addObject("pagetitle", "添加电子厂");
|
||||
mv.addObject("myjs", "<!-- Other plugins ( load only nessesary plugins for every page) -->\n"
|
||||
+ " <script src=\"static/assets/plugins/core/moment/moment.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/sparklines/jquery.sparkline.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/pie-chart/jquery.easy-pie-chart.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/icheck/jquery.icheck.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tags/jquery.tagsinput.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tinymce/tinymce.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/tables/jquery.dataTables.js\"></script>\n"
|
||||
+ "<link href=\"static/assets/plugins/tables/jquery.dataTables.css\" rel=\"stylesheet\">"
|
||||
+ "<link href=\"static/assets/plugins/tables/dataTables.bootstrap.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/plugins/tables/dataTables.bootstrap.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/highlight/highlight.pack.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/countTo/jquery.countTo.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/js/jquery.sprFlat.js\"></script>\n"
|
||||
+ " <script src=\"static/switchery/switchery.min.js\"></script>\n"
|
||||
+ "<link href=\"static/switchery/switchery.min.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/js/app.js\"></script>");
|
||||
return mv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Factory_List;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
@@ -63,4 +64,11 @@ public interface FactoryHelperI {
|
||||
* @return
|
||||
*/
|
||||
Object updateFactory(String[] brandCodes, String[] hardwareTypes, String factoryName, String factoryCode);
|
||||
|
||||
/**
|
||||
* 添加电子厂页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ModelAndView addFactory();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.util.IfishFilePath;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.csource.fastdfs.ClientGlobal;
|
||||
import org.csource.fastdfs.StorageClient1;
|
||||
import org.csource.fastdfs.StorageServer;
|
||||
import org.csource.fastdfs.TrackerClient;
|
||||
import org.csource.fastdfs.TrackerServer;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Component
|
||||
public class FastDFSClient implements FastDFSClientI {
|
||||
|
||||
private TrackerClient trackerClient = null;
|
||||
private TrackerServer trackerServer = null;
|
||||
private StorageServer storageServer = null;
|
||||
//使用StorageClient1进行上传
|
||||
private StorageClient1 storageClient1 = null;
|
||||
|
||||
public FastDFSClient() throws Exception {
|
||||
//获取classpath路径下配置文件"fdfs_client.conf"的路径
|
||||
//conf直接写相对于classpath的位置,不需要写classpath:
|
||||
String conf = "";
|
||||
if (IfishFilePath.link_img_head.contains("ifish7")) {
|
||||
conf = "fdfs_client_ifish7.conf";
|
||||
} else {
|
||||
conf = "fdfs_client_zhangxinyanv5.conf";
|
||||
}
|
||||
|
||||
String configPath = this.getClass().getClassLoader().getResource(conf).getFile();
|
||||
System.out.println(configPath);
|
||||
ClientGlobal.init(configPath);
|
||||
|
||||
trackerClient = new TrackerClient();
|
||||
trackerServer = trackerClient.getConnection();
|
||||
storageServer = trackerClient.getStoreStorage(trackerServer);
|
||||
storageClient1 = new StorageClient1(trackerServer, storageServer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传一个字节型文件
|
||||
*
|
||||
* @param file_buff 字节数组
|
||||
* @param file_ext_name 文件后缀
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile(byte[] file_buff, String file_ext_name) throws Exception {
|
||||
|
||||
String result = "";
|
||||
|
||||
try {
|
||||
result = storageClient1.upload_file1(file_buff, file_ext_name, null);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
result = storageClient1.upload_file1(file_buff, file_ext_name, null);
|
||||
} catch (Exception a) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传一个本地文件
|
||||
*
|
||||
* @param local_filename 本地文件名(路径+文件名+后缀)
|
||||
* @param file_ext_name 文件后缀
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile(String local_filename, String file_ext_name) throws Exception {
|
||||
|
||||
String result = storageClient1.upload_file1(local_filename, file_ext_name, null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传一个文件
|
||||
*
|
||||
* @param group_name 指定位置
|
||||
* @param local_filename 本地文件名(路径+文件名+后缀)
|
||||
* @param file_ext_name 文件后缀
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String uploadFile(String group_name, String local_filename, String file_ext_name) throws Exception {
|
||||
|
||||
String result = storageClient1.upload_file1(group_name, local_filename, file_ext_name, null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getFileType(MultipartFile file) {
|
||||
String[] allowTypes = new String[]{".mp4", ".png", ".jpg", ".bmp"};
|
||||
String filename = file.getOriginalFilename();
|
||||
if (StringUtils.isNotBlank(filename)) {
|
||||
for (String allowType : allowTypes) {
|
||||
if (filename.contains(allowType)) {
|
||||
return allowType.replace(".", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileToFastDFS(MultipartFile file) {
|
||||
try {
|
||||
String type = getFileType(file);
|
||||
if (StringUtils.isBlank(type)) {
|
||||
return null;
|
||||
}
|
||||
byte[] bt = file.getBytes();
|
||||
String url = uploadFile(bt, type);
|
||||
if (url.contains("group1/M00/")) {
|
||||
url = url.replace("group1/M00/", "");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
return IfishFilePath.link_img_head + url;
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* FastDFS分布式文件管理系统接口方法
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface FastDFSClientI {
|
||||
|
||||
/**
|
||||
* 上传一个字节型文件
|
||||
*
|
||||
* @param file_buff 字节数组
|
||||
* @param file_ext_name 文件后缀
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String uploadFile(byte[] file_buff, String file_ext_name) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传一个本地文件
|
||||
*
|
||||
* @param local_filename 本地文件名(路径+文件名+后缀)
|
||||
* @param file_ext_name 文件后缀
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String uploadFile(String local_filename, String file_ext_name) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传一个文件
|
||||
*
|
||||
* @param group_name 指定位置
|
||||
* @param local_filename 本地文件名(路径+文件名+后缀)
|
||||
* @param file_ext_name 文件后缀
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String uploadFile(String group_name, String local_filename, String file_ext_name) throws Exception;
|
||||
|
||||
/**
|
||||
* 上传一个MultipartFile类型文件,返回成功后文件路径,适用于保存完整路径方法
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
String uploadFileToFastDFS(MultipartFile file);
|
||||
}
|
||||
@@ -0,0 +1,696 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.API.JiGuangPush;
|
||||
import com.ifish.Interceptor.IfishException;
|
||||
import com.ifish.bean.LiveRoomPageInfo;
|
||||
import com.ifish.bean.PageResult;
|
||||
import com.ifish.bean.Tbl_Device_User;
|
||||
import com.ifish.bean.Tbl_Live_Message;
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import com.ifish.bean.Tbl_Live_Watch;
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
import com.ifish.enums.PushTypeEnum;
|
||||
import com.ifish.enums.ResultEnum;
|
||||
import com.ifish.mapper.Tbl_Live_Room_Mapper;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
public class LiveRoomHelper implements LiveRoomHelperI {
|
||||
|
||||
@Autowired
|
||||
private FastDFSClientI fastDFSClientI;
|
||||
|
||||
@Autowired
|
||||
private Tbl_Live_Room_Mapper tbl_Live_Room_Mapper;
|
||||
|
||||
@Autowired
|
||||
private UserHelperI userHelperI;
|
||||
|
||||
@Autowired
|
||||
private DeviceHelperI deviceHelperI;
|
||||
|
||||
@Autowired
|
||||
private RedisHelperI redisHelperI;
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
@Autowired
|
||||
private JiGuangPush jiGuangPush;
|
||||
|
||||
@Autowired
|
||||
private PushMessageHelperI pushMessageHelperI;
|
||||
|
||||
/**
|
||||
* 新增直播间
|
||||
*
|
||||
* @param fileUpload
|
||||
* @param liveRoom
|
||||
*/
|
||||
@Override
|
||||
public Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
|
||||
try {
|
||||
if (StringUtils.isNotBlank(liveRoom.getRoomName())) {
|
||||
String roomName = new String(liveRoom.getRoomName().getBytes("iso-8859-1"), "UTF-8");
|
||||
liveRoom.setRoomName(roomName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(liveRoom.getRoomDesc())) {
|
||||
String roomDesc = new String(liveRoom.getRoomDesc().getBytes("iso-8859-1"), "UTF-8");
|
||||
liveRoom.setRoomDesc(roomDesc);
|
||||
}
|
||||
|
||||
if (liveRoom.getUserId() == null || liveRoom.getUserId() <= 0) {
|
||||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
if (StringUtils.isBlank(liveRoom.getRoomName()) || liveRoom.getRoomName().length() > 20) {
|
||||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
if (StringUtils.isBlank(liveRoom.getRoomDesc()) || liveRoom.getRoomDesc().length() > 70) {
|
||||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
if (StringUtils.isBlank(liveRoom.getRoomStatus()) || liveRoom.getRoomStatus().length() > 1) {
|
||||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
if (StringUtils.isBlank(liveRoom.getCameraId()) || liveRoom.getCameraId().length() > 20) {
|
||||
throw new IfishException(ResultEnum.error401);
|
||||
}
|
||||
if (fileUpload == null || fileUpload.getSize() > 1048576) {
|
||||
throw new IfishException(ResultEnum.warn205);
|
||||
}
|
||||
String file = fastDFSClientI.uploadFileToFastDFS(fileUpload);
|
||||
if (StringUtils.isNotBlank(file)) {
|
||||
liveRoom.setRoomImg(file);
|
||||
}
|
||||
|
||||
//用户ID
|
||||
Integer userId = liveRoom.getUserId();
|
||||
Tbl_User user = userHelperI.getUserById(userId);
|
||||
if (user == null) {
|
||||
throw new IfishException(ResultEnum.error402);
|
||||
}
|
||||
//用户是否绑定摄像头
|
||||
String cameraId = liveRoom.getCameraId();
|
||||
Tbl_Device_User cameraUser = deviceHelperI.getDeviceUserByUserId_CameraId(userId, cameraId);
|
||||
|
||||
if (cameraUser == null) {
|
||||
throw new IfishException(ResultEnum.error402);
|
||||
}
|
||||
//原来不是开启状态
|
||||
Boolean cameraChange = false;
|
||||
if (cameraUser.getIsLive().equals("0")) {
|
||||
cameraUser.setIsLive("1");
|
||||
cameraChange = true;
|
||||
}
|
||||
|
||||
//新增直播间
|
||||
liveRoom.setCreateTime(new Date());
|
||||
liveRoom.setPopularityValue(0);
|
||||
int i = tbl_Live_Room_Mapper.insertLiveRoom(liveRoom);
|
||||
if (i > 0) {
|
||||
if (cameraChange) {
|
||||
deviceHelperI.updateDeviceUser(cameraUser);
|
||||
}
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(liveRoom);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", liveRoom.getRoomId());
|
||||
map.put("userId", liveRoom.getUserId());
|
||||
map.put("cameraId", liveRoom.getCameraId());
|
||||
map.put("roomName", liveRoom.getRoomName());
|
||||
map.put("roomDesc", liveRoom.getRoomDesc());
|
||||
map.put("popularityValue", liveRoom.getPopularityValue());
|
||||
map.put("roomStatus", liveRoom.getRoomStatus());
|
||||
map.put("roomImg", liveRoom.getRoomImg());
|
||||
map.put("createTime", liveRoom.getCreateTime());
|
||||
map.put("zanNum", liveRoom.getZanNum());
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据直播间ID获取直播间详情
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public Tbl_Live_Room getTbl_Live_RoomByCameraId(String cameraId) throws Exception {
|
||||
Tbl_Live_Room live_Room = null;
|
||||
String key = redisKeyHelperI.getTbl_Live_RoomRedisKeyByCameraId(cameraId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
live_Room = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
|
||||
} else {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomByCameraId(cameraId);
|
||||
if (live_Room != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(live_Room));
|
||||
}
|
||||
}
|
||||
return live_Room;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据房间ID查询直播间
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public Tbl_Live_Room getTbl_Live_RoomByRoomId(Integer roomId) throws Exception {
|
||||
Tbl_Live_Room live_Room = null;
|
||||
String key = redisKeyHelperI.getTbl_Live_RoomRedisKeyByRoomId(roomId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
live_Room = (Tbl_Live_Room) IfishUtil.JsonToBean(redisString, Tbl_Live_Room.class);
|
||||
} else {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomById(roomId);
|
||||
if (live_Room != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(live_Room));
|
||||
}
|
||||
}
|
||||
return live_Room;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间点赞
|
||||
*
|
||||
* @param roomId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object liveRoomsZan(Integer roomId, Integer userId) {
|
||||
try {
|
||||
//以前的方式,每人每个直播间只能点赞一次,这里不采用这种方式
|
||||
// //点赞和人气值不一样,人气值只此直播间点击数,点赞指观看此直播并点赞的人数
|
||||
// Tbl_Live_Room room = getTbl_Live_RoomById(roomId);
|
||||
// if (room == null) {
|
||||
// throw new IfishException(ResultEnum.error402);
|
||||
// }
|
||||
// Tbl_User user = userHelperI.getUserById(userId);
|
||||
// if (user == null) {
|
||||
// throw new IfishException(ResultEnum.error402);
|
||||
// }
|
||||
// //点赞数量
|
||||
// Integer zanNum = tbl_Live_Room_Mapper.getLiveRoomZanCountByRoomId(roomId);
|
||||
// //是否点过赞
|
||||
// int i = tbl_Live_Room_Mapper.IsZan(roomId, userId);
|
||||
// Map map = new HashMap();
|
||||
// //点赞过,取消点赞
|
||||
// if (i > 0) {
|
||||
// int j = tbl_Live_Room_Mapper.cancelZan(roomId, userId);
|
||||
// //成功取消
|
||||
// if (j > 0) {
|
||||
// zanNum--;
|
||||
// map.put("isZan", 0);
|
||||
// map.put("zanNum", zanNum);
|
||||
// return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
|
||||
// }
|
||||
// } //没有点赞,点赞一次
|
||||
// else {
|
||||
// int j = tbl_Live_Room_Mapper.ImplementZan(roomId, userId);
|
||||
// if (j > 0) {
|
||||
// zanNum++;
|
||||
// map.put("isZan", 1);
|
||||
// map.put("zanNum", zanNum);
|
||||
// return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
|
||||
// }
|
||||
// }
|
||||
Tbl_Live_Room live = getTbl_Live_RoomByRoomId(roomId);
|
||||
if (live != null) {
|
||||
if (live.getZanNum() != null && live.getZanNum() >= 0) {
|
||||
live.setZanNum(live.getZanNum() + 1);
|
||||
} else {
|
||||
live.setZanNum(1);
|
||||
}
|
||||
int i = tbl_Live_Room_Mapper.updateLiveRoom(live);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(live);
|
||||
Map map = new HashMap();
|
||||
map.put("isZan", 1);
|
||||
map.put("zanNum", live.getZanNum());
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间留言
|
||||
*
|
||||
* @param liveMessage
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object leaveMessage(Tbl_Live_Message liveMessage) {
|
||||
try {
|
||||
Integer roomId = liveMessage.getRoomId();
|
||||
Integer userId = liveMessage.getUserId();
|
||||
String messageContent = liveMessage.getMessageContent();
|
||||
if (roomId != null && userId != null && StringUtils.isNotBlank(messageContent)) {
|
||||
Tbl_Live_Room live_Room = getTbl_Live_RoomByRoomId(roomId);
|
||||
Tbl_User user = userHelperI.getUserById(userId);
|
||||
if (live_Room != null && user != null) {
|
||||
liveMessage.setCreateTime(new Date());
|
||||
int i = tbl_Live_Room_Mapper.insertLiveMessage(liveMessage);
|
||||
if (i > 0) {
|
||||
liveMessage.setUserName(user.getNickName());
|
||||
liveMessage.setUserImg(user.getUserImg());
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Message(liveMessage);
|
||||
}
|
||||
liveMessage.setUserImg(user.getUserImg());
|
||||
liveMessage.setUserName(user.getNickName());
|
||||
Integer asUserId = liveMessage.getAsUserId();
|
||||
if (asUserId != null) {
|
||||
Tbl_User asUser = userHelperI.getUserById(asUserId);
|
||||
if (asUser != null) {
|
||||
liveMessage.setAsUserName(asUser.getNickName());
|
||||
if (!asUserId.equals(userId)) {
|
||||
String timestamp = IfishUtil.format(new Date());
|
||||
//发送云信消息给所@的用户
|
||||
//neteaseIM.sendMsg(userId.toString(), asUserId.toString(), "来自爱鱼看看的回复:" + messageContent, "");
|
||||
//基本参数
|
||||
Map<String, String> baseMap = new HashMap<String, String>();
|
||||
baseMap.put("title", PushTypeEnum.pinglun_push.getValue());
|
||||
baseMap.put("content", "来自爱鱼看看的回复:" + messageContent);
|
||||
baseMap.put("user_id", asUserId.toString());
|
||||
baseMap.put("loginType", asUser.getLoginType());
|
||||
//推送参数
|
||||
Map<String, String> pushMap = new HashMap<String, String>();
|
||||
pushMap.put("timestamp", timestamp);
|
||||
pushMap.put("msg_type", PushTypeEnum.pinglun_push.getKey());
|
||||
//推送消息
|
||||
jPushNotifcation(baseMap, pushMap);
|
||||
}
|
||||
} else {
|
||||
Integer roomUserId = live_Room.getUserId();
|
||||
if (!roomUserId.equals(userId)) {
|
||||
//发送云信消息给房主
|
||||
//neteaseIM.sendMsg(userId.toString(), roomUserId.toString(), "来自爱鱼看看的留言:" + messageContent, "");
|
||||
String timestamp = IfishUtil.format(new Date());
|
||||
//基本参数
|
||||
Map<String, String> baseMap = new HashMap<String, String>();
|
||||
baseMap.put("title", PushTypeEnum.pinglun_push.getValue());
|
||||
baseMap.put("content", "来自爱鱼看看的回复:" + messageContent);
|
||||
baseMap.put("user_id", user.getUserId().toString());
|
||||
baseMap.put("loginType", user.getLoginType());
|
||||
//推送参数
|
||||
Map<String, String> pushMap = new HashMap<String, String>();
|
||||
pushMap.put("timestamp", timestamp);
|
||||
pushMap.put("msg_type", PushTypeEnum.pinglun_push.getKey());
|
||||
//推送消息
|
||||
jPushNotifcation(baseMap, pushMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), liveMessage);
|
||||
}
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据直播间ID获取直播间评论列表
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getLeaveMessage(Integer firstResult, Integer pageSize, Integer roomId) {
|
||||
try {
|
||||
if (firstResult == null) {
|
||||
firstResult = 0;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = 10;
|
||||
}
|
||||
List<Map> list = null;
|
||||
String key = redisKeyHelperI.getTbl_Live_Message(firstResult, pageSize, roomId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
list = (List<Map>) IfishUtil.JsonToList(redisString, Map.class);
|
||||
} else {
|
||||
list = tbl_Live_Room_Mapper.getLive_MessagesListByRoomId(roomId, firstResult, pageSize);
|
||||
if (list != null && list.size() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(list));
|
||||
}
|
||||
}
|
||||
key = redisKeyHelperI.getTbl_Live_MessageCount(roomId);
|
||||
redisString = redisHelperI.getRedis(key);
|
||||
Integer count = 0;
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
count = Integer.parseInt(redisString);
|
||||
} else {
|
||||
count = tbl_Live_Room_Mapper.getLive_MessagesCountByRoomId(roomId);
|
||||
if (count > 0) {
|
||||
redisHelperI.setRedis(key, count.toString());
|
||||
}
|
||||
}
|
||||
PageResult<Map> page = new PageResult<Map>();
|
||||
page.setList(list);
|
||||
page.setTotalCount(count);
|
||||
return IfishUtil.returnPageData(page, ResultEnum.success.getKey());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID获取直播间信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getLiveRoomInfoByRoomId(Integer roomId) {
|
||||
try {
|
||||
if (roomId != null) {
|
||||
//查找直播间信息
|
||||
Tbl_Live_Room curLiveRoom = getTbl_Live_RoomByRoomId(roomId);
|
||||
if (curLiveRoom != null) {
|
||||
Tbl_User user = userHelperI.getUserById(curLiveRoom.getUserId());
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", roomId);
|
||||
map.put("userImg", user.getUserImg());
|
||||
map.put("userId", curLiveRoom.getUserId());
|
||||
map.put("cameraId", curLiveRoom.getCameraId());
|
||||
map.put("roomName", curLiveRoom.getRoomName());
|
||||
map.put("roomDesc", curLiveRoom.getRoomDesc());
|
||||
map.put("popularityValue", curLiveRoom.getPopularityValue());
|
||||
map.put("roomStatus", curLiveRoom.getRoomStatus());
|
||||
map.put("roomImg", curLiveRoom.getRoomImg());
|
||||
map.put("createTime", curLiveRoom.getCreateTime());
|
||||
map.put("zanNum", curLiveRoom.getZanNum());
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), map);
|
||||
}
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头ID获取直播间信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getLiveRoomInfoByCameraId(String cameraId) {
|
||||
try {
|
||||
if (cameraId != null) {
|
||||
//查找直播间信息
|
||||
Tbl_Live_Room curLiveRoom = getTbl_Live_RoomByCameraId(cameraId);
|
||||
if (curLiveRoom != null) {
|
||||
Tbl_User user = userHelperI.getUserById(curLiveRoom.getUserId());
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", curLiveRoom.getRoomId());
|
||||
map.put("userImg", user.getUserImg());
|
||||
map.put("cameraId", curLiveRoom.getCameraId());
|
||||
map.put("userId", curLiveRoom.getUserId());
|
||||
map.put("roomName", curLiveRoom.getRoomName());
|
||||
map.put("roomDesc", curLiveRoom.getRoomDesc());
|
||||
map.put("popularityValue", curLiveRoom.getPopularityValue());
|
||||
map.put("roomStatus", curLiveRoom.getRoomStatus());
|
||||
map.put("roomImg", curLiveRoom.getRoomImg());
|
||||
map.put("createTime", curLiveRoom.getCreateTime());
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), map);
|
||||
}
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询直播间列表
|
||||
*
|
||||
* @param firstResult
|
||||
* @param pageSize
|
||||
* @param userId
|
||||
* @param orders
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getLiveRooms(Integer firstResult, Integer pageSize, String orders) {
|
||||
|
||||
try {
|
||||
if (firstResult != null && pageSize != null) {
|
||||
List<LiveRoomPageInfo> timeList = new ArrayList<LiveRoomPageInfo>();
|
||||
String key = redisKeyHelperI.getListTbl_Live_Room_RedisKey(firstResult, pageSize, orders);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
timeList = (List<LiveRoomPageInfo>) IfishUtil.JsonToList(redisString, LiveRoomPageInfo.class);
|
||||
} else {
|
||||
if (orders != null && orders.equals("2")) {
|
||||
timeList = tbl_Live_Room_Mapper.getLiveRoomListByRenqi(pageSize, firstResult);
|
||||
} else {
|
||||
timeList = tbl_Live_Room_Mapper.getLiveRoomListByCreateTime(pageSize, firstResult);
|
||||
}
|
||||
if (timeList != null && timeList.size() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(timeList));
|
||||
}
|
||||
}
|
||||
|
||||
Integer count = 0;
|
||||
key = redisKeyHelperI.getTbl_Live_Room_CountRedisKey();
|
||||
redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
count = Integer.parseInt(redisString);
|
||||
} else {
|
||||
count = tbl_Live_Room_Mapper.getLiveRoomListCount();
|
||||
redisHelperI.setRedis(key, count.toString());
|
||||
}
|
||||
PageResult page = new PageResult();
|
||||
page.setList(timeList);
|
||||
page.setTotalCount(count);
|
||||
return IfishUtil.returnPageData(page, ResultEnum.success.getKey());
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改直播间
|
||||
*
|
||||
* @param fileUpload
|
||||
* @param liveRoom
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
|
||||
|
||||
try {
|
||||
if (StringUtils.isNotBlank(liveRoom.getRoomName())) {
|
||||
String roomName = new String(liveRoom.getRoomName().getBytes("iso-8859-1"), "UTF-8");
|
||||
liveRoom.setRoomName(roomName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(liveRoom.getRoomDesc())) {
|
||||
String roomDesc = new String(liveRoom.getRoomDesc().getBytes("iso-8859-1"), "UTF-8");
|
||||
liveRoom.setRoomDesc(roomDesc);
|
||||
}
|
||||
if (fileUpload != null && fileUpload.getSize() <= 1048576) {
|
||||
String file = fastDFSClientI.uploadFileToFastDFS(fileUpload);
|
||||
if (StringUtils.isNotBlank(file)) {
|
||||
liveRoom.setRoomImg(file);
|
||||
}
|
||||
}
|
||||
|
||||
int i = tbl_Live_Room_Mapper.updateLiveRoom(liveRoom);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(liveRoom);
|
||||
Tbl_Live_Room live = getTbl_Live_RoomByRoomId(liveRoom.getRoomId());
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), live);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改直播间
|
||||
*
|
||||
* @param fileUpload
|
||||
* @param liveRoom
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateLiveRoom(Tbl_Live_Room liveRoom) {
|
||||
|
||||
try {
|
||||
|
||||
int i = tbl_Live_Room_Mapper.updateLiveRoom(liveRoom);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(liveRoom);
|
||||
Tbl_Live_Room live = getTbl_Live_RoomByRoomId(liveRoom.getRoomId());
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), live);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间人气值加1
|
||||
*
|
||||
* @param roomId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object popularityValue(Integer roomId, Integer userId) {
|
||||
try {
|
||||
if (roomId != null && userId != null) {
|
||||
//浏览直播间记录
|
||||
Tbl_Live_Watch browseRoom = tbl_Live_Room_Mapper.getTbl_Live_WatchByRoomIdAndUserId(roomId, userId);
|
||||
Date date = new Date();
|
||||
//新增浏览记录
|
||||
if (browseRoom != null) {
|
||||
browseRoom.setUpdateTime(date);
|
||||
tbl_Live_Room_Mapper.updateTbl_Live_Watch(browseRoom);
|
||||
} else {
|
||||
//更新浏览记录
|
||||
browseRoom = new Tbl_Live_Watch();
|
||||
browseRoom.setRoomId(roomId);
|
||||
browseRoom.setUserId(userId);
|
||||
browseRoom.setUpdateTime(date);
|
||||
browseRoom.setCreateTime(date);
|
||||
tbl_Live_Room_Mapper.insertTbl_Live_Watch(browseRoom);
|
||||
}
|
||||
//查找直播间信息
|
||||
Tbl_Live_Room curLiveRoom = getTbl_Live_RoomByRoomId(roomId);
|
||||
if (curLiveRoom != null) {
|
||||
Integer popularityValue = null;
|
||||
if (curLiveRoom.getPopularityValue() == null) {
|
||||
popularityValue = 0;
|
||||
} else {
|
||||
popularityValue = curLiveRoom.getPopularityValue();
|
||||
}
|
||||
//人气值加一
|
||||
popularityValue++;
|
||||
curLiveRoom.setPopularityValue(popularityValue);
|
||||
tbl_Live_Room_Mapper.updateLiveRoomPopularityValue(curLiveRoom);
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(curLiveRoom);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("roomId", roomId);
|
||||
map.put("popularityValue", popularityValue);
|
||||
return IfishUtil.toJson(ResultEnum.success.getKey(), popularityValue);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 极光推送
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
public boolean jPushNotifcation(Map<String, String> baseMap, Map<String, String> pushMap) {
|
||||
try {
|
||||
//登录类型
|
||||
String loginType = baseMap.get("loginType");
|
||||
if (loginType != null) {
|
||||
//推送消息类型
|
||||
String msgType = pushMap.get("msg_type");
|
||||
String userId = baseMap.get("user_id");
|
||||
String title = baseMap.get("title");
|
||||
String content = baseMap.get("content");
|
||||
boolean result = false;
|
||||
if (loginType.equals("ios")) {
|
||||
result = jiGuangPush.pushMessageByIOS(title, content, userId, pushMap);
|
||||
} else if (loginType.equals("android")) {
|
||||
result = jiGuangPush.pushMessageByAndroid(title, content, userId, pushMap);
|
||||
}
|
||||
//推送记录
|
||||
Tbl_Push_List pushList = new Tbl_Push_List();
|
||||
if (msgType.equals(PushTypeEnum.remove_device.getKey())) {
|
||||
pushList.setUserId(Integer.valueOf(userId));
|
||||
pushList.setDeviceId(Integer.valueOf(pushMap.get("device_id")));
|
||||
pushList.setPhoneType(loginType);
|
||||
pushList.setShowName(pushMap.get("showName"));
|
||||
pushList.setPushType(msgType);
|
||||
pushList.setPushTitle(title);
|
||||
pushList.setPushContext(content);
|
||||
pushList.setJpushStatus(result ? "1" : "0");
|
||||
pushList.setCreateTime(new Date());
|
||||
pushMessageHelperI.save(pushList);
|
||||
return true;
|
||||
} //发送看护报告推送
|
||||
else if (msgType.equals(PushTypeEnum.send_report.getKey())) {
|
||||
String reportId = baseMap.get("reportId");
|
||||
if (reportId != null) {
|
||||
pushList.setReportId(Integer.valueOf(reportId));
|
||||
}
|
||||
pushList.setUserId(Integer.valueOf(userId));
|
||||
pushList.setPhoneType(loginType);
|
||||
pushList.setPushType(msgType);
|
||||
pushList.setPushTitle(title);
|
||||
pushList.setPushContext(content);
|
||||
pushList.setPushLink(pushMap.get("push_link"));
|
||||
pushList.setJpushStatus(result ? "1" : "0");
|
||||
pushList.setCreateTime(new Date());
|
||||
pushMessageHelperI.save(pushList);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头删除直播间
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteLiveRoom(String cameraId) {
|
||||
try {
|
||||
Tbl_Live_Room live_Room = getTbl_Live_RoomByCameraId(cameraId);
|
||||
if (live_Room != null) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Live_Room(live_Room);
|
||||
}
|
||||
int i = tbl_Live_Room_Mapper.deleteLive_RoomByCameraId(cameraId);
|
||||
return i;
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Live_Message;
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface LiveRoomHelperI {
|
||||
|
||||
/**
|
||||
* 新增直播间
|
||||
*
|
||||
* @param fileUpload
|
||||
* @param liveRoom
|
||||
*/
|
||||
Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom);
|
||||
|
||||
/**
|
||||
* 直播间点赞
|
||||
*
|
||||
* @param roomId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Object liveRoomsZan(Integer roomId, Integer userId);
|
||||
|
||||
/**
|
||||
* 直播间留言
|
||||
*
|
||||
* @param liveMessage
|
||||
* @return
|
||||
*/
|
||||
Object leaveMessage(Tbl_Live_Message liveMessage);
|
||||
|
||||
/**
|
||||
* 根据直播间ID获取直播间评论列表
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
Object getLeaveMessage(Integer firstResult, Integer pageSize, Integer roomId);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取直播间信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Object getLiveRoomInfoByRoomId(Integer rommId);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID获取直播间信息
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public Object getLiveRoomInfoByCameraId(String cameraId);
|
||||
|
||||
/**
|
||||
* 根据条件查询直播间列表
|
||||
*
|
||||
* @param firstResult
|
||||
* @param pageSize
|
||||
* @param userId
|
||||
* @param orders
|
||||
* @return
|
||||
*/
|
||||
Object getLiveRooms(Integer firstResult, Integer pageSize, String orders);
|
||||
|
||||
/**
|
||||
* 修改直播间
|
||||
*
|
||||
* @param fileUpload
|
||||
* @param liveRoom
|
||||
* @return
|
||||
*/
|
||||
Object updateLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom);
|
||||
|
||||
/**
|
||||
* 修改直播间
|
||||
*
|
||||
* @param fileUpload
|
||||
* @param liveRoom
|
||||
* @return
|
||||
*/
|
||||
Object updateLiveRoom(Tbl_Live_Room liveRoom);
|
||||
|
||||
/**
|
||||
* 直播间人气值加1
|
||||
*
|
||||
* @param roomId
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Object popularityValue(Integer roomId, Integer userId);
|
||||
|
||||
/**
|
||||
* 根据摄像头删除直播间
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
Integer deleteLiveRoom(String cameraId);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import com.ifish.bean.Tbl_Live_Message;
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
import com.ifish.mapper.Tbl_Live_Room_Mapper;
|
||||
import com.ifish.util.RedisKey;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -30,6 +31,8 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
||||
private DeviceHelperI deviceHelper;
|
||||
@Autowired
|
||||
private UserHelperI userHelperI;
|
||||
@Autowired
|
||||
private Tbl_Live_Room_Mapper tbl_Live_Room_Mapper;
|
||||
|
||||
/**
|
||||
* 根据phoneNumber获取Tbl_User用户信息的Redis缓存key键值
|
||||
@@ -507,7 +510,11 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
||||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Live_Room(Tbl_Live_Room live_Room) {
|
||||
|
||||
if ((live_Room.getRoomId() == null || live_Room.getRoomId() == 0) && StringUtils.isNotBlank(live_Room.getCameraId())) {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomByCameraId(live_Room.getCameraId());
|
||||
} else if (StringUtils.isBlank(live_Room.getCameraId()) && (live_Room.getRoomId() != null && live_Room.getRoomId() > 0)) {
|
||||
live_Room = tbl_Live_Room_Mapper.getTbl_Live_RoomById(live_Room.getRoomId());
|
||||
}
|
||||
if (live_Room.getRoomId() != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByRoomId(live_Room.getRoomId()));
|
||||
}
|
||||
@@ -602,6 +609,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
||||
*
|
||||
* @param pushId
|
||||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List) {
|
||||
if (tbl_Push_List.getPushId() != null) {
|
||||
redisHelperI.deleteRedis(getTbl_Push_List_RedisByPushId(tbl_Push_List.getPushId()));
|
||||
@@ -612,8 +620,17 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
||||
/**
|
||||
* 删除推送列表类缓存
|
||||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList() {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.PUSHLIST_SELECT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除鱼缸厂信息缓存
|
||||
*/
|
||||
@Override
|
||||
public void deleteTbl_Vender_List_RedisKey() {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.VENDER_CODE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -383,4 +383,9 @@ public interface RedisKeyHelperI {
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList();
|
||||
|
||||
/**
|
||||
* 删除鱼缸厂信息缓存
|
||||
*/
|
||||
public void deleteTbl_Vender_List_RedisKey();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Vender_List;
|
||||
import com.ifish.mapper.Tbl_Vender_List_Mapper;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
public class VenderHelper implements VenderHelperI {
|
||||
|
||||
@Autowired
|
||||
private Tbl_Vender_List_Mapper tbl_Vender_List_Mapper;
|
||||
|
||||
@Autowired
|
||||
private FastDFSClientI fastDFSClientI;
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
/**
|
||||
* 鱼缸厂列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ModelAndView getlist() {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
mv.setViewName("venderlist");
|
||||
mv.addObject("title", "鱼缸厂列表");
|
||||
mv.addObject("myjs", "<!-- Other plugins ( load only nessesary plugins for every page) -->\n"
|
||||
+ " <script src=\"static/assets/plugins/core/moment/moment.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/sparklines/jquery.sparkline.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/pie-chart/jquery.easy-pie-chart.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/icheck/jquery.icheck.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tags/jquery.tagsinput.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tinymce/tinymce.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/tables/jquery.dataTables.js\"></script>\n"
|
||||
+ "<link href=\"static/assets/plugins/tables/jquery.dataTables.css\" rel=\"stylesheet\">"
|
||||
+ "<link href=\"static/assets/plugins/tables/dataTables.bootstrap.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/plugins/tables/dataTables.bootstrap.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/highlight/highlight.pack.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/countTo/jquery.countTo.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/js/jquery.sprFlat.js\"></script>\n"
|
||||
+ " <script src=\"static/switchery/switchery.min.js\"></script>\n"
|
||||
+ "<link href=\"static/switchery/switchery.min.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/js/app.js\"></script>");
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 鱼缸厂列表数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getlistData(String draw, Integer start, Integer length, String appShow, String sortField, String sortMode, String brandName) {
|
||||
if (StringUtils.isBlank(sortMode)) {
|
||||
sortMode = "ASC";
|
||||
}
|
||||
if (StringUtils.isBlank(sortField)) {
|
||||
sortField = "brand_code";
|
||||
}
|
||||
List<Map> list = tbl_Vender_List_Mapper.getlistData(start, length, appShow, sortField, sortMode, brandName);
|
||||
for (Map map : list) {
|
||||
String dateTime = IfishUtil.format((Date) map.get("createTime"));
|
||||
map.put("createTime", dateTime);
|
||||
}
|
||||
int allCount = tbl_Vender_List_Mapper.getlistDataAllCount();
|
||||
int count = tbl_Vender_List_Mapper.getlistDataCount(appShow, brandName);
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("data", list);
|
||||
map.put("draw", draw);
|
||||
map.put("recordsTotal", allCount);
|
||||
map.put("recordsFiltered", count);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据鱼缸厂code获取详情页
|
||||
*
|
||||
* @param brandCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAndView getvender(String brandCode) {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
|
||||
if (StringUtils.isBlank(brandCode)) {
|
||||
mv.setViewName("redirect:venderlist");
|
||||
return mv;
|
||||
}
|
||||
Tbl_Vender_List vender = tbl_Vender_List_Mapper.getTbl_Vender_ListByBrandCode(brandCode);
|
||||
if (vender == null) {
|
||||
mv.setViewName("redirect:venderlist");
|
||||
return mv;
|
||||
} else {
|
||||
mv.addObject("vender", vender);
|
||||
}
|
||||
|
||||
mv.setViewName("venderdetail");
|
||||
mv.addObject("title", "鱼缸厂详情");
|
||||
mv.addObject("pagetitle", "鱼缸厂详情");
|
||||
mv.addObject("myjs", "<!-- Other plugins ( load only nessesary plugins for every page) -->\n"
|
||||
+ " <script src=\"static/assets/plugins/core/moment/moment.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/sparklines/jquery.sparkline.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/pie-chart/jquery.easy-pie-chart.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/icheck/jquery.icheck.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tags/jquery.tagsinput.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tinymce/tinymce.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/tables/jquery.dataTables.js\"></script>\n"
|
||||
+ "<link href=\"static/assets/plugins/tables/jquery.dataTables.css\" rel=\"stylesheet\">"
|
||||
+ "<link href=\"static/assets/plugins/tables/dataTables.bootstrap.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/plugins/tables/dataTables.bootstrap.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/highlight/highlight.pack.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/countTo/jquery.countTo.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/js/jquery.sprFlat.js\"></script>\n"
|
||||
+ " <script src=\"static/switchery/switchery.min.js\"></script>\n"
|
||||
+ "<link href=\"static/switchery/switchery.min.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/js/app.js\"></script>");
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改,插入 鱼缸厂信息
|
||||
*
|
||||
* @param brandLogoImg
|
||||
* @param tbl_Vender_List
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateVender(MultipartFile brandLogoImg, Tbl_Vender_List tbl_Vender_List) {
|
||||
try {
|
||||
if (StringUtils.isNotBlank(tbl_Vender_List.getBrandName())) {
|
||||
String brandName = new String(tbl_Vender_List.getBrandName().getBytes("iso-8859-1"), "UTF-8");
|
||||
tbl_Vender_List.setBrandName(brandName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tbl_Vender_List.getContactAddress())) {
|
||||
String contactAddress = new String(tbl_Vender_List.getContactAddress().getBytes("iso-8859-1"), "UTF-8");
|
||||
tbl_Vender_List.setContactAddress(contactAddress);
|
||||
}
|
||||
Tbl_Vender_List oldTbl_Vender_List = tbl_Vender_List_Mapper.getTbl_Vender_ListByBrandCode(tbl_Vender_List.getBrandCode());
|
||||
if (oldTbl_Vender_List == null) {
|
||||
//插入
|
||||
if (brandLogoImg != null) {
|
||||
String path = fastDFSClientI.uploadFileToFastDFS(brandLogoImg);
|
||||
tbl_Vender_List.setBrandLogo(path);
|
||||
} else {
|
||||
return "请上传正确的Logo图片";
|
||||
}
|
||||
int i = tbl_Vender_List_Mapper.insertVender(tbl_Vender_List);
|
||||
if (i > 0) {
|
||||
return "添加成功";
|
||||
} else {
|
||||
return "添加失败";
|
||||
}
|
||||
} else {
|
||||
//修改
|
||||
if (brandLogoImg != null) {
|
||||
String path = fastDFSClientI.uploadFileToFastDFS(brandLogoImg);
|
||||
tbl_Vender_List.setBrandLogo(path);
|
||||
}
|
||||
int i = tbl_Vender_List_Mapper.updateVender(tbl_Vender_List);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteTbl_Vender_List_RedisKey();
|
||||
return "修改成功";
|
||||
} else {
|
||||
return "修改失败";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return "失败";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增鱼缸厂页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAndView addVender() {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
|
||||
mv.setViewName("venderdetail");
|
||||
mv.addObject("title", "添加鱼缸厂");
|
||||
mv.addObject("pagetitle", "添加鱼缸厂");
|
||||
mv.addObject("myjs", "<!-- Other plugins ( load only nessesary plugins for every page) -->\n"
|
||||
+ " <script src=\"static/assets/plugins/core/moment/moment.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/sparklines/jquery.sparkline.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/pie-chart/jquery.easy-pie-chart.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/icheck/jquery.icheck.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tags/jquery.tagsinput.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tinymce/tinymce.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/tables/jquery.dataTables.js\"></script>\n"
|
||||
+ "<link href=\"static/assets/plugins/tables/jquery.dataTables.css\" rel=\"stylesheet\">"
|
||||
+ "<link href=\"static/assets/plugins/tables/dataTables.bootstrap.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/plugins/tables/dataTables.bootstrap.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/highlight/highlight.pack.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/countTo/jquery.countTo.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/js/jquery.sprFlat.js\"></script>\n"
|
||||
+ " <script src=\"static/switchery/switchery.min.js\"></script>\n"
|
||||
+ "<link href=\"static/switchery/switchery.min.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/js/app.js\"></script>");
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据鱼缸厂code删除鱼缸厂信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object deleteVender(String code) {
|
||||
Tbl_Vender_List tbl_Vender_List = tbl_Vender_List_Mapper.getTbl_Vender_ListByBrandCode(code);
|
||||
if (tbl_Vender_List != null) {
|
||||
int i = tbl_Vender_List_Mapper.deleteVender(code);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteTbl_Vender_List_RedisKey();
|
||||
return "删除成功";
|
||||
}
|
||||
} else {
|
||||
return "删除失败!没有找到鱼缸厂信息!";
|
||||
}
|
||||
return "删除失败!";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改鱼缸厂在APP端是否展示
|
||||
*
|
||||
* @param code
|
||||
* @param appshow
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateAppShow(String code, String appshow) {
|
||||
try {
|
||||
Tbl_Vender_List tbl_Vender_List = new Tbl_Vender_List();
|
||||
tbl_Vender_List.setAppShow(appshow);
|
||||
tbl_Vender_List.setBrandCode(code);
|
||||
int i = tbl_Vender_List_Mapper.updateVender(tbl_Vender_List);
|
||||
redisKeyHelperI.deleteTbl_Vender_List_RedisKey();
|
||||
if (i > 0) {
|
||||
return "修改成功";
|
||||
} else {
|
||||
return "修改失败";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return "修改失败";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Vender_List;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface VenderHelperI {
|
||||
|
||||
/**
|
||||
* 鱼缸厂列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ModelAndView getlist();
|
||||
|
||||
/**
|
||||
* 鱼缸厂列表数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getlistData(String draw, Integer start, Integer length, String appShow, String sortField, String sortMode, String brandName);
|
||||
|
||||
/**
|
||||
* 根据鱼缸厂code获取详情页
|
||||
*
|
||||
* @param brandCode
|
||||
* @return
|
||||
*/
|
||||
public ModelAndView getvender(String brandCode);
|
||||
|
||||
/**
|
||||
* 修改,插入 鱼缸厂信息
|
||||
*
|
||||
* @param brandLogoImg
|
||||
* @param tbl_Vender_List
|
||||
* @return
|
||||
*/
|
||||
public Object updateVender(MultipartFile brandLogoImg, Tbl_Vender_List tbl_Vender_List);
|
||||
|
||||
/**
|
||||
* 新增鱼缸厂页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ModelAndView addVender();
|
||||
|
||||
/**
|
||||
* 根据鱼缸厂code删除鱼缸厂信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public Object deleteVender(String code);
|
||||
|
||||
/**
|
||||
* 修改鱼缸厂在APP端是否展示
|
||||
*
|
||||
* @param code
|
||||
* @param appshow
|
||||
* @return
|
||||
*/
|
||||
public Object updateAppShow(String code, String appshow);
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE device_id= #{deviceid}")
|
||||
Tbl_Device getDeviceById(@Param("deviceid") Integer deviceid);
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE camera_id= #{cameraID}")
|
||||
Tbl_Device getDeviceByCameraId(@Param("cameraID") String cameraID);
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,off_line,"
|
||||
@Select("SELECT device_id,server_ip,device_ip,is_camera,mac_address,login_time,is_blacklist,hardware_type,on_off,"
|
||||
+ "today_remind,water_remind,remind_cycle,remind_date,factory_code,brand_code,create_time,active_code,active_time,update_time,camera_id from tbl_device WHERE mac_address= #{mac_address}")
|
||||
Tbl_Device getDeviceByMacAddress(@Param("mac_address") String macAddress);
|
||||
|
||||
@@ -61,7 +61,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id = #{userid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE user_id = #{userid}")
|
||||
List<Tbl_Device_User> getDeviceUsersByUserId(@Param("userid") Integer userid);
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id <> ${userid} AND device_id = #{deviceid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE user_id <> ${userid} AND device_id = #{deviceid}")
|
||||
List<Tbl_Device_User> getOtherDeviceUsersByOtherUserIdAndDeviceId(@Param("userid") Integer userid, @Param("deviceid") Integer deviceId);
|
||||
|
||||
/**
|
||||
@@ -81,7 +81,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE user_id = #{userid} AND device_id = #{deviceid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE user_id = #{userid} AND device_id = #{deviceid}")
|
||||
Tbl_Device_User getDeviceUsersByUserIdAndDeviceId(@Param("userid") Integer userid, @Param("deviceid") Integer deviceId);
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ public interface Tbl_Device_Mapper {
|
||||
* @param deviceId
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live from tbl_device_user WHERE device_id = #{deviceid}")
|
||||
@Select("SELECT id,user_id,device_id,is_master,show_name,create_time,update_time,custom_icon_name,custom_show_name,is_look,is_live,off_line from tbl_device_user WHERE device_id = #{deviceid}")
|
||||
List<Tbl_Device_User> getDeviceUsersByDeviceId(@Param("deviceid") Integer deviceId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,6 +55,9 @@ public class Tbl_Device_MapperSql {
|
||||
if (StringUtils.isNotBlank(device_User.getIsLive())) {
|
||||
sb.append("is_live = #{deviceUser.isLive}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device_User.getOffLine())) {
|
||||
sb.append("off_line = #{deviceUser.offLine}, ");
|
||||
}
|
||||
sb.append("update_time = now() ");
|
||||
sb.append(" WHERE id = #{deviceUser.id}");
|
||||
return sb.toString();
|
||||
@@ -234,9 +237,6 @@ public class Tbl_Device_MapperSql {
|
||||
if (StringUtils.isNotBlank(device.getOnOff())) {
|
||||
sb.append("on_off = #{device.onOff}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getOffLine())) {
|
||||
sb.append("off_line = #{device.offLine} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getTodayRemind())) {
|
||||
sb.append("today_remind = #{device.todayRemind}, ");
|
||||
}
|
||||
|
||||
@@ -144,4 +144,13 @@ public interface Tbl_Factory_List_Mapper {
|
||||
*/
|
||||
@Insert("INSERT INTO tbl_factory_vender(factory_code,brand_code) VALUES(#{factorycode},#{brandcode})")
|
||||
Integer insertFactoryVender(@Param("factorycode") String factoryCode, @Param("brandcode") String brandCode);
|
||||
|
||||
/**
|
||||
* 插入一条电子厂数据
|
||||
*
|
||||
* @param tbl_Factory_List
|
||||
* @return
|
||||
*/
|
||||
@Insert("INSERT INTO Tbl_factory_list(factory_code,factory_name,create_time,is_tax) VALUES(#{factory.factoryCode},#{factory.factoryName},NOW(),'0')")
|
||||
Integer insertFactoryList(@Param("factory") Tbl_Factory_List tbl_Factory_List);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,15 @@ public interface Tbl_Live_Room_Mapper {
|
||||
@Select("SELECT ROOM_ID,USER_ID,CAMERA_ID,ROOM_NAME,ROOM_DESC,ROOM_STATUS,POPULARITY_VALUE,CREATE_TIME,UPDATE_TIME,room_Img,zanNum FROM TBL_LIVE_ROOM WHERE ROOM_ID = #{roomid}")
|
||||
Tbl_Live_Room getTbl_Live_RoomById(@Param("roomid") Integer roomid);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID查询直播间信息
|
||||
*
|
||||
* @param roomid
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT ROOM_ID,USER_ID,CAMERA_ID,ROOM_NAME,ROOM_DESC,ROOM_STATUS,POPULARITY_VALUE,CREATE_TIME,UPDATE_TIME,room_Img,zanNum FROM TBL_LIVE_ROOM WHERE CAMERA_ID = #{cameraid}")
|
||||
Tbl_Live_Room getTbl_Live_RoomByCameraId(@Param("cameraid") String cameraid);
|
||||
|
||||
/**
|
||||
* 根据开播时间来查询直播间
|
||||
*
|
||||
@@ -175,9 +184,18 @@ public interface Tbl_Live_Room_Mapper {
|
||||
+ "from tbl_live_message l "
|
||||
+ "LEFT JOIN tbl_user u ON l.user_id = u.user_id "
|
||||
+ "LEFT JOIN tbl_user uu ON l.as_user_id=uu.user_id "
|
||||
+ "WHERE room_id = #{roomid} LIMIT ${first},${page} ")
|
||||
+ "WHERE room_id = #{roomid} ORDER BY l.create_time DESC LIMIT ${first},${page} ")
|
||||
List<Map> getLive_MessagesListByRoomId(@Param("roomid") Integer roomid, @Param("first") Integer firstResult, @Param("page") Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取直播间评论总数
|
||||
*
|
||||
* @param roomid
|
||||
* @return
|
||||
*/
|
||||
@Select("select count(1) from tbl_live_message WHERE room_id = #{roomid}")
|
||||
Integer getLive_MessagesCountByRoomId(@Param("roomid") Integer roomid);
|
||||
|
||||
/**
|
||||
* 根据直播间和用户ID获取观看记录
|
||||
*
|
||||
@@ -206,4 +224,12 @@ public interface Tbl_Live_Room_Mapper {
|
||||
@Insert("INSERT INTO TBL_LIVE_WATCH(room_id,user_id,update_time,create_time) VALUES (#{live.roomId},#{live.userId},#{live.updateTime},#{live.createTime})")
|
||||
Integer insertTbl_Live_Watch(@Param("live") Tbl_Live_Watch live);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID删除直播间
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE TBL_LIVE_ROOM WHERE camera_id = #{cameraid}")
|
||||
Integer deleteLive_RoomByCameraId(@Param("cameraid") String cameraId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.mapper;
|
||||
|
||||
import com.ifish.bean.Tbl_Vender_List;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
import org.apache.ibatis.annotations.UpdateProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface Tbl_Vender_List_Mapper {
|
||||
|
||||
/**
|
||||
* 鱼缸厂获取列表数据
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param appShow
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @param brandName
|
||||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_Vender_List_MapperSql.class, method = "getlistData")
|
||||
List<Map> getlistData(Integer start, Integer length, @Param("appshow") String appShow, String sortField, String sortMode, String brandName);
|
||||
|
||||
/**
|
||||
* 获取所有鱼缸厂总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT COUNT(1) from tbl_vender_list")
|
||||
Integer getlistDataAllCount();
|
||||
|
||||
/**
|
||||
* 根据条件查询鱼缸厂数量
|
||||
*
|
||||
* @param appShow
|
||||
* @param brandName
|
||||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_Vender_List_MapperSql.class, method = "getlistDataCount")
|
||||
Integer getlistDataCount(@Param("appshow") String appShow, @Param("brandname") String brandName);
|
||||
|
||||
/**
|
||||
* 根据鱼缸厂代码获取鱼缸厂对象
|
||||
*
|
||||
* @param brandCode
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT brand_code ,brand_logo ,brand_name,brand_introduce,app_show,contact_phone,contact_address,create_time from tbl_vender_list where brand_code = #{code}")
|
||||
Tbl_Vender_List getTbl_Vender_ListByBrandCode(@Param("code") String brandCode);
|
||||
|
||||
/**
|
||||
* 修改鱼缸厂信息
|
||||
*
|
||||
* @param vender_List
|
||||
* @return
|
||||
*/
|
||||
@UpdateProvider(type = Tbl_Vender_List_MapperSql.class, method = "updateVender")
|
||||
Integer updateVender(@Param("vender") Tbl_Vender_List vender_List);
|
||||
|
||||
/**
|
||||
* 插入一条鱼缸厂信息
|
||||
*
|
||||
* @param vender_List
|
||||
* @return
|
||||
*/
|
||||
@Insert("INSERT Tbl_Vender_List (brand_code,brand_logo,brand_name,brand_introduce,app_show,contact_phone,contact_address,create_time) VALUES (#{vender.brandCode},#{vender.brandLogo},#{vender.brandName},#{vender.brandIntroduce},#{vender.appShow},#{vender.contactPhone},#{vender.contactAddress},NOW())")
|
||||
Integer insertVender(@Param("vender") Tbl_Vender_List vender_List);
|
||||
|
||||
/**
|
||||
* 删除一条鱼缸厂信息
|
||||
*
|
||||
* @param brandCode
|
||||
* @return
|
||||
*/
|
||||
@Delete("DELETE FROM Tbl_Vender_List WHERE brand_code = #{brandCode}")
|
||||
Integer deleteVender(@Param("brandCode") String brandCode);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.mapper;
|
||||
|
||||
import com.ifish.bean.Tbl_Vender_List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public class Tbl_Vender_List_MapperSql {
|
||||
|
||||
/**
|
||||
* 根据条件查询鱼缸厂信息
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param appShow
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @param brandName
|
||||
* @return
|
||||
*/
|
||||
public String getlistData(Integer start, Integer length, @Param("appshow") String appShow, String sortField, String sortMode, String brandName) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT brand_code AS brandCode,brand_logo AS brandLogo,brand_name AS brandName,brand_introduce AS brandIntroduce,app_show AS appShow,contact_phone AS phone,contact_address AS address,create_time AS createTime from tbl_vender_list ");
|
||||
sb.append(" WHERE 1=1 ");
|
||||
if (StringUtils.isNotBlank(appShow)) {
|
||||
sb.append(" AND app_show = #{appshow}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(brandName)) {
|
||||
sb.append(" AND brand_name LIKE '%" + brandName + "%'");
|
||||
}
|
||||
sb.append(" ORDER BY ").append(sortField + " ").append(sortMode);;
|
||||
|
||||
sb.append(" LIMIT ").append(start).append(",").append(length);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询鱼缸厂数量
|
||||
*
|
||||
* @param appShow
|
||||
* @param brandName
|
||||
* @return
|
||||
*/
|
||||
public String getlistDataCount(@Param("appshow") String appShow, @Param("brandname") String brandName) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT count(1) from tbl_vender_list ");
|
||||
sb.append(" WHERE 1=1 ");
|
||||
if (StringUtils.isNotBlank(appShow)) {
|
||||
sb.append(" AND app_show = #{appshow}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(brandName)) {
|
||||
sb.append(" AND brand_name = #{brandname}");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改鱼缸厂信息
|
||||
*
|
||||
* @param vender_List
|
||||
* @return
|
||||
*/
|
||||
public String updateVender(@Param("vender") Tbl_Vender_List vender_List) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("UPDATE TBL_VENDER_LIST SET ");
|
||||
if (StringUtils.isNotBlank(vender_List.getBrandLogo())) {
|
||||
sb.append(" brand_logo = #{vender.brandLogo}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(vender_List.getBrandName())) {
|
||||
sb.append(" brand_name = #{vender.brandName}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(vender_List.getBrandIntroduce())) {
|
||||
sb.append(" brand_introduce = #{vender.brandIntroduce}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(vender_List.getAppShow())) {
|
||||
sb.append(" app_show = #{vender.appShow}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(vender_List.getContactPhone())) {
|
||||
sb.append(" contact_phone = #{vender.contactPhone}, ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(vender_List.getContactAddress())) {
|
||||
sb.append(" contact_address = #{vender.contactAddress}, ");
|
||||
}
|
||||
sb.append("update_time = NOW() ").append("WHERE brand_code = #{vender.brandCode}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -131,9 +131,9 @@
|
||||
<ul class="nav sub">
|
||||
<li><a href="factorylist"><i class="im-user2"></i> 电子厂信息</a>
|
||||
</li>
|
||||
<li><a href="form-validation.html"><i class="im-users2"></i> 鱼缸场信息</a>
|
||||
<li><a href="venderlist"><i class="im-users2"></i> 鱼缸场信息</a>
|
||||
</li>
|
||||
<li><a href="form-wizard.html"><i class="im-dribbble"></i> 查询统计</a>
|
||||
<li><a href="querylist"><i class="im-dribbble"></i> 查询统计</a>
|
||||
</li>
|
||||
<li><a href="form-wizard.html"><i class="im-dribbble3"></i> 授权统计</a>
|
||||
</li>
|
||||
|
||||
@@ -45,4 +45,19 @@
|
||||
<definition name="factorydetail" extends="base">
|
||||
<put-attribute name="body" value="/WEB-INF/views/factory/detail.jsp" />
|
||||
</definition>
|
||||
|
||||
<!-- 鱼缸厂列表 -->
|
||||
<definition name="venderlist" extends="base">
|
||||
<put-attribute name="body" value="/WEB-INF/views/vender/list.jsp" />
|
||||
</definition>
|
||||
|
||||
<!-- 鱼缸厂详情 -->
|
||||
<definition name="venderdetail" extends="base">
|
||||
<put-attribute name="body" value="/WEB-INF/views/vender/detail.jsp" />
|
||||
</definition>
|
||||
|
||||
<!-- 厂家管理查询统计 -->
|
||||
<definition name="querylist" extends="base">
|
||||
<put-attribute name="body" value="/WEB-INF/views/query/list.jsp" />
|
||||
</definition>
|
||||
</tiles-definitions>
|
||||
@@ -11,7 +11,15 @@
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">电子厂编号:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<input type="text" value="${factory.factoryCode}" disabled="disabled" class="form-control input-xlarge">
|
||||
<c:choose>
|
||||
<c:when test="${factory.factoryCode != null}">
|
||||
<input type="text" id="factoryCode" value="${factory.factoryCode}" disabled="disabled" class="form-control input-xlarge">
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<input type="text" id="factoryCode" class="form-control input-xlarge">
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -47,6 +55,9 @@
|
||||
<label class="checkbox-inline">
|
||||
<div class="icheckbox_flat-blue" style="position: relative;">
|
||||
<c:choose>
|
||||
<c:when test="${factory.factoryCode == null}">
|
||||
<input type="checkbox" class="hardwareTypeCheckbox" value="${item.hardwareType}" style="position: absolute; opacity: 0;">
|
||||
</c:when>
|
||||
<c:when test="${fn:contains(item.factoryCode,factory.factoryCode)}">
|
||||
<input type="checkbox" class="hardwareTypeCheckbox" value="${item.hardwareType}" checked="checked" style="position: absolute; opacity: 0;">
|
||||
</c:when>
|
||||
@@ -104,7 +115,7 @@
|
||||
$.ajax({
|
||||
url: 'updateFactory',
|
||||
type: 'post',
|
||||
data: {"brandCodes": $('#brandCodes').val(), "hardwareTypes": $('#hardwareTypes').val(), "factoryName": $('#factoryName').val(), "factoryCode": '${factory.factoryCode}'},
|
||||
data: {"brandCodes": $('#brandCodes').val(), "hardwareTypes": $('#hardwareTypes').val(), "factoryName": $('#factoryName').val(), "factoryCode": $('#factoryCode').val()},
|
||||
success: function (data) {
|
||||
alert(data);
|
||||
},
|
||||
|
||||
@@ -37,11 +37,27 @@
|
||||
}
|
||||
|
||||
function deleteFactory(code) {
|
||||
console.log(code);
|
||||
if (window.confirm('你确定要删除吗?')) {
|
||||
$.ajax({
|
||||
url: 'deleteFactory',
|
||||
type: 'post',
|
||||
data: {"code": code},
|
||||
success: function (data) {
|
||||
alert(data);
|
||||
location.reload();
|
||||
},
|
||||
error: function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//alert("取消");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var table = $('#datatable').on('init.dt', function () {
|
||||
var table = $('#datatable').on('draw.dt', function () {
|
||||
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
|
||||
elems.forEach(function (html) {
|
||||
var switchery = new Switchery(html);
|
||||
@@ -129,7 +145,7 @@
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "<a href='userDetail?userId=" + row.userId + "' target='_blank' title='查看报表' class='label label-success'><span class='im-profile'></span></a>";
|
||||
str = str + "<a href='updateFactoryDetail?code=" + row.factoryCode + "' target='_blank' title='修改' class='label label-primary'><span class='fa-edit'></span></a>";
|
||||
str = str + "<a href='javascript:void(0);' onclick='deleteFactory('" + row.factoryCode + "')' target='_blank' title='删除' class='label label-danger'><span class='im-profile'></span></a>";
|
||||
str = str + "<a href='javascript:void(0);' onclick='deleteFactory(\"" + row.factoryCode + "\")' target='_blank' title='删除' class='label label-danger'><span class='im-profile'></span></a>";
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -143,6 +159,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$("#datatable_length").append(' <label><a href="addFactory" target="_blank" class="btn btn-primary"><i class="fa-edit"></i><span class="no-text-shadow">新增</span></a></label>');
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<%--
|
||||
Document : list
|
||||
Created on : 2017-8-9, 15:09:15
|
||||
Author : Administrator
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>JSP Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -369,6 +369,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
<%--
|
||||
Document : detail
|
||||
Created on : 2017-8-8, 15:02:47
|
||||
Author : Administrator
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<form class="form-horizontal group-border hover-stripped" role="form" id="saveForm" action="updateVender" method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">品牌Logo:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<img src="${vender.brandLogo}">
|
||||
<input type="file" id="brandLogoImg" name="brandLogoImg" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">品牌编号:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<input type="text" class="form-control input-xlarge" id="brandCode" value="${vender.brandCode}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">品牌名称:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<input type="text" class="form-control input-xlarge" id="brandName" value="${vender.brandName}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">品牌介绍:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<input type="text" class="form-control input-xlarge" id="brandIntroduce" value="${vender.brandIntroduce}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">APP展示:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<select id="appShow" name="appShow">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">展示</option>
|
||||
<option value="0">不展示</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">联系电话:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<input type="text" class="form-control input-xlarge" id="contactPhone" value="${vender.contactPhone}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-lg-2 col-md-2 col-sm-12 control-label">系地址:</label>
|
||||
<div class="col-lg-10 col-md-10">
|
||||
<input type="text" class="form-control input-xlarge" id="contactAddress" value="${vender.contactAddress}">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="form-group" style="margin-left: 418px;margin-top: 40px">
|
||||
<button class="btn btn-primary" id="btnSend"><i class="fa-ok bigger-110"></i>提交</button>
|
||||
|
||||
<button class="btn" id="btnfalse"><i class="fa-undo bigger-110" ></i>取消</button>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
$(function () {
|
||||
var a = $('#crumb');
|
||||
a.children()[1].remove();
|
||||
a.append('<li>用户详情<li>');
|
||||
var b = $('.hasSub')[3];
|
||||
b.children[0].className = 'expand active-state';
|
||||
b.children[1].className = 'nav sub show';
|
||||
b.children[0].children[0].style.transform = 'rotate(-180deg)';
|
||||
b.children[1].children[0].children[0].className = 'active';
|
||||
|
||||
var appshow = '${vender.appShow}';
|
||||
if (appshow != '') {
|
||||
$("#appShow").find("option[value=" + appshow + "]").prop("selected", true);
|
||||
}
|
||||
|
||||
$('#btnSend').click(function () {
|
||||
var formData = new FormData();
|
||||
formData.append("brandLogoImg", document.getElementById("brandLogoImg").files[0]);
|
||||
formData.append("brandCode", $('#brandCode').val());
|
||||
formData.append("brandName", $('#brandName').val());
|
||||
formData.append("brandIntroduce", $('#brandIntroduce').val());
|
||||
formData.append("appShow", $('#appShow').val());
|
||||
formData.append("contactPhone", $('#contactPhone').val());
|
||||
formData.append("contactAddress", $('#contactAddress').val());
|
||||
var a = {"brandLogoImg": formData, "brandCode": $('#brandCode').val(), "brandName": $('#brandName').val(), "brandIntroduce": $('#brandIntroduce').val(), "appShow": $('#appShow').val(), "contactPhone": $('#contactPhone').val(), "contactAddress": $('#contactAddress').val()};
|
||||
$.ajax({
|
||||
url: 'updateVender',
|
||||
type: 'post',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
enctype: "multipart/form-data ", //必须false才会自动加上正确的Content-Type
|
||||
success: function (data) {
|
||||
alert(data);
|
||||
},
|
||||
error: function (data) {
|
||||
alert("修改出错!");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btnfalse').click(function () {
|
||||
window.opener = null;
|
||||
window.open('', '_self');
|
||||
window.close();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,234 @@
|
||||
<%--
|
||||
Document : list
|
||||
Created on : 2017-8-8, 10:34:07
|
||||
Author : Administrator
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<div id="searchDiv" style="float: right">
|
||||
APP展示:
|
||||
<select id="appShow" name="appShow">
|
||||
<option value="">请选择</option>
|
||||
<option value="1">YES</option>
|
||||
<option value="0">NO</option>
|
||||
</select>
|
||||
排序字段:
|
||||
<select id="sortField" name="sortField">
|
||||
<option value="">请选择</option>
|
||||
<option value="brand_code">品牌编号</option>
|
||||
<option value="create_time">创建时间</option>
|
||||
</select>
|
||||
排序方式:
|
||||
<select id="sortMode" name="sortMode">
|
||||
<option value="">请选择</option>
|
||||
<option value="ASC">升序↑</option>
|
||||
<option value="DESC">降序↓</option>
|
||||
</select>
|
||||
搜索名称:<input type="text" id="brandName" name="brandName" style="width: 130px;" />
|
||||
|
||||
<button type="button" class="btn btn-sm btn-info" id="btnSearch" style="margin-right:20px;">确定</button>
|
||||
</div>
|
||||
<table class="dataTable cell-border" id="datatable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>品牌编号</th>
|
||||
<th>品牌Logo</th>
|
||||
<th>品牌名称</th>
|
||||
<th>品牌介绍</th>
|
||||
<th>APP展示</th>
|
||||
<th>联系电话</th>
|
||||
<th>联系地址</th>
|
||||
<th>创建时间</th>
|
||||
<th>修改</th>
|
||||
<th>删除</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<script>
|
||||
|
||||
function changeIsTax(a, code) {
|
||||
var isTax = a.checked ? "1" : "0";
|
||||
$.ajax({
|
||||
url: 'updateAppShow',
|
||||
type: 'post',
|
||||
data: {"code": code, "appshow": isTax},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
},
|
||||
error: function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//删除鱼缸厂
|
||||
function deleteVender(code) {
|
||||
if (window.confirm('你确定要删除吗?')) {
|
||||
$.ajax({
|
||||
url: 'deleteVender',
|
||||
type: 'post',
|
||||
data: {"code": code},
|
||||
success: function (data) {
|
||||
alert(data);
|
||||
location.reload();
|
||||
},
|
||||
error: function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//alert("取消");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
var table = $('#datatable').on('draw.dt', function () {
|
||||
var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
|
||||
elems.forEach(function (html) {
|
||||
var switchery = new Switchery(html);
|
||||
});
|
||||
}).DataTable({
|
||||
//记录用户状态
|
||||
stateSave: true,
|
||||
//中文自定义
|
||||
language: {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
},
|
||||
//是否显示排序
|
||||
bSort: false,
|
||||
//是否显示过滤搜索
|
||||
bFilter: false,
|
||||
//页脚展示风格
|
||||
pagingType: "full_numbers",
|
||||
//是否启动服务器数据处理
|
||||
serverSide: true,
|
||||
autoWidth: false,
|
||||
//ajax获取服务器数据
|
||||
ajax: {
|
||||
url: 'venderdata',
|
||||
type: 'post',
|
||||
data: function (d) {
|
||||
d.appShow = $('#appShow').val();
|
||||
d.sortField = $('#sortField').val();
|
||||
d.sortMode = $('#sortMode').val();
|
||||
d.brandName = $('#brandName').val();
|
||||
}
|
||||
},
|
||||
//数据展示
|
||||
columns: [
|
||||
{
|
||||
"data": "brandCode",
|
||||
"width": "28px"
|
||||
},
|
||||
{
|
||||
"data": "brandLogo",
|
||||
"width": "28px",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.brandLogo != '') {
|
||||
str = '<img src="' + row.brandLogo + '">';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "brandName",
|
||||
"width": "28px"
|
||||
},
|
||||
{
|
||||
"data": "brandIntroduce",
|
||||
"width": "28px",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.brandIntroduce != '') {
|
||||
str = '<a href="' + row.brandIntroduce + '" target="_blank">' + row.brandIntroduce + '</a>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "appShow",
|
||||
"width": "28px",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.appShow === '0') {
|
||||
str = '<input type="checkbox" id="isTaxCheck" onclick="changeIsTax(this,\'' + row.brandCode + '\');" class="js-switch" style="display: none;" value="0">';
|
||||
} else {
|
||||
str = '<input type="checkbox" id="isTaxCheck" onclick="changeIsTax(this,\'' + row.brandCode + '\');" class="js-switch" style="display: none;" value="1" checked="checked">';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "phone",
|
||||
"width": "28px"
|
||||
},
|
||||
{
|
||||
"data": "address",
|
||||
"width": "28px"
|
||||
},
|
||||
{
|
||||
"data": "createTime",
|
||||
"width": "28px"
|
||||
},
|
||||
{
|
||||
"data": "brandCode",
|
||||
"width": "28px",
|
||||
render: function (data, type, row, meta) {
|
||||
var str;
|
||||
str = "<a href='venderdetail?brandCode=" + row.brandCode + "' target='_blank' title='修改' class='label label-primary'><span class='fa-edit'></span></a>";
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "brandCode",
|
||||
"width": "28px",
|
||||
render: function (data, type, row, meta) {
|
||||
var str;
|
||||
str = "<a href='javascript:void(0);' onclick='deleteVender(\"" + row.brandCode + "\")' target='_blank' title='删除' class='label label-danger'><span class='im-profile'></span></a>";
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#appShow,#sortField,#sortMode').change(function () {
|
||||
table.ajax.reload(null, true);
|
||||
});
|
||||
|
||||
$('#btnSearch').click(function () {
|
||||
table.ajax.reload(null, true);
|
||||
});
|
||||
|
||||
$(document).keyup(function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
table.ajax.reload(null, true);
|
||||
}
|
||||
});
|
||||
|
||||
$("#datatable_length").append(' <label><a href="addVender" target="_blank" class="btn btn-primary"><i class="fa-edit"></i><span class="no-text-shadow">新增</span></a></label>');
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user