| | |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.StringUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private static String sendMsgUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="; |
| | | |
| | | @Override |
| | | public void execute(Business business, List<Business> businesses) { |
| | | public void execute(Business business, List<Business> businesses) throws ParseException { |
| | | JSONObject data = business.getData(); |
| | | //获取开始时间 |
| | | String beginTime = data.getString("startTime") + " 00:00:00"; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date timeOne = format.parse(beginTime); |
| | | Calendar now = Calendar.getInstance(); |
| | | String newTime = now.get(Calendar.YEAR) + "-" + (now.get(Calendar.MONTH) + 1) + "-" + now.get(Calendar.DAY_OF_MONTH) + " 00:00:00"; |
| | | Date timeTwo = format.parse(newTime); |
| | | if (timeOne.getTime() < timeTwo.getTime()) { |
| | | logger.info("装修时间不能小于当前时间!"); |
| | | return; |
| | | } |
| | | //查询小区信息 |
| | | CommunityDto communityDto = new CommunityDto(); |
| | | communityDto.setCommunityId(data.getString("communityId")); |
| | |
| | | data.setKeyword5(new Content("待审核")); |
| | | data.setRemark(new Content("感谢您的使用。")); |
| | | templateMessage.setData(data); |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | //获取员工公众号地址 |
| | | String wechatUrl = MappingCache.getValue("STAFF_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |
| | | ResponseEntity<String> responseEntity = outRestTemplate.postForEntity(url, JSON.toJSONString(templateMessage), String.class); |
| | |
| | | data.setKeyword4(new Content(paramIn.getString("startTime") + "至" + paramIn.getString("endTime"))); |
| | | data.setRemark(new Content("物业联系电话:" + tel + ",请到物业管理处或通过手机缴纳装修押金!")); |
| | | templateMessage.setData(data); |
| | | //获取业主公众号地址 |
| | | String wechatUrl = MappingCache.getValue("OWNER_WECHAT_URL"); |
| | | templateMessage.setUrl(wechatUrl); |
| | | logger.info("发送模板消息内容:{}", JSON.toJSONString(templateMessage)); |