Browse Source

托管结束周期判断

master
xyiege 4 years ago
parent
commit
e6d0e085d6
  1. 31
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

31
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -463,6 +463,7 @@ public class GoodsServiceImpl implements GoodsService {
/** /**
* 手动导入商品信息 * 手动导入商品信息
*
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
@ -474,11 +475,13 @@ public class GoodsServiceImpl implements GoodsService {
// 请求头 // 请求头
Map<String, Object> hmap = new HashMap(); Map<String, Object> hmap = new HashMap();
hmap.put("entrust_token", sign); hmap.put("entrust_token", sign);
//处理json数据
return opGoodsInfo(jsonObject, host, hmap); return opGoodsInfo(jsonObject, host, hmap);
} }
/** /**
* 操作商品信息 * 操作商品信息
*
* @param jsonObject 待处理的json内容 * @param jsonObject 待处理的json内容
* @param host 目标网址 * @param host 目标网址
* @param hmap 请求主机头集合 * @param hmap 请求主机头集合
@ -544,13 +547,39 @@ public class GoodsServiceImpl implements GoodsService {
istatus = 4; istatus = 4;
} }
Goods goods = new Goods(); Goods goods = new Goods();
String contractualPeriod = nsdjson.getString("contractualPeriod");
int iperiod = 0;
//商品起止时间 //商品起止时间
String cstart = sdjson.getString("contractualPeriodStart"); String cstart = nsdjson.getString("contractualPeriodStart");
String curTime = new SimpleDateFormat("HH:mm:ss").format(new Date()); String curTime = new SimpleDateFormat("HH:mm:ss").format(new Date());
String ncstart = cstart + " " + curTime; String ncstart = cstart + " " + curTime;
// 委托周期
int day = nsdjson.getInteger("contractualCycle");
//转换为date //转换为date
String cend = nsdjson.getString("contractualPeriodEnd"); String cend = nsdjson.getString("contractualPeriodEnd");
if (StringUtils.isBlank(cend)) {
//如果是一次性授权或单次授权,存在托管结束时间
if (iperiod == 2) {
try {
// 委托开始时间
Date wtStart = sdf.parse(cstart);
// 委托终止时间
Date wtEnd = DateUtils.daysAgoOrAfter(wtStart, day);
cend = wtEnd.toString();
} catch (Exception ex) {
ex.printStackTrace();
}
}
//永久性
if (iperiod == 1) {
cend = "2099-12-31";
}
}
String ncend = cend + " 23:59:59"; String ncend = cend + " 23:59:59";
//
try { try {
//起止时间转为timestamp //起止时间转为timestamp
SimpleDateFormat tsdf = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat tsdf = new SimpleDateFormat("yyyyMMddHHmmss");

Loading…
Cancel
Save