Bladeren bron

优化积余订餐推送的代码

longmeizhen@avic-s.com 2 jaren geleden
bovenliggende
commit
662d8a4f02

+ 1 - 2
src/main/java/com/palmnest/dao/dinner/impl/ConsumerDaoImpl.java

@@ -110,7 +110,7 @@ public class ConsumerDaoImpl extends GenericDaoHibernate<Consumer, Long> impleme
 		sql.append(" ,u.email,dl.name deptStr,dl.name dept,u.userMobile mobile,u.address addressId ");
 		sql.append(" ,ifnull(doi.itemname,di.itemname) address,u.roleType,u.integral,u.organizationId  ");
 		sql.append(" ,date_format(u.createTime,'%Y-%m-%d %T') createTime,u.isEnabled,tg.passType,ifnull(tvpc.name,'暂未设置') permName ");
-		sql.append(" ,ifnull(s.status,1) pushState ");
+		sql.append(" ,ifnull(u.isPushState,1) pushState ");
 		sql.append(" from tb_user u ");
 		sql.append(" left join tb_department dl on dl.id=u.departmentId ");
 		sql.append(" left join tb_dictionary_item di on di.id=u.address ");
@@ -118,7 +118,6 @@ public class ConsumerDaoImpl extends GenericDaoHibernate<Consumer, Long> impleme
 		sql.append(" left join tb_organization tg on tg.id=u.organizationId ");
 		sql.append(" left join tb_virtualarchitecture tv on tv.id=u.virtualArchId ");
 		sql.append(" left join tb_vir_perm_config tvpc on tvpc.id=u.virPermId ");
-		sql.append(" left join tb_order_dinner_set s on s.userId=u.id ");
 		sql.append(" where 1=1 and (userType <> '-1' OR userType IS NULL) and (u.`STATUS` IS NULL OR u.`STATUS` <> '5') and u.userMobile is not null ");
 		if (StringUtils.isNotEmpty(paramets.get("orgId") == null ? "" : paramets.get("orgId").toString())) {
 			sql.append(" and u.organizationId in (" + paramets.get("orgId") + ")  ");

+ 2 - 2
src/main/java/com/palmnest/dao/dinner/impl/OrderDinnerSetDaoImpl.java

@@ -50,8 +50,8 @@ public class OrderDinnerSetDaoImpl extends GenericDaoHibernate<OrderDinnerSet, I
     public List<Map<String, Object>> findUserByOrgIds(String orgIds,String openId) {
         StringBuilder sql = new StringBuilder("");
         sql.append(" SELECT t.orgId, t.id userId FROM (   ");
-        sql.append(" SELECT u.organizationId orgId, u.id, ifnull( s.`status`, 1 ) state ");
-        sql.append("  FROM tb_user u LEFT JOIN tb_order_dinner_set s ON u.id = s.userId ");
+        sql.append(" SELECT u.organizationId orgId, u.id, ifnull( u.isPushState, 1 ) state ");
+        sql.append("  FROM tb_user u");
         sql.append(" WHERE u.organizationId IN ( "+orgIds+" ) AND u.openId <> '' AND u.isEnabled = '1'  ");
         if(StringUtils.isNotEmpty(openId)){
             sql.append(" AND (u.openid in ("+openId+") or u.bind_openid in ("+openId+") )  ");

+ 6 - 8
src/main/java/com/palmnest/service/virtProject/impl/VirtualArchServiceImpl.java

@@ -723,6 +723,11 @@ public class VirtualArchServiceImpl implements VirtualArchService {
 								// 非白名单用户
 								dto.setIsWhite(0);
 							}
+							if(StringUtils.isEmpty(userInfo.getIsPushState())){
+								dto.setPushState("1");
+							}else{
+								dto.setPushState(userInfo.getIsPushState());
+							}
 							dto.setPassType(org.getPassType());
 //							if(org.getPassType()!=null&&org.getPassType()==1){
 							// 查询该员工人脸照片信息
@@ -852,14 +857,7 @@ public class VirtualArchServiceImpl implements VirtualArchService {
 					String foodCardH5 = PropertiesKit.readPropertiesValue("food_card_H5", "wechat.properties"); ////饭卡企业号
 					dto.setFoodCardH5(foodCardH5);
 
-					if(StringUtils.isNotEmpty(dto.getUserId())){
-						OrderDinnerSet set = orderDinnerSetManager.findByUserId(Integer.parseInt(dto.getUserId()));
-						if(null == set){
-							dto.setPushState("1");
-						}else{
-							dto.setPushState(set.getStatus());
-						}
-					}
+
 
 					return AppResultUtil.createSuccesDto(dto);
 				} else {