Commit a5cf10e1 by 张新旗

代码永远在路上

parent 2ddadc35
...@@ -12,6 +12,7 @@ import com.soss.system.domain.Order; ...@@ -12,6 +12,7 @@ import com.soss.system.domain.Order;
import com.soss.system.domain.OrderDetail; import com.soss.system.domain.OrderDetail;
import com.soss.system.service.impl.AppServiceImpl; import com.soss.system.service.impl.AppServiceImpl;
import com.soss.system.service.impl.OrderServiceImpl; import com.soss.system.service.impl.OrderServiceImpl;
import com.soss.system.service.impl.WechatMessageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -31,6 +32,8 @@ public class AppController extends BaseController { ...@@ -31,6 +32,8 @@ public class AppController extends BaseController {
private AppServiceImpl appService; private AppServiceImpl appService;
@Autowired @Autowired
private OrderServiceImpl orderService; private OrderServiceImpl orderService;
@Autowired
private WechatMessageServiceImpl wechatMessageService;
...@@ -85,5 +88,10 @@ public class AppController extends BaseController { ...@@ -85,5 +88,10 @@ public class AppController extends BaseController {
public AjaxResult getNextOrder(String orderId,String shopId){ public AjaxResult getNextOrder(String orderId,String shopId){
return AjaxResult.success(orderService.getNextOrder(orderId,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 { ...@@ -533,11 +533,14 @@ public class WeixinServiceImpl {
String cityString ="[value='%s'][0].children[value='%s'][0].name"; String cityString ="[value='%s'][0].children[value='%s'][0].name";
String zoneString = "[value='%s'][0].children[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 shop = new Shop();
shop.setState("1");
List<Shop> shops = shopMapper.selectShopList(shop); List<Shop> shops = shopMapper.selectShopList(shop);
List<JSONObject> proviceList = new ArrayList<>(); List<JSONObject> proviceList = new ArrayList<>();
List<String> proString = new ArrayList<>(); List<String> proString = new ArrayList<>();
for (Shop shop1 : shops) { 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())); String aa = AppServiceImpl.GetDistance(Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shop1.getLng()), Double.parseDouble(shop1.getLat()));
shop1.setDistance(aa); shop1.setDistance(aa);
String province = shop1.getProvince(); String province = shop1.getProvince();
......
...@@ -20,8 +20,11 @@ public class AppServiceImpl { ...@@ -20,8 +20,11 @@ public class AppServiceImpl {
List<Shop> shops = shopMapper.selectShopList(shop); List<Shop> shops = shopMapper.selectShopList(shop);
if(shops !=null &&!shops.isEmpty()){ if(shops !=null &&!shops.isEmpty()){
Shop shop1 = shops.get(0); Shop shop1 = shops.get(0);
shop1.setDistance("-1");
if(StringUtils.isNotEmpty(lng)&&StringUtils.isNotEmpty(lat)){ 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; return shop1;
}else{ }else{
......
...@@ -115,4 +115,13 @@ public class WechatMessageServiceImpl implements IWechatMessageService ...@@ -115,4 +115,13 @@ public class WechatMessageServiceImpl implements IWechatMessageService
{ {
return wechatMessageMapper.deleteWechatMessageById(id); 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" ...@@ -215,7 +215,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by created_at desc limit 1 order by created_at desc limit 1
</select> </select>
<update id="updateTimeOut"> <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> </update>
<select id="selectOrderByUserId" resultMap="OrderResult"> <select id="selectOrderByUserId" resultMap="OrderResult">
<include refid="selectOrderVo"/> <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