|
|
|
@ -3,15 +3,18 @@ package cn.chjyj.szwh.service.impl; |
|
|
|
import cn.chjyj.szwh.bean.Goods; |
|
|
|
import cn.chjyj.szwh.bean.GoodsDetail; |
|
|
|
import cn.chjyj.szwh.bean.GoodsSource; |
|
|
|
import cn.chjyj.szwh.bean.OperationLog; |
|
|
|
import cn.chjyj.szwh.constant.ChConstant; |
|
|
|
import cn.chjyj.szwh.exception.ChException; |
|
|
|
import cn.chjyj.szwh.mapper.GoodsDetailMapper; |
|
|
|
import cn.chjyj.szwh.mapper.GoodsMapper; |
|
|
|
import cn.chjyj.szwh.mapper.GoodsSourceMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OperationLogMapper; |
|
|
|
import cn.chjyj.szwh.service.GoodsService; |
|
|
|
import cn.chjyj.szwh.utils.ProperUtils; |
|
|
|
import cn.chjyj.szwh.utils.RequestUtils; |
|
|
|
import cn.chjyj.szwh.utils.SignUtils; |
|
|
|
import cn.chjyj.szwh.utils.SzwhApiUtils; |
|
|
|
import cn.chjyj.szwh.vo.GoodsDetailVo; |
|
|
|
import cn.chjyj.szwh.vo.GoodsListVo; |
|
|
|
import cn.chjyj.szwh.vo.OrderDetailVo; |
|
|
|
@ -35,6 +38,9 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
private GoodsDetailMapper goodsDetailMapper; |
|
|
|
@Autowired |
|
|
|
private GoodsSourceMapper goodsSourceMapper; |
|
|
|
// 操作日志
|
|
|
|
@Autowired |
|
|
|
private OperationLogMapper operationLogMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Goods> getGoodsList(int page) { |
|
|
|
@ -308,37 +314,56 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 委托撤销商品 |
|
|
|
* @param goodsIsli |
|
|
|
* @param reason |
|
|
|
* @param username |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void offGoods(String goodsIsli, String reason) { |
|
|
|
//todo 暂时跳过 goods 验证
|
|
|
|
// $url = env("app.entrust_url") . "/consign/exchange/v1/exchangeRevokeEntrust";
|
|
|
|
// $sign = parent::createSign("entrust");
|
|
|
|
// $headers = array(
|
|
|
|
// CURLOPT_HTTPHEADER => array(
|
|
|
|
// "entrust_token:{$sign}"
|
|
|
|
// )
|
|
|
|
// );
|
|
|
|
// $post = [
|
|
|
|
// "revokeReason" => $reason,
|
|
|
|
// "isliCode" => $goods->islicode,
|
|
|
|
// "status" => 3,
|
|
|
|
// ];
|
|
|
|
// //todo 请求交易所撤销委托接口 接口1.4
|
|
|
|
// $res = Http::get($url, $post, $headers);
|
|
|
|
// if($res['code'] != 200){
|
|
|
|
// throw new \think\Exception($res['msg'], 400);
|
|
|
|
// }
|
|
|
|
// $res = json_decode($res['data'], true);
|
|
|
|
// if($res['resultCode'] != "00000000"){
|
|
|
|
// throw new \think\Exception($res['resultMsg'], 400);
|
|
|
|
// }
|
|
|
|
// Goods::where('id', $goods->id)->update(['apply_out' => 1]);
|
|
|
|
// $operation_log = [
|
|
|
|
// "type" => "goods",
|
|
|
|
// "log_id" => $goods->id,
|
|
|
|
// "message" => date('Y-m-d H:i:s') . " 由{$this->account_name}申请撤销委托,撤销原因:{$reason}"
|
|
|
|
// ];
|
|
|
|
// (new OperationLog())->insert($operation_log);
|
|
|
|
public Map<String,Object> offGoods(String goodsIsli, String reason,String username) { |
|
|
|
int code =200; |
|
|
|
String msg="成功"; |
|
|
|
// 查询商品信息
|
|
|
|
Goods goods = goodsMapper.getGoodsFuelByIsLi(goodsIsli); |
|
|
|
if(goods==null ){ |
|
|
|
msg="没有该条委托数据"; |
|
|
|
code=400; |
|
|
|
} |
|
|
|
if(goods.getGoodsStatus()!=1 && goods.getGoodsStatus()!=5){ |
|
|
|
msg="暂时只支持对已发布/暂停中文化数据进行撤销!"; |
|
|
|
code=400; |
|
|
|
} |
|
|
|
if(goods.getApplyOut() == 1){ |
|
|
|
msg="请勿重复提交撤销委托申请!"; |
|
|
|
code=400; |
|
|
|
} |
|
|
|
// 满足上述条件后进行远程处理
|
|
|
|
JSONObject retjson = SzwhApiUtils.offGoods(reason,goodsIsli); |
|
|
|
String errorcode =retjson.getString("resultCode"); |
|
|
|
String errmsg = retjson.getString("resultMsg"); |
|
|
|
if(!"00000000".equals(errorcode)){ |
|
|
|
msg= errmsg; |
|
|
|
} |
|
|
|
// 更新状态
|
|
|
|
Map gmap = new HashMap(); |
|
|
|
gmap.put("apply_out",1); |
|
|
|
int upret = goodsMapper.updateGoods(gmap,goods.getId()); |
|
|
|
|
|
|
|
// 返回的map 集合
|
|
|
|
Map retmap = new HashMap(); |
|
|
|
retmap.put("code",code); |
|
|
|
retmap.put("msg",msg); |
|
|
|
// 操作日志
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String message=sdf.format(new Date())+"由"+username+"申请撤销委托,撤销原因:"+reason; |
|
|
|
OperationLog oplog = new OperationLog(); |
|
|
|
oplog.setLogid(goods.getId()); |
|
|
|
oplog.setType("goods"); |
|
|
|
oplog.setMessage(message); |
|
|
|
operationLogMapper.addLog(oplog); |
|
|
|
|
|
|
|
return retmap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|