新增功能及名称控制

This commit is contained in:
yan.y 2025-09-18 15:01:34 +08:00
parent ef74154136
commit 4bc9778d38
23 changed files with 1134 additions and 69 deletions

View File

@ -1,6 +1,9 @@
package com.ifish.action;
import com.alibaba.fastjson.JSONObject;
import com.ifish.dao.HardwareTypeAttriDao;
import com.ifish.dao.HardwareVenderDao;
import com.ifish.domain.FactoryVenderData;
import com.ifish.domain.JsonResult;
import com.ifish.entity.*;
import com.ifish.enums.*;
@ -17,9 +20,12 @@ import com.ifish.util.ResultUtil;
import com.ifish.webService.MyService;
import com.ifish.webService.MyServiceService;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
@ -29,6 +35,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.*;
@ -515,7 +522,20 @@ public class AdminAction {
@ResponseBody
public Object venderListInf(SearchFilter searchFilter) {
try {
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = adminService.getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
searchFilter.setFactoryCode(code);
}
Pagination<VenderList> page = this.adminService.getVenderListByPage(searchFilter);
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
List<FactoryVenderData> factoryVenderData = this.adminService.getFactoryBrandList();
for (VenderList venderList : page.getList()) {
Optional<FactoryVenderData> optionalVenderList = factoryVenderData.stream().filter(f -> f.getBrand_code().equals(venderList.getBrandCode())).findFirst();
optionalVenderList.ifPresent(list -> venderList.setBackground(list.getBackground()));
}
}
return IfishUtil.returnPageData(page, searchFilter.getsEcho());
} catch (Exception e) {
log.error("get venderList page information:error message:{}", e.toString());
@ -576,10 +596,15 @@ public class AdminAction {
* @return
*/
@RequestMapping("/updateVender.do")
public ModelAndView updateVender(VenderList venderList, String base64) {
public ModelAndView updateVender(VenderList venderList, String base64 ,MultipartFile fileUpload) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("venderList", venderList);
try {
if (fileUpload != null) {
String newImgName = System.currentTimeMillis() +".png";
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_goods,newImgName,fileUpload);
venderList.setBackground(newImgName);
}
String status = this.adminService.UpdateVender(venderList, base64);
map.put("status", status);
if (status.equals(SysUserEnum.success100.getKey())) {
@ -889,6 +914,12 @@ public class AdminAction {
@ResponseBody
public Object hardwareTypeInf(SearchFilter searchFilter) {
try {
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = adminService.getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
searchFilter.setFactoryCode(code);
}
Pagination<HardwareType> page = this.adminService.getHardwareTypeByPage(searchFilter);
return IfishUtil.returnPageData(page, searchFilter.getsEcho());
} catch (Exception e) {
@ -919,6 +950,7 @@ public class AdminAction {
deviceAttr1List.add(new CheckNames("12", "S12开关", false));
List<CheckNames> deviceAttr3List = new ArrayList<>();
deviceAttr3List.add(new CheckNames("13", "加热制冷模式", false));
deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", false));
deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", false));
deviceAttr3List.add(new CheckNames("27", "喂鱼设置", false));
@ -982,6 +1014,7 @@ public class AdminAction {
deviceAttr1List.add(new CheckNames("11", "S11开关", hasAttr && hardwareTypeAttri.getSwitchS11() == 1));
deviceAttr1List.add(new CheckNames("12", "S12开关", hasAttr && hardwareTypeAttri.getSwitchS12() == 1));
List<CheckNames> deviceAttr3List = new ArrayList<>();
deviceAttr3List.add(new CheckNames("13", "加热制冷模式", hasAttr && hardwareTypeAttri.getHeatingSet() == 1));
deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", hasAttr && hardwareTypeAttri.getTemperature1() == 1));
deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", hasAttr && hardwareTypeAttri.getTemperature2() == 1));
deviceAttr3List.add(new CheckNames("27", "喂鱼设置", hasAttr && hardwareTypeAttri.getFeedfishSet() == 1));
@ -1002,6 +1035,8 @@ public class AdminAction {
return new ModelAndView("redirect:/page/admin/hardwareTypeList.do");
}
@Resource
private HardwareTypeAttriDao hardwareTypeAttriDao;
/**
* 更新硬件设备默认名称
@ -1009,14 +1044,19 @@ public class AdminAction {
* @return
*/
@RequestMapping("/doUpdateHardwareAttr.do")
public ModelAndView doUpdateHardwareAttr(String hardwareType) {
public ModelAndView doUpdateHardwareAttr(String hardwareType,String venderCode) {
if (hardwareType != null) {
FactoryVenderHardwareTypeAttri factoryVenderHardwareTypeAttri = this.adminService.getFactoryVenderHardwareTypeAttri(hardwareType);
Map<String, Object> map = new HashMap<String, Object>();
FactoryVenderHardwareTypeAttri factoryVenderHardwareTypeAttri = this.adminService.getFactoryVenderHardwareTypeAttri(hardwareType, venderCode);
Map<String, Object> map = new HashMap<>();
if (factoryVenderHardwareTypeAttri == null) {
factoryVenderHardwareTypeAttri = new FactoryVenderHardwareTypeAttri();
factoryVenderHardwareTypeAttri.setHardwareType(hardwareType);
}
HardwareTypeAttri hardwareTypeAttri = hardwareTypeAttriDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType));
if (hardwareTypeAttri == null) {
hardwareTypeAttri = new HardwareTypeAttri();
}
map.put("hardwareTypeAttrSwitch", hardwareTypeAttri);
map.put("hardwareTypeAttr", factoryVenderHardwareTypeAttri);
return new ModelAndView("roleAdmin/editHardwareTypeAttr", map);
}
@ -1043,7 +1083,7 @@ public class AdminAction {
@RequestParam("fileUpload11") MultipartFile fileUpload11,
@RequestParam("fileUpload12") MultipartFile fileUpload12) throws IOException {
if (factoryVenderHardwareTypeAttriForm.getHardwareType() != null) {
FactoryVenderHardwareTypeAttri factoryVenderHardwareTypeAttri = this.adminService.getFactoryVenderHardwareTypeAttri(factoryVenderHardwareTypeAttriForm.getHardwareType());
FactoryVenderHardwareTypeAttri factoryVenderHardwareTypeAttri = this.adminService.getFactoryVenderHardwareTypeAttri(factoryVenderHardwareTypeAttriForm.getHardwareType(), factoryVenderHardwareTypeAttriForm.getVenderCode());
if (factoryVenderHardwareTypeAttri == null) {
factoryVenderHardwareTypeAttri = new FactoryVenderHardwareTypeAttri();
factoryVenderHardwareTypeAttri.setHardwareType(factoryVenderHardwareTypeAttriForm.getHardwareType());
@ -1146,7 +1186,7 @@ public class AdminAction {
}
this.adminService.saveFactoryHardwareTypeAttr(factoryVenderHardwareTypeAttri);
}
return new ModelAndView("redirect:/page/admin/hardwareTypeList.do");
return new ModelAndView("redirect:/page/admin/factoryList1.do");
}
/**
@ -1381,6 +1421,16 @@ public class AdminAction {
return new ModelAndView("roleAdmin/factoryList");
}
/**
* 电子厂信息
*
* @return
*/
@RequestMapping("/factoryList1.do")
public ModelAndView factoryList1() {
return new ModelAndView("roleAdmin/factoryList1");
}
/**
* 电子厂信息列表
*
@ -1394,6 +1444,12 @@ public class AdminAction {
@ResponseBody
public Object factoryListInf(SearchFilter searchFilter) {
try {
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = adminService.getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
searchFilter.setFactoryCode(code);
}
Pagination<FactoryList> page = this.adminService.getFactoryListByPage(searchFilter);
return IfishUtil.returnPageData(page, searchFilter.getsEcho());
} catch (Exception e) {
@ -1403,6 +1459,28 @@ public class AdminAction {
return null;
}
/**
* 电子厂信息列表
*
* @param iDisplayStart
* @param iDisplayLength
* @param sEcho
* @param sSearch
* @return
*/
@RequestMapping("/factoryListInf1.do")
@ResponseBody
public Object factoryListInf1(SearchFilter searchFilter) {
try {
Pagination<HardwareVender> page = this.adminService.getHardwareVenderConfig(searchFilter);
return IfishUtil.returnPageData(page, searchFilter.getsEcho());
} catch (Exception e) {
e.printStackTrace();
log.error("get factoryListInf information:error message:{}", e.toString());
}
return null;
}
/**
* 是否税收开关
*
@ -1542,6 +1620,20 @@ public class AdminAction {
return new ModelAndView("roleAdmin/addFactory", map);
}
/**
* 新增电子厂页面
*
* @return
*/
@RequestMapping("/addFactory1.do")
public ModelAndView addFactory1(ModelMap map) {
List<VenderList> venderList = adminService.getVenderList();
List<HardwareType> hardwareType = adminService.getHardwareTypeList();
map.put("venderList", venderList);
map.put("hardwareType", hardwareType);
return new ModelAndView("roleAdmin/addFactory1", map);
}
/**
* 保存电子厂
*
@ -1573,6 +1665,36 @@ public class AdminAction {
return new ModelAndView("roleAdmin/addFactory", map);
}
/**
* 保存电子厂
*
* @param factoryList
* @return
*/
@RequestMapping("/saveFactory1.do")
public ModelAndView saveFactory1(Integer id, String brandCodes, String hardwareTypes, MultipartFile fileUpload) {
Map<String, Object> map = new HashMap<>();
String status = SysUserEnum.failed101.getKey();
try {
String newImgName = "";
if (fileUpload != null) {
newImgName = System.currentTimeMillis() + ".jpg";
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_goods, newImgName, fileUpload);
}
status = this.adminService.addFactory1(brandCodes, hardwareTypes, newImgName);
map.put("status", status);
if (status.equals(SysUserEnum.success100.getKey())) {
return new ModelAndView("redirect:/page/admin/factoryList1.do");
}
List<VenderList> list = adminService.getVenderList();
map.put("list", list);
} catch (Exception e) {
map.put("status", status);
log.error("addFactory:error message:{}", e.toString());
}
return new ModelAndView("roleAdmin/addFactory1", map);
}
/**
* 删除电子厂
*
@ -1587,6 +1709,21 @@ public class AdminAction {
}
return new ModelAndView("redirect:/page/admin/factoryList.do");
}
/**
* 删除电子厂
*
* @return
*/
@RequestMapping("/deleteFactory1.do")
public ModelAndView deleteFactory1(Integer id) {
try {
HardwareVender hardwareVender = hardwareVenderDao.get(id);
adminService.deleteHardwareVender(hardwareVender);
} catch (Exception e) {
log.error("deleteFactory:error message:{}", e.toString());
}
return new ModelAndView("redirect:/page/admin/factoryList1.do");
}
/**
* 编辑电子厂页面
@ -1644,6 +1781,69 @@ public class AdminAction {
return new ModelAndView("roleAdmin/editFactory", map);
}
/**
* 编辑电子厂页面
*
* @return
*/
@RequestMapping("/editFactory1.do")
public ModelAndView editFactory1(Integer id) {
Map<String, Object> map = new HashMap<>();
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = adminService.getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
//电子厂
FactoryList factoryList = this.adminService.getFactoryByCode(code);
//鱼缸厂
List<VenderList> list = adminService.getVenderList();
Map<String, CheckNames> brandCodeMap = new HashMap<>();
for (VenderList venderList : list) {
CheckNames checkNames = new CheckNames();
checkNames.setChecked(false);
checkNames.setShowValue(venderList.getBrandCode());
checkNames.setShowName(venderList.getBrandName());
brandCodeMap.put(venderList.getBrandCode(), checkNames);
}
//电子厂下选中鱼缸厂
Iterator<VenderList> venderLists = factoryList.getVenderLists().iterator();
while (venderLists.hasNext()) {
VenderList venderList = venderLists.next();
CheckNames checkNames = new CheckNames();
checkNames.setChecked(true);
checkNames.setShowValue(venderList.getBrandCode());
checkNames.setShowName(venderList.getBrandName());
brandCodeMap.put(venderList.getBrandCode(), checkNames);
}
//硬件类型
List<HardwareType> hardwareTypeList = this.adminService.getHardwareTypeList();
Map<String, CheckNames> hardwareTypeMap = new HashMap<>();
for (HardwareType hardwareType : hardwareTypeList) {
CheckNames checkNames = new CheckNames();
checkNames.setChecked(false);
checkNames.setShowValue(hardwareType.getHardwareType());
checkNames.setShowName(hardwareType.getHardwareName());
hardwareTypeMap.put(hardwareType.getHardwareType(), checkNames);
}
//鱼缸厂下选中硬件类型
Iterator<HardwareType> hardwareTypes = factoryList.getHardwareTypeSet().iterator();
while (hardwareTypes.hasNext()) {
HardwareType hardwareType = hardwareTypes.next();
CheckNames checkNames = new CheckNames();
checkNames.setChecked(true);
checkNames.setShowValue(hardwareType.getHardwareType());
checkNames.setShowName(hardwareType.getHardwareName());
hardwareTypeMap.put(hardwareType.getHardwareType(), checkNames);
}
map.put("hardwareTypeMap", hardwareTypeMap);
map.put("factoryList", factoryList);
map.put("brandCodeMap", brandCodeMap);
map.put("hardwareVender", adminService.getHardwareVenderConfigById(id));
return new ModelAndView("roleAdmin/editFactory1", map);
}
/**
* 更新电子厂
*
@ -1694,6 +1894,41 @@ public class AdminAction {
return new ModelAndView("roleAdmin/editFactory", map);
}
@Resource
HardwareVenderDao hardwareVenderDao;
/**
* 更新电子厂
*
* @param factoryList
* @return
*/
@RequestMapping("/updateFactory1.do")
public ModelAndView updateFactory1(Integer id, String brandCodes, String hardwareTypes, MultipartFile fileUpload) {
Map<String, Object> map = new HashMap<>();
String status = SysUserEnum.success100.getKey();
try {
HardwareVender hardwareVenderConfigById = adminService.getHardwareVenderConfigById(id);
if (!fileUpload.isEmpty()) {
String newImgName = System.currentTimeMillis() + ".jpg";
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_goods, newImgName, fileUpload);
hardwareVenderConfigById.setBackground(newImgName);
}
hardwareVenderConfigById.setVenderCode(brandCodes);
hardwareVenderConfigById.setHardwareType(hardwareTypes);
hardwareVenderDao.update(hardwareVenderConfigById);
map.put("status", status);
if (status.equals(SysUserEnum.success100.getKey())) {
return new ModelAndView("redirect:/page/admin/factoryList1.do");
}
} catch (Exception e) {
status = SysUserEnum.failed101.getKey();
map.put("status", status);
log.error("updateFactory:error message:{}", e.toString());
}
return new ModelAndView("roleAdmin/editFactory1", map);
}
/**
* ****************************************消息推送列表*****************************************************
*/

View File

@ -1,7 +1,9 @@
package com.ifish.dao;
import java.util.List;
import java.util.Map;
import com.ifish.domain.FactoryVenderData;
import com.ifish.entity.FactoryList;
/**
@ -14,4 +16,8 @@ public interface FactoryListDao extends BaseDao<FactoryList, String>{
//获取鱼缸厂下所有属电子厂
public Map<String,String> getFactoryByVenderCode(String venderCode);
void updateFactoryVenderBackgroud(String brandCode, String factory, String background);
List<FactoryVenderData> getFactoryVenderList();
}

View File

@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.HardwareVender;
/**
* 广告信息
* @author Administrator
*
*/
public interface HardwareVenderDao extends BaseDao<HardwareVender, Integer>{
}

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ifish.domain.FactoryVenderData;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;
@ -40,6 +41,15 @@ public class FactoryListDaoImpl extends HibernateBaseDao<FactoryList, String> im
return returnMap;
}
@Override
public void updateFactoryVenderBackgroud(String brandCode, String factory, String background) {
getSession().createSQLQuery("update tbl_factory_vender set background = '" + background + "' where factory_code = '" + factory + "' and brand_code = '" + brandCode + "';").executeUpdate();
getSession().flush();
}
@Override
public List<FactoryVenderData> getFactoryVenderList() {
List<FactoryVenderData> list = getSession().createSQLQuery("select factory_code,brand_code,background from tbl_factory_vender").setResultTransformer(Transformers.aliasToBean(FactoryVenderData.class)).list();
return list;
}
}

View File

@ -0,0 +1,19 @@
package com.ifish.daoImpl;
import com.ifish.dao.HardwareVenderDao;
import com.ifish.entity.HardwareVender;
import com.ifish.hibernate.HibernateBaseDao;
import org.springframework.stereotype.Repository;
/**
* 广告信息
*/
@Repository
public class HardwareVenderImpl extends HibernateBaseDao<HardwareVender, Integer> implements HardwareVenderDao {
@Override
protected Class<HardwareVender> getEntityClass() {
return HardwareVender.class;
}
}

View File

@ -0,0 +1,38 @@
package com.ifish.domain;
/**
* @author: yan.y
* @Description:
* @Date: Created in 13:41 2025/9/18
* @Modified by:
*/
public class FactoryVenderData {
private String factory_code;
private String brand_code;
private String background;
public String getFactory_code() {
return factory_code;
}
public void setFactory_code(String factory_code) {
this.factory_code = factory_code;
}
public String getBrand_code() {
return brand_code;
}
public void setBrand_code(String brand_code) {
this.brand_code = brand_code;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
}

View File

@ -21,6 +21,8 @@ public class FactoryVenderHardwareTypeAttri implements Serializable{
private Integer id;
@Column(name="hardware_type")
private String hardwareType;
@Column(name="vender_code")
private String venderCode;
@Column(name="switch_s1")
private String switchS1;
@Column(name="switch_s2")
@ -83,6 +85,14 @@ public class FactoryVenderHardwareTypeAttri implements Serializable{
this.id = id;
}
public String getVenderCode() {
return venderCode;
}
public void setVenderCode(String venderCode) {
this.venderCode = venderCode;
}
public String getHardwareType() {
return hardwareType;
}

View File

@ -0,0 +1,121 @@
package com.ifish.entity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ifish.handler.CustomDateSerializer;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* 广告位信息
* @author Administrator
*
*/
@Entity
@Table(name="tbl_hardware_vender_config")
public class HardwareVender implements Serializable{
/**
* id
*/
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@Column(name="factory_code")
private String factoryCode;
@Column(name="hardware_type")
private String hardwareType;
@Transient
private String hardwareName;
@Transient
private String factoryName;
@Column(name="vender_code")
private String venderCode;
@Transient
private String venderName;
@Column(name="background")
private String background;
@JsonSerialize(using=CustomDateSerializer.class)
@Column(name="create_time")
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getVenderCode() {
return venderCode;
}
public void setVenderCode(String venderCode) {
this.venderCode = venderCode;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getVenderName() {
return venderName;
}
public void setVenderName(String venderName) {
this.venderName = venderName;
}
public String getHardwareType() {
return hardwareType;
}
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
public String getHardwareName() {
return hardwareName;
}
public void setHardwareName(String hardwareName) {
this.hardwareName = hardwareName;
}
}

View File

@ -32,7 +32,8 @@ public class VenderList implements Serializable{
private Date updateTime;
//创建时间
private Date createTime;
private String background;
public String getBrandCode() {
return brandCode;
}
@ -89,5 +90,13 @@ public class VenderList implements Serializable{
public void setLogo(String logo) {
this.logo = logo;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
}

View File

@ -47,6 +47,8 @@ public class SearchFilter implements Serializable{
private String sSearch;
//标识
private String sEcho;
private String factoryCode;
public String getSortField() {
return sortField;
@ -168,5 +170,12 @@ public class SearchFilter implements Serializable{
public void setsSearch7(String sSearch7) {
this.sSearch7 = sSearch7;
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
}

View File

@ -3,6 +3,7 @@ package com.ifish.service;
import java.util.List;
import java.util.Map;
import com.ifish.domain.FactoryVenderData;
import com.ifish.entity.*;
import org.springframework.web.multipart.MultipartFile;
@ -167,7 +168,7 @@ public interface AdminService {
//更新硬件类型
public HardwareType updateHardwareType(HardwareType hardwareType, String attr1, String attr2, String attr3);
public HardwareTypeAttri getHardwareTypeAttri(String hardwareType);
public FactoryVenderHardwareTypeAttri getFactoryVenderHardwareTypeAttri(String hardwareType);
public FactoryVenderHardwareTypeAttri getFactoryVenderHardwareTypeAttri(String hardwareType, String venderCode);
//删除硬件类型
public void deleteHardwareType(String hardwareType);
@ -186,13 +187,16 @@ public interface AdminService {
//根据编号获取电子厂信息
public FactoryList getFactoryByCode(String code);
List<FactoryVenderData> getFactoryBrandList();
//删除电子厂
public void deleteFactory(String code);
//新增电子厂信息
public String addFactory(FactoryList factoryList,String brandCodes,String hardwareTypes, String imgName);
public String addFactory1(String brandCodes,String hardwareTypes, String imgName);
//修改电子厂信息
public String updateFactory(FactoryList factoryList,String brandCodes,String hardwareTypes);
@ -313,4 +317,9 @@ public interface AdminService {
boolean billGen(String month);
void saveFactoryHardwareTypeAttr(FactoryVenderHardwareTypeAttri factoryVenderHardwareTypeAttri);
Pagination<HardwareVender> getHardwareVenderConfig(SearchFilter searchFilter);
HardwareVender getHardwareVenderConfigById(Integer id);
void deleteHardwareVender(HardwareVender hardwareVender);
}

View File

@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import com.ifish.dao.*;
import com.ifish.domain.*;
import com.ifish.entity.*;
import com.ifish.entity.event.QueueEventBody;
import com.ifish.entity.event.QueueEventEntity;
@ -17,18 +18,14 @@ import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ifish.domain.FactoryData;
import com.ifish.domain.FactoryRecordData;
import com.ifish.domain.HardwareTypeData;
import com.ifish.domain.JsonResult;
import com.ifish.domain.RecordData;
import com.ifish.domain.VenderData;
import com.ifish.entity.id.PayBillId;
import com.ifish.enums.BooleanEnum;
import com.ifish.enums.GwellEnum;
@ -51,6 +48,7 @@ import com.ifish.util.IfishUtil;
import com.ifish.util.ResultUtil;
import com.ifishNew.mapper.Tbl_Push_List_Mapper;
import javax.annotation.Resource;
import javax.jms.Destination;
import javax.jms.Session;
@ -230,12 +228,26 @@ public class AdminServiceImpl implements AdminService {
@Override
public List<VenderList> getVenderList() {
return getVenderListByPage(null).getList();
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
SearchFilter searchFilter = new SearchFilter();
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
searchFilter.setFactoryCode(code);
}
return getVenderListByPage(searchFilter).getList();
}
@Override
public List<HardwareType> getHardwareTypeList() {
return getHardwareTypeByPage(null).getList();
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
SearchFilter searchFilter = new SearchFilter();
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
searchFilter.setFactoryCode(code);
}
return getHardwareTypeByPage(searchFilter).getList();
}
/**
@ -873,6 +885,14 @@ public class AdminServiceImpl implements AdminService {
if (selectField1 != null && selectField1.length() > 0) {
queryList.add(Restrictions.eq("factoryCode", selectField1));
}
if (StringUtils.isNotBlank(searchFilter.getFactoryCode())) {
FactoryList factoryList = this.factoryListDao.get(searchFilter.getFactoryCode());
List<String> typeList = new ArrayList<>();
for (VenderList venderList : factoryList.getVenderLists()) {
typeList.add(venderList.getBrandCode());
}
queryList.add(Restrictions.in("brandCode", typeList.toArray()));
}
//排序
List<Order> orderList = new ArrayList<Order>();
//排序字段
@ -955,6 +975,14 @@ public class AdminServiceImpl implements AdminService {
vender.setLogo(picName + "?timestamp=" + System.currentTimeMillis());
}
venderListDao.save(vender);
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = getSysUserByUserName(userDetails.getUsername());
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
String code = securityUser.getCode();
FactoryList factoryList = factoryListDao.get(code);
factoryList.getVenderLists().add(vender);
factoryListDao.save(factoryList);
}
return SysUserEnum.success100.getKey();
}
}
@ -978,6 +1006,18 @@ public class AdminServiceImpl implements AdminService {
}
tmpVender.setUpdateTime(new Date());
venderListDao.update(tmpVender);
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
if (!securityUser.getRole().equals("ROLE_ADMIN")) {
FactoryList factoryList = getFactoryByCode(code);
Set<VenderList> venderLists = factoryList.getVenderLists();
for (VenderList venderList : venderLists) {
if (venderList.getBrandCode().equals(tmpVender.getBrandCode())) {
factoryListDao.updateFactoryVenderBackgroud(tmpVender.getBrandCode(), code, vender.getBackground());
}
}
}
return SysUserEnum.success100.getKey();
}
}
@ -1223,17 +1263,25 @@ public class AdminServiceImpl implements AdminService {
@Override
public Pagination<HardwareType> getHardwareTypeByPage(SearchFilter searchFilter) {
if (searchFilter != null) {
List<Criterion> queryList = new ArrayList<Criterion>();
List<Criterion> queryList = new ArrayList<>();
//排序条件
List<Order> orderList = new ArrayList<Order>();
List<Order> orderList = new ArrayList<>();
//分页
Integer iDisplayStart = searchFilter.getiDisplayStart();
Integer iDisplayLength = searchFilter.getiDisplayLength();
//输入框过滤
String sSearch = searchFilter.getsSearch();
if (sSearch != null && sSearch.length() > 0) {
if (sSearch != null && !sSearch.isEmpty()) {
queryList.add(Restrictions.like("hardwareName", "%" + sSearch + "%"));
}
if (StringUtils.isNotBlank(searchFilter.getFactoryCode())) {
FactoryList factoryList = this.factoryListDao.get(searchFilter.getFactoryCode());
List<String> typeList = new ArrayList<>();
for (HardwareType hardwareType : factoryList.getHardwareTypeSet()) {
typeList.add(hardwareType.getHardwareType());
}
queryList.add(Restrictions.in("hardwareType", typeList.toArray()));
}
orderList.add(Order.asc("hardwareType"));
Pagination<HardwareType> page = this.hardwareTypeDao.findByCriteria(iDisplayStart, iDisplayLength, orderList, queryList.toArray(new Criterion[queryList.size()]));
return page;
@ -1295,13 +1343,15 @@ public class AdminServiceImpl implements AdminService {
}
String[] attr3List = attr3.split(",");
for (String id : attr3List) {
if (id.equals("13")) {
hardwareTypeAttri.setHeatingSet(1);
hardwareTypeAttri.setRefrigerationSet(1);
}
if (id.equals("25")) {
hardwareTypeAttri.setTemperature1(1);
hardwareTypeAttri.setHeatingSet(1);
}
if (id.equals("26")) {
hardwareTypeAttri.setTemperature2(1);
hardwareTypeAttri.setRefrigerationSet(1);
}
if (id.equals("27")) {
hardwareTypeAttri.setFeedfishSet(1);
@ -1336,8 +1386,8 @@ public class AdminServiceImpl implements AdminService {
return hardwareTypeAttriDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType));
}
@Override
public FactoryVenderHardwareTypeAttri getFactoryVenderHardwareTypeAttri(String hardwareType) {
return factoryHardwareTypeAttrDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType));
public FactoryVenderHardwareTypeAttri getFactoryVenderHardwareTypeAttri(String hardwareType, String venderCode) {
return factoryHardwareTypeAttrDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType), Restrictions.eq("venderCode", venderCode));
}
@Override
@ -1427,13 +1477,15 @@ public class AdminServiceImpl implements AdminService {
}
String[] attr3List = attr3.split(",");
List<String> attr3Arr = Arrays.asList(attr3List);
if (!attr3Arr.contains("13")) {
hardwareTypeAttri.setHeatingSet(0);
hardwareTypeAttri.setRefrigerationSet(0);
}
if (!attr3Arr.contains("25")) {
hardwareTypeAttri.setTemperature1(0);
hardwareTypeAttri.setHeatingSet(0);
}
if (!attr3Arr.contains("26")) {
hardwareTypeAttri.setTemperature2(0);
hardwareTypeAttri.setRefrigerationSet(0);
}
if (!attr3Arr.contains("27")) {
hardwareTypeAttri.setFeedfishSet(0);
@ -1463,6 +1515,12 @@ public class AdminServiceImpl implements AdminService {
hardwareTypeAttri.setTemperatureShow2(0);
}
for (String id : attr3List) {
if (id.equals("13")) {
hardwareTypeAttri.setHeatingSet(1);
hardwareTypeAttri.setRefrigerationSet(1);
}
if (id.equals("25")) {
hardwareTypeAttri.setTemperature1(1);
hardwareTypeAttri.setHeatingSet(1);
@ -1755,6 +1813,11 @@ public class AdminServiceImpl implements AdminService {
return null;
}
@Override
public List<FactoryVenderData> getFactoryBrandList() {
return factoryListDao.getFactoryVenderList();
}
@Override
public void deleteFactory(String code) {
FactoryList factory = getFactoryByCode(code);
@ -1775,7 +1838,7 @@ public class AdminServiceImpl implements AdminService {
//新增电子厂
factoryList.setCreateTime(new Date());
//鱼缸厂
Set<VenderList> venderLists = new HashSet<VenderList>();
Set<VenderList> venderLists = new HashSet<>();
if (brandCodes != null && brandCodes.length() > 0) {
String[] brandCode = brandCodes.split(",");
for (int i = 0; i < brandCode.length; i++) {
@ -1802,6 +1865,24 @@ public class AdminServiceImpl implements AdminService {
return SysUserEnum.failed101.getKey();
}
@Override
public String addFactory1(String brandCodes, String hardwareTypes, String imgName) {
if (brandCodes != null && hardwareTypes != null) {
HardwareVender hardwareVender = new HardwareVender();
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
SecurityUser securityUser = getSysUserByUserName(userDetails.getUsername());
String code = securityUser.getCode();
hardwareVender.setFactoryCode(code);
hardwareVender.setVenderCode(brandCodes);
hardwareVender.setHardwareType(hardwareTypes);
hardwareVender.setBackground(imgName);
hardwareVender.setCreateTime(new Date());
hardwareVenderDao.save(hardwareVender);
return SysUserEnum.success100.getKey();
}
return SysUserEnum.failed101.getKey();
}
@Override
public String updateFactory(FactoryList factoryList, String brandCodes, String hardwareTypes) {
//鱼缸厂
@ -1843,6 +1924,9 @@ public class AdminServiceImpl implements AdminService {
if (sSearch != null && sSearch.length() > 0) {
queryList.add(Restrictions.like("factoryName", "%" + sSearch + "%"));
}
if (StringUtils.isNotBlank(searchFilter.getFactoryCode())) {
queryList.add(Restrictions.eq("factoryCode", searchFilter.getFactoryCode()));
}
//排序字段
String sortField = searchFilter.getSortField();
if (StringUtils.isNotBlank(sortField)) {
@ -3342,6 +3426,35 @@ public class AdminServiceImpl implements AdminService {
this.factoryHardwareTypeAttrDao.save(factoryVenderHardwareTypeAttri);
}
@Resource
HardwareVenderDao hardwareVenderDao;
@Override
public Pagination<HardwareVender> getHardwareVenderConfig(SearchFilter searchFilter) {
Integer iDisplayStart = searchFilter.getiDisplayStart();
Integer iDisplayLength = searchFilter.getiDisplayLength();
List<Order> orderList = new ArrayList<>();
orderList.add(Order.desc("createTime"));
Pagination<HardwareVender> hardwareVenderPagination = hardwareVenderDao.findByCriteria(iDisplayStart, iDisplayLength, orderList);
List<HardwareVender> list = hardwareVenderPagination.getList();
for (HardwareVender hardwareVender : list) {
hardwareVender.setVenderName(venderListDao.get(hardwareVender.getVenderCode()).getBrandName());
hardwareVender.setFactoryName(factoryListDao.get(hardwareVender.getFactoryCode()).getFactoryName());
hardwareVender.setHardwareName(hardwareTypeDao.get(hardwareVender.getHardwareType()).getHardwareName());
}
return hardwareVenderPagination;
}
@Override
public HardwareVender getHardwareVenderConfigById(Integer id) {
return hardwareVenderDao.get(id);
}
@Override
public void deleteHardwareVender(HardwareVender hardwareVender) {
hardwareVenderDao.delete(hardwareVender);
}
@Autowired
private FactoryService factoryService;

View File

@ -13,14 +13,8 @@
<intercept-url pattern="/page/public/changePwd.do" access="isAuthenticated()"/>
<intercept-url pattern="/page/public/savePwd.do" access="isAuthenticated()"/>
<!-- 允许所有人访问 -->
<intercept-url pattern="/page/public/**" access="permitAll"/>
<intercept-url pattern="/page/**" access="permitAll"/>
<intercept-url pattern="/page/test/test" access="permitAll"/>
<!-- 根据角色访问 -->
<intercept-url pattern="/ueditor/ueditor.jsp" access="hasAnyRole('ROLE_ADMIN')" />
<intercept-url pattern="/page/user/**" access="hasAnyRole('ROLE_USER')" />
<intercept-url pattern="/page/vender/**" access="hasAnyRole('ROLE_VENDER')" />
<intercept-url pattern="/page/factory/**" access="hasAnyRole('ROLE_FACTORY')" />
<intercept-url pattern="/page/**" access="hasAnyRole('ROLE_ADMIN')" />
<!-- 未认证页面跳转 -->
<access-denied-handler error-page="/page/public/login.do" />

View File

@ -119,12 +119,12 @@
<input type="hidden" name="hardwareTypes" id="hardwareTypes"/>
</div>
</div>
<div class="form-group">
<label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>
<div class="col-xs-7">
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control" required/>
</div>
</div>
<%-- <div class="form-group">--%>
<%-- <label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>--%>
<%-- <div class="col-xs-7">--%>
<%-- <input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control" required/>--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="submit" id="submitBtn"><i class="icon-ok bigger-110"></i>提交</button>&nbsp;&nbsp;&nbsp;&nbsp;

View File

@ -0,0 +1,127 @@
<%@page import="com.ifish.enums.SysUserEnum"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>新增鱼缸厂配置</title>
<!-- css and js -->
<%@ include file="../htm/script.jsp" %>
<script type="text/javascript">
$(function(){
//取消
$("#cancelBtn").click(function(){
location.href="<%=basePath%>page/admin/factoryList1.do";
});
$(".venderListCheckbox").change(function(){
var checkboxs = $(".venderListCheckbox");
var brandCodes = new Array();
for (var i = 0; i < checkboxs.length; i++) {
if(checkboxs[i].checked){
brandCodes.push($(checkboxs[i]).val());
}
}
$("#brandCodes").val(brandCodes);
});
$(".hardwareTypeCheckbox").change(function(){
var checkboxs = $(".hardwareTypeCheckbox");
var hardwareTypes = new Array();
for (var i = 0; i < checkboxs.length; i++) {
if(checkboxs[i].checked){
hardwareTypes.push($(checkboxs[i]).val());
}
}
$("#hardwareTypes").val(hardwareTypes);
});
});
</script>
</head>
<body>
<!-- 头部 -->
<%@ include file="../htm/header.jsp" %>
<!-- 主体 -->
<div class="main-container" id="main-container">
<div class="main-container-inner">
<!-- 侧边栏 -->
<%@ include file="../htm/sidebar.jsp" %>
<!-- 主体内容 -->
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<script type="text/javascript">
try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
</script>
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="<%=basePath%>page/public/index.do">首页</a>
</li>
<li>
<a href="<%=basePath%>page/admin/venderList.do">鱼缸厂列表</a>
</li>
</ul>
</div>
<div class="page-content">
<c:set var="failed101" value="<%=SysUserEnum.failed101.getKey()%>"></c:set>
<c:set var="warn106" value="<%=SysUserEnum.warn106.getKey()%>"></c:set>
<c:set var="warn107" value="<%=SysUserEnum.warn107.getKey()%>"></c:set>
<c:if test="${status == warn106}">
<div class="alert alert-block alert-warning">
<i class="icon-ok green"><%=SysUserEnum.warn106.getValue()%></i>
</div>
</c:if>
<c:if test="${status == warn107}">
<div class="alert alert-block alert-warning">
<i class="icon-ok green"><%=SysUserEnum.warn107.getValue()%></i>
</div>
</c:if>
<c:if test="${status == failed101}">
<div class="alert alert-block alert-danger">
<i class="icon-remove red">保存<%=SysUserEnum.failed101.getValue()%></i>
</div>
</c:if>
<h4 class="header smaller lighter blue"></h4>
<div class="row">
<div class="col-xs-12">
<form id="form-add" method="post" class="form-horizontal" action="<%=basePath%>page/admin/saveFactory1.do" enctype="multipart/form-data">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">鱼缸厂<span style="color:red;">*</span></label>
<div class="col-sm-9">
<c:forEach items="${venderList }" var="vender">
<label><input type="radio" name="brandCodes" class="venderListCheckbox" value="${vender.brandCode }"/>${vender.brandName }</label>&nbsp;&nbsp;&nbsp;&nbsp;
</c:forEach>
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">硬件类型<span style="color:red;">*</span></label>
<div class="col-sm-9">
<c:forEach items="${hardwareType }" var="hardware">
<label><input type="radio" name="hardwareTypes" class="hardwareTypeCheckbox" value="${hardware.hardwareType }"/>${hardware.hardwareName }</label>&nbsp;&nbsp;&nbsp;&nbsp;
</c:forEach>
</div>
</div>
<div class="form-group">
<label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>
<div class="col-xs-7">
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control" required/>
</div>
</div>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="submit" id="submitBtn"><i class="icon-ok bigger-110"></i>提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn" type="button" id="cancelBtn"><i class="icon-undo bigger-110"></i>取消</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- 设置工具 -->
<%@ include file="../htm/setting.jsp" %>
</div>
</div>
</body>
</html>

View File

@ -169,6 +169,15 @@
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>
<div class="col-xs-7">
<input type="hidden" name="background" id="background" value="${venderList.background}"/>
<img id="backgroud" src="<%=picturePath%>Img/goods/${venderList.background}"/>
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control"/>
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">联系电话</label>
<div class="col-sm-4">

View File

@ -122,14 +122,13 @@
<input type="hidden" name="hardwareTypes" id="hardwareTypes"/>
</div>
</div>
<div class="form-group">
<%--<div class="form-group">
<label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>
<div class="col-xs-7">
<input type="hidden" name="background" id="background" value="${factoryList.background}"/>
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control"/>
</div>
</div>
</div>--%>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="submit" id="submitBtn"><i class="icon-ok bigger-110"></i>提交</button>&nbsp;&nbsp;&nbsp;&nbsp;

View File

@ -0,0 +1,135 @@
<%@page import="com.ifish.enums.SysUserEnum"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>编辑鱼缸厂配置</title>
<!-- css and js -->
<%@ include file="../htm/script.jsp" %>
<script type="text/javascript">
$(function(){
//取消
$("#cancelBtn").click(function(){
location.href="<%=basePath%>page/admin/factoryList1.do";
});
//提交
$(".venderListCheckbox").change(function(){
var checkboxs = $(".venderListCheckbox");
var brandCodes = new Array();
for (var i = 0; i < checkboxs.length; i++) {
if(checkboxs[i].checked){
brandCodes.push($(checkboxs[i]).val());
}
}
$("#brandCodes").val(brandCodes);
});
$(".hardwareTypeCheckbox").change(function(){
var checkboxs = $(".hardwareTypeCheckbox");
var hardwareTypes = new Array();
for (var i = 0; i < checkboxs.length; i++) {
if(checkboxs[i].checked){
hardwareTypes.push($(checkboxs[i]).val());
}
}
$("#hardwareTypes").val(hardwareTypes);
});
$(".venderListCheckbox").change();
$(".hardwareTypeCheckbox").change();
});
</script>
</head>
<body>
<!-- 头部 -->
<%@ include file="../htm/header.jsp" %>
<!-- 主体 -->
<div class="main-container" id="main-container">
<div class="main-container-inner">
<!-- 侧边栏 -->
<%@ include file="../htm/sidebar.jsp" %>
<!-- 主体内容 -->
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<script type="text/javascript">
try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
</script>
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="<%=basePath%>page/public/index.do">首页</a>
</li>
<li>
<a href="<%=basePath%>page/admin/venderList.do">电子厂列表</a>
</li>
<li class="active">电子厂维护</li>
</ul>
</div>
<div class="page-content">
<c:set var="failed101" value="<%=SysUserEnum.failed101.getKey()%>"></c:set>
<c:set var="warn106" value="<%=SysUserEnum.warn106.getKey()%>"></c:set>
<c:set var="warn107" value="<%=SysUserEnum.warn107.getKey()%>"></c:set>
<c:if test="${status == warn106}">
<div class="alert alert-block alert-warning">
<i class="icon-ok green"><%=SysUserEnum.warn106.getValue()%></i>
</div>
</c:if>
<c:if test="${status == warn107}">
<div class="alert alert-block alert-warning">
<i class="icon-ok green"><%=SysUserEnum.warn107.getValue()%></i>
</div>
</c:if>
<c:if test="${status == failed101}">
<div class="alert alert-block alert-danger">
<i class="icon-remove red">保存<%=SysUserEnum.failed101.getValue()%></i>
</div>
</c:if>
<h4 class="header smaller lighter blue"></h4>
<div class="row">
<div class="col-xs-12">
<form id="form-add" method="post" class="form-horizontal" action="<%=basePath%>page/admin/updateFactory1.do" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="${hardwareVender.id}"/>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">鱼缸厂<span style="color:red;">*</span></label>
<div class="col-sm-9">
<c:forEach items="${brandCodeMap }" var="checkNames">
<label><input type="radio" name="brandCodes" class="venderListCheckbox" value="${checkNames.value.showValue }" ${checkNames.value.checked==true?"checked":""}/>${checkNames.value.showName }</label>&nbsp;&nbsp;&nbsp;&nbsp;
</c:forEach>
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">硬件类型<span style="color:red;">*</span></label>
<div class="col-sm-9">
<c:forEach items="${hardwareTypeMap }" var="checkNames">
<label><input type="radio" name="hardwareTypes" class="hardwareTypeCheckbox" value="${checkNames.value.showValue }" ${checkNames.value.checked==true?"checked":""}/>${checkNames.value.showName }</label>&nbsp;&nbsp;&nbsp;&nbsp;
</c:forEach>
</div>
</div>
<div class="form-group">
<label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>
<div class="col-xs-7">
<input type="hidden" name="background" id="background" value="${hardwareVender.background}"/>
<img id="avatar" src="<%=picturePath%>Img/goods/${hardwareVender.background}"/>
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control"/>
</div>
</div>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="submit" id="submitBtn"><i class="icon-ok bigger-110"></i>提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn" type="button" id="cancelBtn"><i class="icon-undo bigger-110"></i>取消</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- 设置工具 -->
<%@ include file="../htm/setting.jsp" %>
</div>
</div>
</body>
</html>

View File

@ -11,7 +11,7 @@
$(function(){
//取消
$("#cancelBtn").click(function(){
location.href="<%=basePath%>page/admin/hardwareTypeList.do";
location.href="<%=basePath%>page/admin/factoryList1.do";
});
});
</script>
@ -58,21 +58,31 @@
<div class="col-sm-4">
<input type="text" name="hardwareType" id="hardwareType" value="${hardwareTypeAttr.hardwareType }" ${hardwareTypeAttr.hardwareType!=null?'readonly="readonly"':'' } class="form-control" maxlength="10"/>
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关1<span style="color:red;">*</span></label>
</div><div class="form-group">
<label class="col-sm-3 control-label no-padding-right">鱼缸厂编号<span style="color:red;">*</span></label>
<div class="col-sm-4">
<input type="text" name="switchS1" id="switchS1" value="${hardwareTypeAttr.switchS1 }" class="form-control" />
<input type="text" name="venderCode" id="venderCode" value="${hardwareTypeAttr.venderCode }" ${hardwareTypeAttr.venderCode!=null?'readonly="readonly"':'' } class="form-control" maxlength="10"/>
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关2<span style="color:red;">*</span></label>
<div class="col-sm-4">
<input type="text" name="switchS2" id="switchS2" value="${hardwareTypeAttr.switchS2 }" class="form-control" />
<c:if test="${hardwareTypeAttrSwitch.switchS1 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关1<span style="color:red;">*</span></label>
<div class="col-sm-4">
<input type="text" name="switchS1" id="switchS1" value="${hardwareTypeAttr.switchS1 }" class="form-control" />
</div>
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS2 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关2<span style="color:red;">*</span></label>
<div class="col-sm-4">
<input type="text" name="switchS2" id="switchS2" value="${hardwareTypeAttr.switchS2 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS3 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关3<span style="color:red;">*</span></label>
@ -80,6 +90,8 @@
<input type="text" name="switchS3" id="switchS3" value="${hardwareTypeAttr.switchS3 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS4 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关4<span style="color:red;">*</span></label>
@ -87,6 +99,8 @@
<input type="text" name="switchS4" id="switchS4" value="${hardwareTypeAttr.switchS4 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS5 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关5<span style="color:red;">*</span></label>
@ -94,6 +108,8 @@
<input type="text" name="switchS5" id="switchS5" value="${hardwareTypeAttr.switchS5 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS6 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关6<span style="color:red;">*</span></label>
@ -101,6 +117,8 @@
<input type="text" name="switchS6" id="switchS6" value="${hardwareTypeAttr.switchS6 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS7 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关7<span style="color:red;">*</span></label>
@ -108,6 +126,8 @@
<input type="text" name="switchS7" id="switchS7" value="${hardwareTypeAttr.switchS7 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS8 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关8<span style="color:red;">*</span></label>
@ -115,6 +135,8 @@
<input type="text" name="switchS8" id="switchS8" value="${hardwareTypeAttr.switchS8 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS9 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关9<span style="color:red;">*</span></label>
@ -122,6 +144,8 @@
<input type="text" name="switchS9" id="switchS9" value="${hardwareTypeAttr.switchS9 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS10 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关10<span style="color:red;">*</span></label>
@ -129,6 +153,8 @@
<input type="text" name="switchS10" id="switchS10" value="${hardwareTypeAttr.switchS10 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS11 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关11<span style="color:red;">*</span></label>
@ -136,6 +162,8 @@
<input type="text" name="switchS11" id="switchS11" value="${hardwareTypeAttr.switchS11 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS12 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关12<span style="color:red;">*</span></label>
@ -143,94 +171,127 @@
<input type="text" name="switchS12" id="switchS12" value="${hardwareTypeAttr.switchS12 }" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS1 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关1图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar1" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS1Ico1}"/><br/>
<input type="file" name="fileUpload1" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS2 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关2图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar2" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS2Ico2}"/><br/>
<input type="file" name="fileUpload2" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS3 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关3图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar3" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS3Ico3}"/><br/>
<input type="file" name="fileUpload3" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS4 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关4图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar4" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS4Ico4}"/><br/>
<input type="file" name="fileUpload4" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS5 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关5图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar5" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS5Ico5}"/><br/>
<input type="file" name="fileUpload5" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS6 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关6图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar6" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS6Ico6}"/><br/>
<input type="file" name="fileUpload6" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS7 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关7图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar7" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS7Ico7}"/><br/>
<input type="file" name="fileUpload7" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS8 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关8图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar8" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS8Ico8}"/><br/>
<input type="file" name="fileUpload8" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS9 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关9图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar9" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS9Ico9}"/><br/>
<input type="file" name="fileUpload9" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS10 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关10图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar10" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS10Ico10}"/><br/>
<input type="file" name="fileUpload10" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS11 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关11图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar11" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS11Ico11}"/><br/>
<input type="file" name="fileUpload11" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<c:if test="${hardwareTypeAttrSwitch.switchS12 == 1}">
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">开关12图标<span style="color:red;">*</span></label>
<div class="col-sm-4">
<img id="avatar12" src="<%=picturePath%>Img/goods/${hardwareTypeAttr.switchS12Ico12}"/><br/>
<input type="file" name="fileUpload12" accept="image/png,image/jpg,image/jpeg" class="form-control" />
</div>
</div>
</c:if>
<div class="clearfix form-actions">
<div class="col-md-offset-3 col-md-9">
<button class="btn btn-info" type="submit" id="submitBtn"><i class="icon-ok bigger-110"></i>提交</button>&nbsp;&nbsp;&nbsp;&nbsp;

View File

@ -159,6 +159,15 @@
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-xs-3 control-label no-padding-right">背景图<span style="color:red;">*</span></label>
<div class="col-xs-7">
<input type="hidden" name="background" id="background" value="${venderList.background}"/>
<img id="backgroud" src="<%=picturePath%>Img/goods/${venderList.background}"/>
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control"/>
</div>
</div>
<div class="space-4"></div>
<div class="form-group">
<label class="col-sm-3 control-label no-padding-right">联系电话</label>
<div class="col-sm-4">

View File

@ -0,0 +1,139 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<title>鱼缸厂配置</title>
<!-- css and js -->
<%@ include file="../htm/script.jsp" %>
<script type="text/javascript">
$(function(){
//分页
var dataTable = $('#sample-table-2').dataTable({
"sPaginationType": "bootstrap",
//"bProcessing": true,
"bServerSide": true,//指定从服务器端获取数据
"sAjaxSource": "<%=basePath%>page/admin/factoryListInf1.do",
"fnServerData": function(sSource, aoData, fnCallback){
$.ajax({
"dataType": "json",
"type": "POST",
"url": sSource,
"data": aoData,
"cache": false,
"success": function(json){
fnCallback(json);
}
});
},
"aoColumns": [
{ "mData": "id","bSortable": false },
{ "mData": "venderCode","bSortable": false },
{ "mData": "venderName","bSortable": false },
{ "mData": "hardwareType","bSortable": false },
{ "mData": "hardwareName","bSortable": false },
{ "mData": "createTime","bSortable": false },
{ "mData": function(factory){
return '<a href="<%=basePath%>page/admin/doUpdateHardwareAttr.do?hardwareType='+factory.hardwareType+'&venderCode='+ factory.venderCode +'" title="设置名称" class="label label-primary"><span class="icon-edit align-top"></span></a>'
},
"bSortable": false,
"sClass":"center"
},
{ "mData": function(factory){
var detail = '<a href="<%=basePath%>page/admin/editFactory1.do?id='+factory.id+'" title="修改" class="label label-primary"><span class="icon-edit"></span></a> ';
var remove = '<a href="javascript:void(0);" onclick=deleteFactory("'+factory.id+'") title="删除" class="label label-danger"><span class="icon-trash"></span></a>';
return detail+remove;
},
"bSortable": false,
"sClass":"center"
}
],
"oLanguage": {
"sLengthMenu": "每页显示 _MENU_条",
"sZeroRecords": "没有找到符合条件的数据",
"sInfo": "当前第 _START_ - _END_ 条 共计 _TOTAL_ 条",
"sProcessing": "<img src='<%=basePath%>static/css/images/loading.gif'>",
"sInfoEmpty": "木有记录",
"sInfoFiltered": "(从 _MAX_ 条记录中过滤)",
"sSearch": "搜索名称:",
"oPaginate": {
"sFirst": "首页",
"sPrevious": "前一页",
"sNext": "后一页",
"sLast": "尾页"
}
}
});
$("#sample-table-2_length").append('&nbsp;&nbsp;&nbsp;&nbsp;<label><a href="<%=basePath%>page/admin/addFactory1.do" class="btn btn-xs btn-primary"><i class="icon-edit"></i><span class="no-text-shadow">新增</span></a></label>');
$("table th input:checkbox").on("click" , function(){
var that = this;
$(this).closest('table').find('tr > td:first-child input:checkbox').each(function(){
this.checked = that.checked;
$(this).closest('tr').toggleClass('selected');
});
});
});
function deleteFactory(id){
var r = confirm("确定要删除吗?");
if (r == true) {
location.href="<%=basePath%>page/admin/deleteFactory1.do?id="+id;
}
}
</script>
</head>
<body>
<!-- 头部 -->
<%@ include file="../htm/header.jsp" %>
<!-- 主体 -->
<div class="main-container" id="main-container">
<div class="main-container-inner">
<!-- 侧边栏 -->
<%@ include file="../htm/sidebar.jsp" %>
<!-- 主体内容 -->
<div class="main-content">
<div class="breadcrumbs" id="breadcrumbs">
<script type="text/javascript">
try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
</script>
<ul class="breadcrumb">
<li>
<i class="icon-home home-icon"></i>
<a href="<%=basePath%>page/public/index.do">首页</a>
</li>
<li class="active">鱼缸厂设备配置</li>
</ul>
</div>
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<div class="table-header"></div>
<div class="table-responsive">
<table id="sample-table-2" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>编号</th>
<th>鱼缸厂编号</th>
<th>鱼缸厂名称</th>
<th>硬件类型编号</th>
<th>硬件类型名称</th>
<th>创建时间</th>
<th class="center">设置名称</th>
<th class="center">操作</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- 设置工具 -->
<%@ include file="../htm/setting.jsp" %>
</div>
</div>
</body>
</html>

View File

@ -71,12 +71,6 @@
"bSortable": false,
"sClass":"center"
},
{ "mData": function(hardwareType){
return '<a href="<%=basePath%>page/admin/doUpdateHardwareAttr.do?hardwareType='+hardwareType.hardwareType+'" title="设置名称" class="label label-primary"><span class="icon-edit align-top"></span></a>'
},
"bSortable": false,
"sClass":"center"
},
{ "mData": function(hardwareType){
return '<a href="javascript:void(0);" onclick=deleteHardwareType("'+hardwareType.hardwareType+'") title="删除" class="label label-danger"><span class="icon-trash align-top"></span></a>';
},
@ -160,7 +154,6 @@
<th>柜灯</th>
<th>图标</th>
<th class="center">修改</th>
<th class="center">设置名称</th>
<th class="center">删除</th>
</tr>
</thead>

View File

@ -5,6 +5,8 @@
<title>鱼缸厂列表</title>
<!-- css and js -->
<%@ include file="../htm/script.jsp" %>
<link href="<%=basePath%>static/css/datepicker.css" rel="stylesheet"/>
<script src="<%=basePath%>static/js/date-time/bootstrap-datepicker.min.js"></script>
<script type="text/javascript">
$(function(){
@ -54,6 +56,11 @@
},
{ "mData": "contactPhone","bSortable": false },
{ "mData": "contactAddress","bSortable": false },
{ "mData": function (vender) {
return '<img src="<%=picturePath%>Img/goods/' + vender.background + '" width="50%"/>';
},
"bSortable": false
},
{ "mData": "createTime","bSortable": false },
{ "mData": function(vender){
return '<a href="<%=basePath%>page/admin/editVender.do?brandCode='+vender.brandCode+'" title="修改" class="label label-primary"><span class="icon-edit"></span></a>'
@ -164,6 +171,7 @@
<th>APP展示</th>
<th>联系电话</th>
<th>联系地址</th>
<th>背景</th>
<th>创建时间</th>
<th class="center">修改</th>
<th class="center">删除</th>