Commit a5cf10e1 by 张新旗

代码永远在路上

parent 2ddadc35
......@@ -12,6 +12,7 @@ import com.soss.system.domain.Order;
import com.soss.system.domain.OrderDetail;
import com.soss.system.service.impl.AppServiceImpl;
import com.soss.system.service.impl.OrderServiceImpl;
import com.soss.system.service.impl.WechatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -31,6 +32,8 @@ public class AppController extends BaseController {
private AppServiceImpl appService;
@Autowired
private OrderServiceImpl orderService;
@Autowired
private WechatMessageServiceImpl wechatMessageService;
......@@ -85,5 +88,10 @@ public class AppController extends BaseController {
public AjaxResult getNextOrder(String orderId,String shopId){
return AjaxResult.success(orderService.getNextOrder(orderId,shopId));
}
@RequestMapping("/getMessageCount")
public AjaxResult getMessageCount(HttpServletRequest request){
LoginUser loginUser = tokenService.getLoginUser(request);
return AjaxResult.success("",wechatMessageService.getMessageCount(loginUser.getOpenId()));
}
}
......@@ -533,11 +533,14 @@ public class WeixinServiceImpl {
String cityString ="[value='%s'][0].children[value='%s'][0].name";
String zoneString = "[value='%s'][0].children[value='%s'][0].children[value='%s'][0].name";
Shop shop = new Shop();
shop.setState("1");
List<Shop> shops = shopMapper.selectShopList(shop);
List<JSONObject> proviceList = new ArrayList<>();
List<String> proString = new ArrayList<>();
for (Shop shop1 : shops) {
if("3".equals(shop1.getState())){
continue;
}
String aa = AppServiceImpl.GetDistance(Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shop1.getLng()), Double.parseDouble(shop1.getLat()));
shop1.setDistance(aa);
String province = shop1.getProvince();
......
......@@ -20,8 +20,11 @@ public class AppServiceImpl {
List<Shop> shops = shopMapper.selectShopList(shop);
if(shops !=null &&!shops.isEmpty()){
Shop shop1 = shops.get(0);
shop1.setDistance("-1");
if(StringUtils.isNotEmpty(lng)&&StringUtils.isNotEmpty(lat)){
shop.setDistance(AppServiceImpl.GetDistance(Double.parseDouble(lng),Double.parseDouble(lat),Double.parseDouble(shop.getLng()),Double.parseDouble(shop.getLat())));
//List<Shop> shopList = shopMapper.selectShopList(new Shop());
shop.setDistance(AppServiceImpl.GetDistance(Double.parseDouble(lng),Double.parseDouble(lat),Double.parseDouble(shop1.getLng()),Double.parseDouble(shop1.getLat())));
}
return shop1;
}else{
......
......@@ -115,4 +115,13 @@ public class WechatMessageServiceImpl implements IWechatMessageService
{
return wechatMessageMapper.deleteWechatMessageById(id);
}
public String getMessageCount(String openId) {
WechatMessage wechatMessage = new WechatMessage();
wechatMessage.setUserId(openId);
wechatMessage.setIsRead("1");
List<WechatMessage> wechatMessages = wechatMessageMapper.selectWechatMessageList(wechatMessage);
return wechatMessages.size()+"";
}
}
......@@ -215,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by created_at desc limit 1
</select>
<update id="updateTimeOut">
update `order` set state='5' where state =#{status} and updated_at &lt; DATE_SUB(NOW() ,interval #{timeout} SECOND)
update `order` set state='7' where state =#{status} and updated_at &lt; DATE_SUB(NOW() ,interval #{timeout} SECOND)
</update>
<select id="selectOrderByUserId" resultMap="OrderResult">
<include refid="selectOrderVo"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment