| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.core.client.RestTemplate; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import com.java110.dto.mapping.Mapping; |
| | | import com.java110.dto.mapping.MappingDto; |
| | | import com.java110.dto.owner.OwnerAppUserDto; |
| | | import com.java110.dto.privilege.RoleCommunityDto; |
| | | import com.java110.dto.user.StaffAppAuthDto; |
| | | import com.java110.dto.wechat.Content; |
| | | import com.java110.dto.wechat.Data; |
| | | import com.java110.dto.wechat.PropertyFeeTemplateMessage; |
| | | import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; |
| | | import com.java110.intf.user.IRoleCommunityV1InnerServiceSMO; |
| | | import com.java110.intf.user.IStaffAppAuthInnerServiceSMO; |
| | | import com.java110.job.msgNotify.IMsgNotify; |
| | | import com.java110.job.msgNotify.IWechatTemplate; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private RestTemplate outRestTemplate; |
| | |
| | | ownerAppUserDto.setAppType(OwnerAppUserDto.APP_TYPE_WECHAT); |
| | | ownerAppUserDto.setUserId(userId); |
| | | List<OwnerAppUserDto> ownerAppUserDtos = ownerAppUserInnerServiceSMOImpl.queryOwnerAppUsers(ownerAppUserDto); |
| | | if (ownerAppUserDtos == null || ownerAppUserDtos.size() < 1) { |
| | | if (ownerAppUserDtos == null || ownerAppUserDtos.isEmpty()) { |
| | | throw new IllegalArgumentException("业主未绑定,没有获取到微信openId"); |
| | | } |
| | | |
| | | String openId = ownerAppUserDtos.get(0).getOpenId(); |
| | | |
| | | if (StringUtil.isEmpty(openId) || openId.startsWith("-")) { |
| | | throw new IllegalArgumentException("没有获取到微信openId"); |
| | | } |
| | | Mapping mapping = MappingCache.getMapping(MappingConstant.WECHAT_DOMAIN, SPEC_CD_OWE_FEE_TEMPLATE); |
| | | |
| | | if (mapping == null) { |
| | |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.put("thing2", new Content(content.getString("feeTypeName"))); |
| | | data.put("thing12", new Content(content.getString("payerObjName"))); |
| | | String payerObjName = content.getString("payerObjName"); |
| | | if (!StringUtil.isEmpty(payerObjName) && payerObjName.length() > 20) { |
| | | payerObjName = payerObjName.substring(0, 20); |
| | | } |
| | | data.put("thing12", new Content(payerObjName)); |
| | | data.put("amount3", new Content(content.getString("billAmountOwed"))); |
| | | data.put("time19", new Content(content.getString("date"))); |
| | | templateMessage.setData(data); |
| | |
| | | if (staffAppAuthDtos == null || staffAppAuthDtos.size() < 1) { |
| | | throw new IllegalArgumentException("员工未认证,没有获取到微信openId"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | openId = staffAppAuthDtos.get(0).getOpenId(); |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.put("thing2", new Content(content.getString("feeTypeCdName"))); |
| | | // data.put("thing2", new Content(content.getString("feeTypeCdName"))); |
| | | data.put("thing2", new Content(content.getString("feeName"))); |
| | | data.put("thing10", new Content(content.getString("payFeeRoom"))); |
| | | data.put("time18", new Content(content.getString("payFeeTime"))); |
| | | data.put("amount6", new Content(content.getString("receivedAmount"))); |
| | |
| | | data.put("thing8", new Content(content.getString("repairTypeName"))); |
| | | data.put("thing11", new Content(content.getString("repairObjName"))); |
| | | String context = content.getString("context"); |
| | | if (!StringUtil.isEmpty(context) && context.length() > 100) { |
| | | context = context.substring(0, 100); |
| | | if (!StringUtil.isEmpty(context) && context.length() > 20) { |
| | | context = context.substring(0, 20); |
| | | } |
| | | data.put("thing10", new Content(context)); |
| | | templateMessage.setData(data); |
| | |
| | | PropertyFeeTemplateMessage templateMessage = new PropertyFeeTemplateMessage(); |
| | | templateMessage.setTemplate_id(templateId); |
| | | templateMessage.setTouser(openId); |
| | | data.put("thing2", new Content(content.getString("repairName"))); |
| | | data.put("thing7", new Content(content.getString("repairName"))); |
| | | data.put("phone_number3", new Content(content.getString("tel"))); |
| | | data.put("time13", new Content(content.getString("time"))); |
| | | data.put("thing9", new Content(content.getString("address"))); |