作者 申海龙

redis配置文件获取 预备新增再次编辑 货主信息 主单号删除

... ... @@ -982,6 +982,27 @@ public class ManifestController extends BasicController {
@RequestMapping(value = "/save", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel save(ManifestEntity manifest, HttpServletRequest reuqest) {
//发货人
String forShortShipper = reuqest.getParameter("for_short_shipper");
//订舱代理
String forShortBooking = reuqest.getParameter("for_short_booking");
//操作代理
String forShortOperation = reuqest.getParameter("for_short_operation");
List<String> list = new ArrayList<>();
if (!StringUtils.isEmpty(forShortShipper)){
list.add(forShortShipper);
}
if (!StringUtils.isEmpty(forShortBooking)){
list.add(forShortBooking);
}
if (!StringUtils.isEmpty(forShortOperation)){
list.add(forShortOperation);
}
String flightno = manifest.getFlightno();
String carrier = "";
if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
... ... @@ -1023,6 +1044,26 @@ public class ManifestController extends BasicController {
}
}
//查询数据库是否存在 如果不存在直接添加 存在就删除 再进行添加
if (hzWaybillService.findHzId(manifest.getWaybillnomaster()).size()>0){
if (hzWaybillService.deleteAlls(manifest.getWaybillnomaster())>0){
for (String sId : list){
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
hzwaybllinfoEntity.setHzinfor_id(sId);
hzWaybillService.save(hzwaybllinfoEntity);
}
}
}else {
for (String sId : list){
HZWAYBLLINFOEntity hzwaybllinfoEntity = new HZWAYBLLINFOEntity();
hzwaybllinfoEntity.setWaybill_id(manifest.getWaybillnomaster());
hzwaybllinfoEntity.setHzinfor_id(sId);
hzWaybillService.save(hzwaybllinfoEntity);
}
}
model.setData(manifest);
model.setStatus(200);
model.setMsg(HttpJsonMsg.SUCCESS);
... ...
... ... @@ -10,6 +10,7 @@ import com.framework.core.Servlets;
import com.plugin.easyui.DataGrid;
import com.plugin.easyui.EasyPage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -18,7 +19,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
... ... @@ -46,13 +50,26 @@ public class CargoController {
*/
@RequestMapping(value="grid.json")
@ResponseBody
public DataGrid<CargoCountVo> grid(HttpServletRequest request, EasyPage<CargoCountEntity> pageForm) {
public DataGrid<CargoCountVo> grid(HttpServletRequest request, EasyPage<CargoCountEntity> pageForm) throws ParseException {
Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
if (!searchParams.containsKey("LIKE_tstype")){
searchParams.put("LIKE_tstype", 1);
//
if (searchParams.containsKey("GTES_flightdate")){
String gte_flightdate = searchParams.get("GTES_flightdate").toString();
if (!StringUtils.isBlank(gte_flightdate)){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date parse = simpleDateFormat.parse(gte_flightdate);
searchParams.put("GTES_flightdate", parse);
}
}
if (searchParams.containsKey("LTES_flightdate")){
String gte_flightdate = searchParams.get("LTES_flightdate").toString();
if (!StringUtils.isBlank(gte_flightdate)) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date parse = simpleDateFormat.parse(gte_flightdate);
searchParams.put("LTES_flightdate", parse);
}
}
pageForm.setSearchParams(searchParams);
pageForm.parseData(cargoCountService.getPage(pageForm));
DataGrid<CargoCountEntity> cargoCountEntityDataGrid = pageForm.getData();
... ... @@ -64,13 +81,15 @@ public class CargoController {
CargoCountVo vo = new CargoCountVo();
vo.setForshort(cargo.getForshort());
vo.setFullname(cargo.getFullname());
if ("1".equals(cargo.getTstype())){
vo.setTstype("发货人");
}else if ("2".equals(cargo.getTstype())){
vo.setTstype("订舱代理");
}else {
vo.setTstype("操作代理");
}
vo.setTstype(cargo.getTstype());
// if ("1".equals(cargo.getTstype())){
// vo.setTstype("发货人");
// }else if ("2".equals(cargo.getTstype())){
// vo.setTstype("订舱代理");
// }else if("3".equals(cargo.getTstype())){
// vo.setTstype("操作代理");
// }
vo.setTstype(cargo.getTstype());
vo.setContacts(cargo.getContacts());
vo.setPhone(cargo.getPhone());
vo.setWaybill(cargo.getWaybill());
... ... @@ -93,7 +112,6 @@ public class CargoController {
vos.setRows(cargoCountVos);
vos.setTotal(cargoCountEntityDataGrid.getTotal());
return vos;
}
}
... ...
... ... @@ -20,9 +20,9 @@ public interface ManifestRepository extends PagingAndSortingRepository<ManifestE
@Query(value = "UPDATE MANIFEST SET IS_DELETE = 1 WHERE ID = ?1",nativeQuery = true)
public void delete(Long id);
@Transactional
// @Transactional
@Modifying
@Query(value = "DELETE FROM MANIFEST WHERE ID = ?1",nativeQuery = true)
@Query(value = "DELETE FROM MANIFEST WHERE ID = ?1", nativeQuery = true)
void trueDelete(Long id);
@Transactional
... ...
... ... @@ -209,7 +209,9 @@ public class ManifestService extends BasicService<ManifestEntity> {
//删除主单和货主绑定关系
hzWaybillRepository.deleteAlls(waybillnomaster);
//主单
manifestRepository.trueDelete(Long.valueOf(id));
ManifestEntity manifestEntity = new ManifestEntity();
manifestEntity.setId(Long.valueOf(id));
manifestRepository.delete(manifestEntity);
}
}catch (Exception e){
e.printStackTrace();
... ...
package com.agent.xml;
import com.framework.util.PropertiesLoader;
import org.apache.commons.lang3.StringUtils;
import redis.clients.jedis.Jedis;
... ... @@ -18,8 +19,9 @@ import redis.clients.jedis.Jedis;
class XmlSendTask extends Thread {
// 创建 缓存服务器的地址ip
// private Jedis jedis = new Jedis("10.50.3.71", 6379);
private Jedis jedis = new Jedis("10.50.3.84", 6379);
// private Jedis jedis = new Jedis("10.50.3.84", 6379);
private Jedis jedis = new Jedis(PropertiesLoader.getRedis("host"),
Integer.valueOf(PropertiesLoader.getRedis("port")));
private String xml;
public XmlSendTask(String xml) {
... ...
... ... @@ -68,6 +68,18 @@ public class DynamicSpecifications {
case LTE:
predicates.add(builder.lessThanOrEqualTo(expression, (Comparable) filter.value));
break;
// case GTES:
// predicates.add(builder.greaterThanOrEqualTo(builder.lower(expression), "to_date("+"'"+filter.value.toString()+"'"+", 'yyyy-mm-dd hh24:mi:ss')"));
// break;
// case LTES:
// predicates.add(builder.lessThanOrEqualTo(builder.lower(expression), "to_date("+"'"+filter.value.toString()+"'"+", 'yyyy-mm-dd hh24:mi:ss')"));
// break;
case GTES:
predicates.add(builder.greaterThanOrEqualTo(builder.lower(expression), (Comparable) filter.value));
break;
case LTES:
predicates.add(builder.lessThanOrEqualTo(builder.lower(expression), (Comparable) filter.value));
break;
case IN:
if(filter.value instanceof String[]) {
String[] values = (String[])filter.value;
... ...
... ... @@ -16,7 +16,7 @@ import com.google.common.collect.Maps;
public class SearchFilter {
public enum Operator {
EQ, LIKE, GT, LT, GTE, LTE,IN,IsNotNull,IsNotEmpty,IsNull,IsEmpty,IsNullOrEmpty
EQ, LIKE, GT, LT, GTE, LTE, GTES, LTES, IN,IsNotNull,IsNotEmpty,IsNull,IsEmpty,IsNullOrEmpty
}
public String fieldName;
... ...
... ... @@ -20,6 +20,10 @@ public class PropertiesLoader {
private static final Logger logger = LoggerFactory.getLogger(PropertiesLoader.class);
private static final String CONFIG_FILE = "/config.properties";
private static final String REDIS_FILE = "/redis.properties";
private static final String LOGIN_FILE = "/openRemoteLogin.properties";
/**
* 配置文件properties获取value
... ... @@ -48,6 +52,16 @@ public class PropertiesLoader {
}
return properties;
}
public static String getRedis(String key) {
Properties properties = PropertiesLoader.loadProperty(REDIS_FILE);
return properties.getProperty(key);
}
public static String getLogin(String key) {
Properties properties = PropertiesLoader.loadProperty(LOGIN_FILE);
return properties.getProperty(key);
}
public static String getConfig(String key) {
... ...
host = 10.50.3.84
port = 6379
\ No newline at end of file
... ...
... ... @@ -48,7 +48,7 @@
<th field="codes"><spring:message code="manifest.agentCode"/></th>
<th field="contacts">联系人</th>
<th field="phone">电话</th>
<th field="tstype">货主类型</th>
<th field="tstype" formatter="tstype">货主类型</th>
<th field="fullname">货主名称</th>
<th field="forshort">货主简称</th>
<th field="waybill" sortable="true"><spring:message code="manifest.bill.number"/></th>
... ... @@ -67,11 +67,19 @@
<div id="tb" style="padding:0 30px;"><input type="hidden" id="idcc">
<form id="searchForm">
<table class="search_form_table">
<select name="search_LIKE_tstype" id="tstype" style="width:166px;height:35px;line-height:35px;" >
<select name="search_LIKE_tstype" id="tstype" style="width:166px;height:35px;line-height:35px;">
<option value="">请选择</option>
<option value="1">发货人</option>
<option value="2">订舱代理</option>
<option value="3">操作代理</option>
</select>
货主名称: <input class="easyui-textbox" type="text" name="search_LIKE_fullname" style="width:166px;height:35px;line-height:35px;">
航班开始日期:<input type="text" class=" bill" name="search_GTES_flightdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:166px;height:35px;line-height:35px;">
航班结束日期:<input type="text" class=" bill" name="search_LTES_flightdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" style="width:166px;height:35px;line-height:35px;">
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="javascript:doSearch()" class="easyui-linkbutton" iconCls="icon-search" data-options="selected:true"><spring:message code="opt.search" /></a>
</table>
</form>
... ... @@ -82,6 +90,7 @@
</div>
</div>
<script type="text/javascript" src="<%=basePath%>resource/My97DatePicker/WdatePicker.js?version=${version}"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<%=basePath %>resource/easyui/easyui-lang-${pageContext.response.locale}.js"></script>
... ... @@ -99,6 +108,19 @@
// return row.carrier+row.flightno;
// }
function tstype(value, row, index) {
console.log(row);
if ("1" == row.tstype){
return "发货人"
}
if ("2" == row.tstype){
return"订舱代理"
}
if("3"== row.tstype){
return "操作代理"
}
}
function checkResponseText(value, row, index) {
var res = '';
if(value){
... ...
... ... @@ -48,7 +48,7 @@
</head>
<body>
<div style="width: 100%; height: 60px"></div>
<div id="printdiv" style="width: 90%; height: 100%; margin: 0 auto;">
<div id="printdiv" style="width: 92%; height: 100%; margin: 0 auto;">
<div>
<p style="line-height: 20pt;"><img src="<%=basePath%>resource/img/bar_code/${path}.png" width="250" height="60" alt="网络异常" style="-aw-left-pos:2.6pt; -aw-rel-hpos:column; -aw-rel-vpos:paragraph; -aw-top-pos:-52pt; -aw-wrap-type:none; margin-left:30.6pt; margin-top:-6pt; position:absolute; z-index:0" /></p>
<p style="line-height:100pt; margin:0pt 0pt -30pt; orphans:0; text-align:center; widows:0">
... ...
... ... @@ -81,7 +81,6 @@
<li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.user" />||system/user/list',this)"><spring:message code="menu.user" /></a></li>
<li><a href="javascript:void(0);" onclick="addTab('<spring:message code="menu.wbm" />||wbm/list',this)"><spring:message code="menu.wbm" /></a></li>
<li><a href="javascript:void(0);" onclick="addTab('<spring:message code="hz.info" />||hzinfo/list',this)"><spring:message code="hz.info" /></a></li>
<li><a href="javascript:void(0);" onclick="addTab('<spring:message code="hz.info" />||hzinfo/list',this)"><spring:message code="hz.info" /></a></li>
<li><a href="javascript:void(0);" onclick="addTab('货量统计||cargo/list',this)">货量统计</a></li>
<%-- <li><a href="javascript:void(0)" onclick="addTab('<spring:message code="menu.consignee_info_set" />||consignee/list')"><spring:message code="menu.consignee_info_set" /></a></li> --%>
</ul>
... ...
... ... @@ -732,18 +732,25 @@ $(function(){
}
/* console.log("form-->"+data); */
$.post("<%=basePath%>manifest/save",data,function (data) {
parent.layer.close(layerIndex);
if (data.status == 200) {
// layer.confirm("<spring:message code="opt.savesuccess"/>", {btn: ['<spring:message code="opt.confirm"/>', '<spring:message code="opt.cancel"/>']}, function () {
window.location.href = "<%=basePath%>manifest/list" ;
// })
} else {
//layer.open({content: "<spring:message code="opt.savefailed"/>"});
layer.open({content:""+data.msg});
}
});
var shipper = $("#for_short_shipper").val();
var booking = $("#for_short_booking").val();
var operation = $("#for_short_operation").val();
//判断货主信息是否为空
if (notEmpty(shipper) || notEmpty(booking) || notEmpty(operation)) {
$.post("<%=basePath%>manifest/save", data, function (data) {
parent.layer.close(layerIndex);
if (data.status == 200) {
// layer.confirm("<spring:message code="opt.savesuccess"/>", {btn: ['<spring:message code="opt.confirm"/>', '<spring:message code="opt.cancel"/>']}, function () {
window.location.href = "<%=basePath%>manifest/list";
// })
} else {
//layer.open({content: "<spring:message code="opt.savefailed"/>"});
layer.open({content: "" + data.msg});
}
});
}else{
alert("货主信息不能为空");
}
}
... ...