forked from integrated_whb/integrated_whb
220 lines
6.8 KiB
Java
220 lines
6.8 KiB
Java
package com.zcloud.controller.keyProjects;
|
||
|
||
import com.zcloud.controller.base.BaseController;
|
||
import com.zcloud.entity.Page;
|
||
import com.zcloud.entity.PageData;
|
||
import com.zcloud.service.keyProjects.KeyprojectPunishService;
|
||
import com.zcloud.util.ObjectExcelView;
|
||
import com.zcloud.util.Tools;
|
||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||
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.ResponseBody;
|
||
import org.springframework.web.servlet.ModelAndView;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
/**
|
||
* 说明:重点工程处罚
|
||
* 作者:luoxiaobao
|
||
* 时间:2022-09-21
|
||
* 官网:www.zcloudchina.com
|
||
*/
|
||
@Controller
|
||
@RequestMapping("/keyprojectpunish")
|
||
public class KeyprojectPunishController extends BaseController {
|
||
|
||
@Autowired
|
||
private KeyprojectPunishService keyprojectpunishService;
|
||
|
||
/**新增
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/add")
|
||
@RequiresPermissions("keyprojectpunish:add")
|
||
@ResponseBody
|
||
public Object add() throws Exception{
|
||
Map<String,Object> map = new HashMap<String,Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
pd.put("KEYPROJECTPUNISH_ID", this.get32UUID()); //主键
|
||
keyprojectpunishService.save(pd);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**删除
|
||
* @param out
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/delete")
|
||
@RequiresPermissions("keyprojectpunish:del")
|
||
@ResponseBody
|
||
public Object delete() throws Exception{
|
||
Map<String,String> map = new HashMap<String,String>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
keyprojectpunishService.delete(pd);
|
||
map.put("result", errInfo); //返回结果
|
||
return map;
|
||
}
|
||
|
||
/**修改
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/edit")
|
||
@RequiresPermissions("keyprojectpunish:edit")
|
||
@ResponseBody
|
||
public Object edit() throws Exception{
|
||
Map<String,Object> map = new HashMap<String,Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
keyprojectpunishService.edit(pd);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**列表
|
||
* @param page
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/list")
|
||
@ResponseBody
|
||
public Object list(Page page) throws Exception{
|
||
Map<String,Object> map = new HashMap<String,Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
|
||
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim());
|
||
page.setPd(pd);
|
||
List<PageData> varList = keyprojectpunishService.list(page); //列出KeyprojectPunish列表
|
||
map.put("varList", varList);
|
||
map.put("page", page);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**去修改页面获取数据
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/goEdit")
|
||
@ResponseBody
|
||
public Object goEdit() throws Exception{
|
||
Map<String,Object> map = new HashMap<String,Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
pd = keyprojectpunishService.findById(pd); //根据ID读取
|
||
map.put("pd", pd);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**批量删除
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/deleteAll")
|
||
@RequiresPermissions("keyprojectpunish:del")
|
||
@ResponseBody
|
||
public Object deleteAll() throws Exception{
|
||
Map<String,Object> map = new HashMap<String,Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
String DATA_IDS = pd.getString("DATA_IDS");
|
||
if(Tools.notEmpty(DATA_IDS)){
|
||
String ArrayDATA_IDS[] = DATA_IDS.split(",");
|
||
keyprojectpunishService.deleteAll(ArrayDATA_IDS);
|
||
errInfo = "success";
|
||
}else{
|
||
errInfo = "fail";
|
||
}
|
||
map.put("result", errInfo); //返回结果
|
||
return map;
|
||
}
|
||
|
||
/**导出到excel
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value="/excel")
|
||
@RequiresPermissions("toExcel")
|
||
public ModelAndView exportExcel() throws Exception{
|
||
ModelAndView mv = new ModelAndView();
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
Map<String,Object> dataMap = new HashMap<String,Object>();
|
||
List<String> titles = new ArrayList<String>();
|
||
titles.add("添加人"); //1
|
||
titles.add("添加时间"); //2
|
||
titles.add("修改人"); //3
|
||
titles.add("修改时间"); //4
|
||
titles.add("是否删除(0:有效 1:删除)"); //5
|
||
titles.add("检查ID"); //6
|
||
titles.add("隐患ID"); //7
|
||
titles.add("处罚单位"); //8
|
||
titles.add("处罚人"); //9
|
||
titles.add("处罚原因"); //10
|
||
titles.add("处罚金额"); //11
|
||
titles.add("处罚时间"); //12
|
||
titles.add("是否处理 0否1是"); //13
|
||
titles.add("处理图片"); //14
|
||
titles.add("处理时间"); //15
|
||
dataMap.put("titles", titles);
|
||
List<PageData> varOList = keyprojectpunishService.listAll(pd);
|
||
List<PageData> varList = new ArrayList<PageData>();
|
||
for(int i=0;i<varOList.size();i++){
|
||
PageData vpd = new PageData();
|
||
vpd.put("var1", varOList.get(i).getString("CREATOR")); //1
|
||
vpd.put("var2", varOList.get(i).getString("CREATTIME")); //2
|
||
vpd.put("var3", varOList.get(i).getString("OPERATOR")); //3
|
||
vpd.put("var4", varOList.get(i).getString("OPERATTIME")); //4
|
||
vpd.put("var5", varOList.get(i).get("ISDELETE").toString()); //5
|
||
vpd.put("var6", varOList.get(i).getString("KEYPROJECTCHECK_ID")); //6
|
||
vpd.put("var7", varOList.get(i).getString("HIDDEN_ID")); //7
|
||
vpd.put("var8", varOList.get(i).getString("UNITS_ID")); //8
|
||
vpd.put("var9", varOList.get(i).getString("PERSONNELMANAGEMENT_ID")); //9
|
||
vpd.put("var10", varOList.get(i).getString("REASON")); //10
|
||
vpd.put("var11", varOList.get(i).getString("AMOUT")); //11
|
||
vpd.put("var12", varOList.get(i).getString("DATE")); //12
|
||
vpd.put("var13", varOList.get(i).getString("HANDLED")); //13
|
||
vpd.put("var14", varOList.get(i).getString("HANDLE_IMG")); //14
|
||
vpd.put("var15", varOList.get(i).getString("HANLDE_TIME")); //15
|
||
varList.add(vpd);
|
||
}
|
||
dataMap.put("varList", varList);
|
||
ObjectExcelView erv = new ObjectExcelView();
|
||
mv = new ModelAndView(erv,dataMap);
|
||
return mv;
|
||
}
|
||
/**
|
||
* 根据添加人查询罚单
|
||
* @param
|
||
* @return
|
||
*/
|
||
@RequestMapping(value="/findByOperator")
|
||
@ResponseBody
|
||
public Object findByOperator() throws Exception{
|
||
Map<String,Object> map = new HashMap<String,Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
List<PageData> byOperator = keyprojectpunishService.findByOperator(pd);
|
||
map.put("data", byOperator);
|
||
map.put("result", errInfo); //返回结果
|
||
return map;
|
||
}
|
||
}
|