integrated_traffic/src/main/java/com/zcloud/controller/comprehensive/TrafficSecurityWaybillRegis...

100 lines
3.7 KiB
Java
Raw Normal View History

package com.zcloud.controller.comprehensive;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.comprehensive.TrafficSecurityWaybillRegistrationService;
import com.zcloud.util.Const;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
import org.apache.commons.lang.StringUtils;
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("/waybillregistration")
public class TrafficSecurityWaybillRegistrationController extends BaseController {
@Autowired
private TrafficSecurityWaybillRegistrationService trafficSecurityWaybillRegistrationService;
@RequestMapping(value = "/listForSecurityWaybillre")
@ResponseBody
public Object listForSecurityWaybillRegistra(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String TITLE = pd.getString("TITLE"); // 关键词检索条件
if (Tools.notEmpty(TITLE))
pd.put("TITLE", TITLE.trim());
String REPLYSTATUS = pd.getString("REPLYSTATUS"); // 关键词检索条件
if (Tools.notEmpty(REPLYSTATUS))
pd.put("REPLYSTATUS", REPLYSTATUS.trim());
page.setPd(pd);
List<PageData> varList = trafficSecurityWaybillRegistrationService.listForSecurityNotice(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/forSecurityPerson")
@ResponseBody
public Object forSecurityPerson() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID());
pd = trafficSecurityWaybillRegistrationService.forSecurityPerson(pd);
pd.put("PRACTITIONER", Jurisdiction.getName());
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
//新增
@RequestMapping(value = "/add")
@ResponseBody
public Object add() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
String waybillregistrationId = this.get32UUID();
pd.put("CREATOR", Jurisdiction.getUSER_ID()); // 创建人id
pd.put("CREATORNAME", Jurisdiction.getName()); // 创建人姓名
pd.put("TRANSPORTATIONCOMPANY", Jurisdiction.getCORPINFO_ID()); // 运输企业
pd.put("WAYBILLREGISTRATION_ID", waybillregistrationId); // 主键
pd.put("CREATETIME", DateUtil.date2Str(new Date())); // 添加时间
pd.put("WAYBILLNUMBER", this.get32UUID()); // 添加时间
pd.put("ISDELETE", "0");
Date shippingDate = DateUtil.str2Date(pd.getString("SHIPPINGDATE"));
if (shippingDate != null && shippingDate.after(new Date())) {
pd.put("WAYBILLSTATUS", "1");
} else {
pd.put("WAYBILLSTATUS", "0");
}
trafficSecurityWaybillRegistrationService.save(pd);
map.put("result", errInfo);
map.put("pd", pd);
return map;
}
}