java110
2022-01-17 d937205d5824dc44ab1567cf6f84fbfa817baa92
service-job/src/main/java/com/java110/job/adapt/roomRenovation/MachineSaveRoomRenovation.java
@@ -26,13 +26,18 @@
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;
/**
@@ -80,8 +85,19 @@
    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"));
@@ -180,7 +196,8 @@
                    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);
@@ -277,6 +294,7 @@
            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));