Browse Source

修复订单管理订单详情bug

master
xyiege 4 years ago
parent
commit
484c3b4b61
  1. 8
      src/main/java/cn/chjyj/szwh/mapper/OrderGoodsSourceMapper.java
  2. 47
      src/main/java/cn/chjyj/szwh/service/impl/GoodsSourceServiceImpl.java
  3. 84
      src/main/resources/mapper/szwh/OrderGoodsSourceMapper.xml

8
src/main/java/cn/chjyj/szwh/mapper/OrderGoodsSourceMapper.java

@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* 订单商品资源mapper
@ -17,4 +18,11 @@ public interface OrderGoodsSourceMapper {
* @return
*/
List<OrderGoodsSource> getOrderGoodsSourceList(@Param("detailId") String detailId);
/**
* 多条件搜索订单商品资源
* @param somap
* @return
*/
List<OrderGoodsSource> searchOrderGoodsSource(@Param("map") Map somap);
}

47
src/main/java/cn/chjyj/szwh/service/impl/GoodsSourceServiceImpl.java

@ -2,10 +2,14 @@ package cn.chjyj.szwh.service.impl;
import cn.chjyj.szwh.bean.GoodsSource;
import cn.chjyj.szwh.bean.OrderGoodsDetail;
import cn.chjyj.szwh.bean.OrderGoodsSource;
import cn.chjyj.szwh.mapper.GoodsSourceMapper;
import cn.chjyj.szwh.mapper.OrderGoodsDetailMapper;
import cn.chjyj.szwh.mapper.OrderGoodsSourceMapper;
import cn.chjyj.szwh.service.GoodsSourceService;
import cn.chjyj.szwh.utils.SzFileUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.apache.commons.lang3.StringUtils;
@ -24,6 +28,8 @@ public class GoodsSourceServiceImpl implements GoodsSourceService {
private GoodsSourceMapper goodsSourceMapper;
@Autowired
private OrderGoodsDetailMapper orderGoodsDetailMapper;
@Autowired
private OrderGoodsSourceMapper orderGoodsSourceMapper;
/**
* 商品来源详情
@ -35,12 +41,30 @@ public class GoodsSourceServiceImpl implements GoodsSourceService {
@Override
public Map<String, Object> getGoodsSourceDetail(String isli, String islicode, String batchcode) {
Map query = new HashMap<>();
query.put("sourceIdentify", isli);
//结果list
List<GoodsSource> gslist=new ArrayList<>();
if (StringUtils.isNotBlank(batchcode)) {
query.put("batchcode", batchcode);
Map somap = new HashMap();
somap.put("sourceIdentify",isli);
somap.put("batchcode",batchcode);
somap.put("datatype",1);
// 订单商品资源
List<OrderGoodsSource> odgslist = orderGoodsSourceMapper.searchOrderGoodsSource(somap);
for(OrderGoodsSource ogs:odgslist){
GoodsSource goodsSource = new GoodsSource();
goodsSource.setSourceData(ogs.getSourceData());
goodsSource.setTargetData(ogs.getTargetData());
goodsSource.setTargetName(ogs.getTargetName());
goodsSource.setLinkcode(ogs.getLinkcode());
// 暂时只用到上述属性
gslist.add(goodsSource);
}
}else{
query.put("sourceIdentify", isli);
// 商品资源列表
gslist = goodsSourceMapper.getGoodsSourceByMap(query, 0, 10);
}
// 商品资源列表
List<GoodsSource> gslist = goodsSourceMapper.getGoodsSourceByMap(query, 0, 10);
//返回map
Map<String, Object> retmap = new HashMap<>();
@ -103,11 +127,16 @@ public class GoodsSourceServiceImpl implements GoodsSourceService {
//订单号 委托码 不为空的情况
if(StringUtils.isNotEmpty(batchcode) && StringUtils.isNotEmpty(islicode)){
String ogdstr = orderGoodsDetailMapper.getOrderGoodsDetailSourceDownload(batchcode,islicode);
JSONObject ogdjson = JSONObject.parseObject(ogdstr);
String sdstatus = ogdjson.getString("status");
String sdislicode = ogdjson.getString("islicode");
if(gs.getLinkcode().equals(sdislicode)){
gather.put("download_status",sdstatus);
//JSONObject ogdjson = JSONObject.parseObject(ogdstr);
JSONArray jsarr = JSON.parseArray(ogdstr);
//List<String> stlist = jsarr.toJavaList(String.class);
for(int x=0;x<jsarr.size();x++){
JSONObject ogdjson = (JSONObject) jsarr.get(x);
String sdstatus = ogdjson.getString("status");
String sdislicode = ogdjson.getString("islicode");
if(gs.getLinkcode().equals(sdislicode)) {
gather.put("download_status",sdstatus);
}
}
}

84
src/main/resources/mapper/szwh/OrderGoodsSourceMapper.xml

@ -22,81 +22,21 @@
and is_deleted=0 ;
</select>
<!--根据uid查询用户-->
<select id="getUserByUid" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Goods">
<!--多条件搜索订单商品资源-->
<select id="searchOrderGoodsSource" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.OrderGoodsSource">
select <include refid="column"/>
from <include refid="tbName"/>
where uid=#{uid}
<where>
<foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='sourceIdentify'">
${k} = #{v}
</if>
<if test="k=='sourceIdentify'">
sourceIdentify like concat('%',#{v},'%')
</if>
</foreach>
</where>
</select>
<!--查询用户名,加上密码-->
<select id="getUserByUname" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/>,password
from <include refid="tbName"/>
where uname=#{uname} limit 1;
</select>
<!--查询用户-->
<select id="getSingleUserByOpenid" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods">
select <include refid="column"/> from
<include refid="tbName"/>
where openid=#{openid};
</select>
<!--新增用户-->
<insert id="addUser" parameterType="cn.chjyj.szwh.bean.Goods" useGeneratedKeys="true" keyColumn="uid">
insert into <include refid="tbName"/>
(uname,password,gender,urealname,ubirth,nickname,avatarurl,platfrom,sessionkey,openid)
values (
#{uname},
#{password},
#{gender},
#{urealname},
#{ubirth},
#{nickname},
#{avatarurl},
#{platfrom},
#{sessionkey},
#{openid}
)
</insert>
<update id="upUser" parameterType="cn.chjyj.szwh.bean.Goods">
update <include refid="tbName"/>
set
<if test="password!=null">
password=#{password},
</if>
<if test="urealname!=null">
urealname=#{urealname},
</if>
<if test="ubirth!=null">
ubirth =#{ubirth},
</if>
<if test="gender!=null">
gender=#{gender},
</if>
<if test="nickName!=null">
nickname=#{nickName},
</if>
<if test="avatarurl!=null">
avatarurl=#{avatarurl},
</if>
<if test="nickname!=null">
nickname=#{nickname},
</if>
<if test="platfrom!=null">
platfrom=#{platfrom},
</if>
<if test="sessionkey!=null">
sessionkey=#{sessionkey},
</if>
<if test="openid!=null">
openid=#{openid},
</if>
uname=#{uname}
where uid=#{uid};
</update>
</mapper>
Loading…
Cancel
Save