Browse Source

账单推送主账单增加图片

yanliming 4 years ago
parent
commit
a311f2d319

+ 2 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/dao/PersonInfoDAO.java

@@ -22,4 +22,6 @@ public interface PersonInfoDAO {
 	PersonInfo findByUserName(String userName);
 
 	PersonInfo findByOpenId(String openId);
+
+	List<PersonInfo> findByCompanyId(String companyId);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/service/PersonInfoService.java

@@ -20,4 +20,6 @@ public interface PersonInfoService {
 	PersonInfo findByUserName(String userName);
 
 	PersonInfo findByOpenId(String openId);
+
+	List<PersonInfo> findByCompanyId(String companyId);
 }

+ 5 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/service/impl/PersonInfoServiceImpl.java

@@ -84,4 +84,9 @@ public class PersonInfoServiceImpl implements PersonInfoService {
 	public PersonInfo findByOpenId(String openId) {
 		return personInfoDAO.findByOpenId(openId);
 	}
+
+	@Override
+	public List<PersonInfo> findByCompanyId(String companyId){
+		return personInfoDAO.findByCompanyId(companyId);
+	}
 }

+ 6 - 0
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -191,4 +191,10 @@
 		and open_id = #{openId}
 		]]>
 	</select>
+	<select id="findByCompanyId" resultMap="PersonInfoMap">
+		select * from base_person_info
+		where del_flag = 0
+		and company_id = #{0}
+	</select>
+
 </mapper>

+ 25 - 9
web/src/main/java/com/jpsoft/enterprise/modules/base/controller/BillDetailController.java

@@ -4,14 +4,8 @@ import com.github.pagehelper.Page;
 import com.github.pagehelper.util.StringUtil;
 import com.jpsoft.enterprise.config.OSSConfig;
 import com.jpsoft.enterprise.modules.base.dto.BillDetailDTO;
-import com.jpsoft.enterprise.modules.base.entity.BillDetailInfo;
-import com.jpsoft.enterprise.modules.base.entity.BillInfo;
-import com.jpsoft.enterprise.modules.base.entity.CompanyInfo;
-import com.jpsoft.enterprise.modules.base.entity.OrderInfo;
-import com.jpsoft.enterprise.modules.base.service.BillDetailInfoService;
-import com.jpsoft.enterprise.modules.base.service.BillInfoService;
-import com.jpsoft.enterprise.modules.base.service.CompanyInfoService;
-import com.jpsoft.enterprise.modules.base.service.OrderInfoService;
+import com.jpsoft.enterprise.modules.base.entity.*;
+import com.jpsoft.enterprise.modules.base.service.*;
 import com.jpsoft.enterprise.modules.common.dto.MessageResult;
 import com.jpsoft.enterprise.modules.common.dto.Sort;
 import com.jpsoft.enterprise.modules.common.utils.OSSUtil;
@@ -55,6 +49,12 @@ public class BillDetailController {
     @Autowired
     private OrderInfoService orderInfoService;
 
+    @Autowired
+    private  PersonInfoService personInfoService;
+
+    @Autowired
+    private MessageReceiverService messageReceiverService;
+
     @Autowired
     private OSSConfig ossConfig;
 
@@ -279,10 +279,26 @@ public class BillDetailController {
             for (BillDetailInfo billDetailInfo:list) {
                 billDetailInfo.setRushStatus("1");
                 billDetailInfo.setUpdateBy(subject);
-                billDetailInfo.setUpdateTime(new Date());
+                Date now = new Date();
+                billDetailInfo.setUpdateTime(now);
 
                 affectCount += billDetailInfoService.update(billDetailInfo);
 
+                //推送站内消息
+                 List<PersonInfo> personInfoList = personInfoService.findByCompanyId(billDetailInfo.getCompanyId());
+
+                for (PersonInfo personInfo:personInfoList) {
+                    MessageReceiver messageReceiver = new MessageReceiver();
+                    messageReceiver.setId(UUID.randomUUID().toString());
+                    messageReceiver.setReadStatus(false);
+                    messageReceiver.setDelFlag(false);
+                    messageReceiver.setMessageId("2");//账单推送消息
+                    messageReceiver.setPersonId(personInfo.getId());
+                    messageReceiver.setCreateBy(subject);
+                    messageReceiver.setCreateTime(now);
+
+                    messageReceiverService.insert(messageReceiver);
+                }
             }
 
             if (affectCount > 0) {