integrated_traffic/src/main/java/com/zcloud/controller/assignedManage/AssignedManageController.java

226 lines
8.6 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.zcloud.controller.assignedManage;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.assignedManage.AssignedManageService;
import com.zcloud.service.freighttrailer.FreightTrailerService;
import com.zcloud.service.operatingvehicles.OperatingVehiclesService;
import com.zcloud.service.system.ImgFilesService;
import com.zcloud.service.taxationManage.TaxationManageService;
import com.zcloud.util.*;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/assignedmanage")
public class AssignedManageController extends BaseController {
@Autowired
private AssignedManageService assignedManageService;
@Autowired
private Smb smb;
@Autowired
private ImgFilesService imgfilesService;
@Autowired
private OperatingVehiclesService operatingVehiclesService;
@Autowired
private FreightTrailerService freightTrailerService;
/**新增
* @param
* @throws Exception
*/
@RequestMapping(value="/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("ASSIGNED_ID", this.get32UUID()); //车船税主键
pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除)
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id
pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人名字
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("ASSIGNED_DATE", pd.get("TRANSACTION_DATE"));
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
pd.put("VEHICLE_TYPE",pd.get("ASSIGNED_VEHICLE_MODEL"));
pd.put("NOW_CONTACT_NUMBER",pd.get("NOW_OWNERS_NUMBER"));
assignedManageService.save(pd);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**删除
* @param
* @throws Exception
*/
@RequestMapping(value="/delete")
@ResponseBody
public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("DELETOR", Jurisdiction.getUSER_ID());
pd.put("DELETORNAME", Jurisdiction.getUsername());
pd.put("DELETTIME", DateUtil.date2Str(new Date()));
assignedManageService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping(value="/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();
pd.put("ISDELETE", "0"); //是否删除(0:有效 1删除)
pd.put("CREATOR", Jurisdiction.getUSER_ID()); //添加人id
pd.put("CREATORNAME", Jurisdiction.getUsername()); //添加人名字
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人id
pd.put("OPERATORNAME", Jurisdiction.getUsername()); // 修改人名字
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); // 修改时间
String expireDate = pd.getString("EXPIRE_DATE");
String day = DateUtil.getDay();
boolean flag = DateUtil.compareDate(expireDate, day);
if(flag) {
pd.put("EXPIRE_STATUS","expirestatus_01");
}else{
pd.put("EXPIRE_STATUS","expirestatus_02");
}
assignedManageService.edit(pd);
map.put("pd", pd);
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.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
pd = assignedManageService.findById(pd);
pd.put("FOREIGN_KEY", pd.getString("ASSIGNED_ID"));
pd.put("TYPE",120);
List<PageData> nowVehicleOperationCertificateImgs = imgfilesService.listAll(pd);//车头照片
pd.put("TYPE",121);
List<PageData> nowDrivinglicenseImg = imgfilesService.listAll(pd);//行驶证照片
map.put("nowVehicleOperationCertificateImgs", nowVehicleOperationCertificateImgs);
map.put("nowDrivinglicenseImg", nowDrivinglicenseImg);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
@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 = assignedManageService.list(page); //列出MajorDangerSource列表
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/operationvehicleList")
@ResponseBody
public Object operationVehicleList() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
String corpId = Jurisdiction.getCORPINFO_ID();
List<PageData> list = assignedManageService.operationVehicleList(corpId); //列出Question列表
map.put("list", list);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/assignedList")
@ResponseBody
public Object assignedList() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
String corpId = Jurisdiction.getCORPINFO_ID();
List<PageData> list = assignedManageService.assignedList(corpId); //列出Question列表
map.put("list", list);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/getassignedoperationvehiclelist")
@ResponseBody
public Object getAssignedOperationVehicleList() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
String corpId = Jurisdiction.getCORPINFO_ID();
List<PageData> operationList = operatingVehiclesService.operationVehicleList(corpId); //列出Question列表
List<PageData> assignedList = assignedManageService.assignedList(corpId);
for (int i = 0; i < assignedList.size(); i++) {
for (int j = 0; j < operationList.size(); j++) {
if(assignedList.get(i).get("RAW_PLATE_NUMBER").equals(operationList.get(j).get("PLATE_NUMBER"))) {
operationList.remove(j);
}
}
}
map.put("varList", operationList);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/getassignedfreighttrailerlist")
@ResponseBody
public Object getAssignedFreightTrailerList() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
String corpId = Jurisdiction.getCORPINFO_ID();
List<PageData> freightList = freightTrailerService.trailerList(corpId);
List<PageData> assignedList = assignedManageService.assignedList(corpId);
for (int i = 0; i < assignedList.size(); i++) {
for (int j = 0; j < freightList.size(); j++) {
if(assignedList.get(i).get("RAW_PLATE_NUMBER").equals(freightList.get(j).get("PLATE_NUMBER"))) {
freightList.remove(j);
}
}
}
map.put("varList", freightList);
map.put("result", errInfo);
return map;
}
}