|
@@ -12,6 +12,10 @@ import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import cn.superdesk.libs.common.json.JsonUtils;
|
|
|
+import com.palmnest.application.dto.*;
|
|
|
+import com.palmnest.model.dinner.*;
|
|
|
+import com.palmnest.service.dinner.manager.*;
|
|
|
import net.sf.json.JsonConfig;
|
|
|
import net.sf.json.util.JSONUtils;
|
|
|
|
|
@@ -21,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import scala.collection.concurrent.TNode;
|
|
|
import sun.security.krb5.internal.crypto.crc32;
|
|
|
import cn.jiguang.common.utils.StringUtils;
|
|
@@ -45,14 +50,6 @@ import com.palmnest.application.core.util.PageUtils;
|
|
|
import com.palmnest.application.core.util.PropertiesKit;
|
|
|
import com.palmnest.application.core.util.StringUtil;
|
|
|
import com.palmnest.application.core.util.WeekDate;
|
|
|
-import com.palmnest.application.dto.Articles;
|
|
|
-import com.palmnest.application.dto.ConsumerDto;
|
|
|
-import com.palmnest.application.dto.MeetintDto;
|
|
|
-import com.palmnest.application.dto.RechargeRecordDto;
|
|
|
-import com.palmnest.application.dto.RechargeSetDto;
|
|
|
-import com.palmnest.application.dto.RechargeSetRecordDto;
|
|
|
-import com.palmnest.application.dto.StapleFoodDto;
|
|
|
-import com.palmnest.application.dto.WebPageResultDto;
|
|
|
import com.palmnest.application.dto.output.ElementDto;
|
|
|
import com.palmnest.application.dto.output.IntegralRecodeDto;
|
|
|
import com.palmnest.application.dto.output.MealAndUserDto;
|
|
@@ -61,11 +58,6 @@ import com.palmnest.application.dto.output.VisitorStatisticsDto;
|
|
|
import com.palmnest.dao.notice.MobileConfigDao;
|
|
|
import com.palmnest.model.DateTypeInfo;
|
|
|
import com.palmnest.model.Element;
|
|
|
-import com.palmnest.model.dinner.IntegralRecodeInfo;
|
|
|
-import com.palmnest.model.dinner.Meal;
|
|
|
-import com.palmnest.model.dinner.MealCar;
|
|
|
-import com.palmnest.model.dinner.RechargeRecord;
|
|
|
-import com.palmnest.model.dinner.RechargeSet;
|
|
|
import com.palmnest.model.estateserve.AppUser;
|
|
|
import com.palmnest.model.estateserve.WxUser;
|
|
|
import com.palmnest.model.notice.MobileConfigModel;
|
|
@@ -74,13 +66,6 @@ import com.palmnest.service.AppUserService;
|
|
|
import com.palmnest.service.ElementGroupManager;
|
|
|
import com.palmnest.service.OrganizationManager;
|
|
|
import com.palmnest.service.UserManager;
|
|
|
-import com.palmnest.service.dinner.manager.IntegralRecodeInfoManager;
|
|
|
-import com.palmnest.service.dinner.manager.MealCarManager;
|
|
|
-import com.palmnest.service.dinner.manager.MealManager;
|
|
|
-import com.palmnest.service.dinner.manager.OrderDinnerInfoManager;
|
|
|
-import com.palmnest.service.dinner.manager.OrderDinnerManager;
|
|
|
-import com.palmnest.service.dinner.manager.RechargeRecordManager;
|
|
|
-import com.palmnest.service.dinner.manager.RechargeSetManager;
|
|
|
import com.palmnest.service.dinner.service.OrderDinnerService;
|
|
|
import com.palmnest.service.dinner.service.PlaceAnOrderService;
|
|
|
import com.palmnest.service.estateserve.AppUserManager;
|
|
@@ -144,18 +129,18 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
private OrderDinnerService orderDinnerService;
|
|
|
@Autowired
|
|
|
private DateTypeInfoManager dateTypeInfoManager;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OrderDinnerSetManager orderDinnerSetManager;
|
|
|
|
|
|
private SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
public static String host = PropertiesKit.readPropertiesValue("hostUrl", "wechat.properties");
|
|
|
public static String wxDinnerUrl = PropertiesKit.readPropertiesValue("wxDinnerUrl", "wechat.properties");
|
|
|
public static String clientNo = PropertiesKit.readPropertiesValue("clientNo", "wechat.properties");
|
|
|
+ public static final String wxMessageUrl = PropertiesKit.readPropertiesValue("wxMessageUrl", "wechat.properties");
|
|
|
/**
|
|
|
* 获取能够订餐的用户
|
|
|
- * @param orgId 项目
|
|
|
- * @param time 订餐日期
|
|
|
- * @param openId操作人
|
|
|
- * @param developIds
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -543,10 +528,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
/**
|
|
|
* 根据参数获取该餐品下购物车中的详情(仅限组合)
|
|
|
* @param parements
|
|
|
- * @param orgId
|
|
|
- * @param openId
|
|
|
- * @param mealId
|
|
|
- * @param time
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -629,7 +610,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
}
|
|
|
/**
|
|
|
* 获取会议餐的总份数
|
|
|
- * @param list
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -971,7 +951,7 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
}
|
|
|
}
|
|
|
@Transactional
|
|
|
- private void saveAppUserByRecharge(String orgId,int sumCount){
|
|
|
+ public void saveAppUserByRecharge(String orgId,int sumCount){
|
|
|
//获取该项目下所有有效的人员
|
|
|
List<AppUser> list=appUserManager.getAppUserByOrgId(Integer.parseInt(orgId));
|
|
|
if(list!=null&&list.size()>0){
|
|
@@ -1010,7 +990,31 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
}
|
|
|
return AppResultUtil.createSuccesDto();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AppResultDto getPushSet(Integer orgId) {
|
|
|
+ OrderDinnerSet set = orderDinnerSetManager.findByOrgId(orgId);
|
|
|
+ if(null == set){
|
|
|
+ set = new OrderDinnerSet();
|
|
|
+ set.setStatus("1");
|
|
|
+ set.setOrgId(orgId);
|
|
|
+ return AppResultUtil.createSuccesDto(set);
|
|
|
+ }
|
|
|
+ return AppResultUtil.createSuccesDto(set);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AppResultDto getPushSetByUserId(Integer userId) {
|
|
|
+ OrderDinnerSet set = orderDinnerSetManager.findByUserId(userId);
|
|
|
+ if(null == set){
|
|
|
+ set = new OrderDinnerSet();
|
|
|
+ set.setStatus("1");
|
|
|
+ set.setUserId(userId);
|
|
|
+ return AppResultUtil.createSuccesDto(set);
|
|
|
+ }
|
|
|
+ return AppResultUtil.createSuccesDto(set);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RechargeSetDto getRechargeSetDto(String orgId) {
|
|
|
//获取该项目下所配置的积分设置
|
|
@@ -1049,6 +1053,44 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
return AppResultUtil.createErrorDto("100", "保存失败");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AppResultDto saveAndPushSet(DinnerPushSetVo reSetDto) {
|
|
|
+ if(StringUtils.isEmpty(reSetDto.getStatus())){
|
|
|
+ reSetDto.setStatus("1");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(null != reSetDto.getOrgId()){
|
|
|
+ OrderDinnerSet set = orderDinnerSetManager.findByOrgId(reSetDto.getOrgId());
|
|
|
+ if(null == set){
|
|
|
+ set = new OrderDinnerSet();
|
|
|
+ set.setOrgId(reSetDto.getOrgId());
|
|
|
+ set.setStatus(reSetDto.getStatus());
|
|
|
+ orderDinnerSetManager.save(set);
|
|
|
+ }else{
|
|
|
+ set.setStatus(reSetDto.getStatus());
|
|
|
+ orderDinnerSetManager.updateModel(set);
|
|
|
+ }
|
|
|
+ }else if(null != reSetDto.getUserId()){
|
|
|
+ OrderDinnerSet set = orderDinnerSetManager.findByUserId(reSetDto.getUserId());
|
|
|
+ if(null == set){
|
|
|
+ set = new OrderDinnerSet();
|
|
|
+ set.setUserId(reSetDto.getUserId());
|
|
|
+ set.setStatus(reSetDto.getStatus());
|
|
|
+ orderDinnerSetManager.save(set);
|
|
|
+ }else{
|
|
|
+ set.setStatus(reSetDto.getStatus());
|
|
|
+ orderDinnerSetManager.updateModel(set);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return AppResultUtil.createSuccesDto();
|
|
|
+ } catch (Exception e) {
|
|
|
+ LOG.error(e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ return AppResultUtil.createErrorDto("100", "保存失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void updateOrderDinner() {
|
|
|
//获取使用订餐的项目
|
|
@@ -1198,7 +1240,6 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
}
|
|
|
/**
|
|
|
* 封装查询到的订餐总数、普通订餐数、临时工作餐数、会议餐数
|
|
|
- * @param orgId
|
|
|
* @param dateType
|
|
|
* @param date
|
|
|
* @param endDate
|
|
@@ -1581,6 +1622,80 @@ public class PlaceAnOrderServiceImpl implements PlaceAnOrderService{
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void sendTempMsg(String openId, String orgId,String date) {
|
|
|
+ String nextDate = "";
|
|
|
+ if(StringUtils.isEmpty(date)){
|
|
|
+ date = DateHelper.formatDate(new Date(),DateHelper.CURRENT_DATE);
|
|
|
+ }
|
|
|
+
|
|
|
+ String tomorrow = DateHelper.getNextDay(date,DateHelper.CURRENT_DATE);
|
|
|
+ LOG.info("sendTempMsg/tomorrow:"+tomorrow);
|
|
|
+
|
|
|
+ String orgIds="";
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(orgId)){
|
|
|
+ orgIds = orgId;
|
|
|
+ }else{
|
|
|
+ String newOrgs=serviceProjectAllocationManager.getServiceProjectByServiceCode("DCFW");
|
|
|
+ LOG.info("sendTempMsg/orgIds:"+newOrgs);
|
|
|
+ String[] orgArr=newOrgs.split(",");
|
|
|
+ //获取设置了微信提醒的项目
|
|
|
+
|
|
|
+ if(null == orgArr || orgArr.length == 0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for(int i=0;i<orgArr.length;i++){
|
|
|
+ Integer org = Integer.parseInt(orgArr[i]);
|
|
|
+ OrderDinnerSet orderDinnerSet = orderDinnerSetManager.findByOrgId(org);
|
|
|
+ if(null != orderDinnerSet && "0".equals(orderDinnerSet.getStatus())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //获取下一个上了餐的日期:需要判断日期是否为明天,如果是明天,今天才做推送,如果不是明天,不做推送
|
|
|
+ LOG.info("begin sendTempMsg-:" + org+";date:"+date);
|
|
|
+ nextDate = mealManager.getNextMealDate(org,date,1);
|
|
|
+ LOG.info("begin sendTempMsg-:" + org+";date:"+date+";nextDate:"+nextDate);
|
|
|
+ if(StringUtils.isEmpty(nextDate)){
|
|
|
+ nextDate = date;
|
|
|
+ LOG.info("begin sendTempMsg-:" + org+";date:"+date+";nextDate2:"+nextDate);
|
|
|
+ }
|
|
|
+ if(!tomorrow.equals(nextDate)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(null == orderDinnerSet || StringUtils.isEmpty(orderDinnerSet.getStatus())){
|
|
|
+ orgIds = orgIds+org+",";
|
|
|
+ }else if("1".equals(orderDinnerSet.getStatus())){
|
|
|
+ orgIds = orgIds+org+",";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LOG.info("sendTempMsg-newOrgs:"+orgIds);
|
|
|
+ if(StringUtils.isNotEmpty(orgIds)&&",".equals(orgIds.substring(orgIds.length()-1,orgIds.length()))){
|
|
|
+ orgIds=orgIds.substring(0,orgIds.length()-1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LOG.info("sendTempMsg-newOrgs:上线了订餐服务且开启了订餐提醒的项目:"+orgIds);
|
|
|
+
|
|
|
+ //根据项目列表获取所有开启了订餐提醒的用户
|
|
|
+ String content = "您好,请及时预定明天的餐品,马上要截止订餐了!";
|
|
|
+ String url="";
|
|
|
+ //获取项目下允许订餐推送的用户
|
|
|
+ Map<Integer,String> resMap = orderDinnerSetManager.findUserByOrgIds(orgIds,openId);
|
|
|
+ for (Integer org : resMap.keySet()){
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ map.put("orgId",org);
|
|
|
+ map.put("userIds",resMap.get(org).split(","));
|
|
|
+ map.put("content",content);
|
|
|
+ map.put("url",url);
|
|
|
+ String params=com.alibaba.fastjson.JSONObject.toJSONString(map);
|
|
|
+ LOG.info("sendTempMsg params===>"+ params);
|
|
|
+ LOG.info("sendTempMsg wxMessageUrl===>"+ wxMessageUrl);
|
|
|
+ String result=HttpKit.HttpClientPost(params,wxMessageUrl);
|
|
|
+ LOG.info("sendTempMsg result===>"+ JsonUtils.toJson(result));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void sendMessageByOrgSet(String orgId,String mobile) {
|
|
|
Calendar calendar = Calendar.getInstance();
|