| @@ -27,7 +27,16 @@ public class WxChartDataController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxChartDataService wxChartDataService; | private WxChartDataService wxChartDataService; | ||||
| @ApiOperation("queryData") | |||||
| @ApiOperation("chart=53首页数据:" + | |||||
| "todayNewUserCount今日新增会员 weekNewUserCount近一周新增会员," + | |||||
| "todayActiveUserCount今日活跃会员 weekActiveUserCount近一周活跃会员," + | |||||
| "userTotalCount会员总数,growUserCount自然增长 importUserCount导入," + | |||||
| "rentRate出租率 rentCount已租 notRentCount未出租," + | |||||
| "notSignContract待签约合同个数 signContract已签约合同," + | |||||
| "onlineActivity上架营销活动 todayReceive今日领取," + | |||||
| "todayUserCount今日客流 growRate较昨日上涨," + | |||||
| "todayCarCount今日车流 downRate较昨日下跌 carParkStatus车场状态," + | |||||
| "msgLeave短信剩余 msgHasUse短信已使用") | |||||
| @GetMapping("/queryData") | @GetMapping("/queryData") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "chart", value = "chart", dataType = "String", paramType = "query", required = true), | @ApiImplicitParam(name = "chart", value = "chart", dataType = "String", paramType = "query", required = true), | ||||
| @@ -60,6 +60,7 @@ public enum EnumChart { | |||||
| INDEX_BILL_RECE_RATE(50, "费用收缴数据"), | INDEX_BILL_RECE_RATE(50, "费用收缴数据"), | ||||
| INDEX_COUPON_SCENE(51, "场景发券"), | INDEX_COUPON_SCENE(51, "场景发券"), | ||||
| INDEX_SALE_DATA(52, "营销数据"), | INDEX_SALE_DATA(52, "营销数据"), | ||||
| INDEX_DATA(53, "首页数据"), | |||||
| ; | ; | ||||
| public static EnumChart getEnum(Integer code) { | public static EnumChart getEnum(Integer code) { | ||||
| @@ -7,10 +7,13 @@ import com.iformall.domain.po.WxMsgConfig; | |||||
| public interface WxMsgConfigMapper extends CommonMapper<WxMsgConfig, String> { | public interface WxMsgConfigMapper extends CommonMapper<WxMsgConfig, String> { | ||||
| List<WxMsgConfig> findList(WxMsgConfig wxMsgConfig); | List<WxMsgConfig> findList(WxMsgConfig wxMsgConfig); | ||||
| /** | |||||
| * 减剩余条数 | |||||
| * @param wxMsgConfig | |||||
| */ | |||||
| void updateRemains(WxMsgConfig wxMsgConfig); | |||||
| } | } | ||||
| @@ -303,6 +303,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| return getSaleDataHistory(tenantId, startdate, enddate); | return getSaleDataHistory(tenantId, startdate, enddate); | ||||
| } | } | ||||
| //首页营销数据 | |||||
| if (chart.equals(EnumChart.INDEX_DATA.getCode())) { | |||||
| return getIndexData(tenantId, startdate, enddate); | |||||
| } | |||||
| return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); | return new ResultData(ErrorCode.REPORT_TYPE_UNKNOWN); | ||||
| @@ -2477,4 +2481,48 @@ public class WxChartServiceImpl implements WxChartDataService { | |||||
| return new ResultData(datamap); | return new ResultData(datamap); | ||||
| } | } | ||||
| /** | |||||
| * 首页数据 | |||||
| * @param tenantId | |||||
| * @return | |||||
| */ | |||||
| private ResultData getIndexData(String tenantId, String startdate,String enddate) { | |||||
| Date startDate = DateUtils.getDateFromString(startdate,"yyyy-MM-dd HH:mm:ss").getTime(); | |||||
| Date endDate = DateUtils.getDateFromString(enddate,"yyyy-MM-dd HH:mm:ss").getTime(); | |||||
| HashMap<String, Object> datamap = new HashMap<>(); | |||||
| datamap.put("todayNewUserCount",0); | |||||
| datamap.put("weekNewUserCount",0); | |||||
| datamap.put("todayActiveUserCount",0); | |||||
| datamap.put("weekActiveUserCount",0); | |||||
| datamap.put("userTotalCount",0); | |||||
| datamap.put("growUserCount",0); | |||||
| datamap.put("importUserCount",0); | |||||
| datamap.put("rentRate","10%"); | |||||
| datamap.put("rentCount",0); | |||||
| datamap.put("notRentCount",0); | |||||
| datamap.put("notSignContract",0); | |||||
| datamap.put("signContract",0); | |||||
| datamap.put("onlineActivity",0); | |||||
| datamap.put("todayReceive",0); | |||||
| datamap.put("todayUserCount",0); | |||||
| datamap.put("growRate","10%"); | |||||
| datamap.put("todayCarCount",0); | |||||
| datamap.put("downRate","10%"); | |||||
| datamap.put("carParkStatus","正常"); | |||||
| datamap.put("msgLeave",0); | |||||
| datamap.put("msgHasUse",123); | |||||
| return new ResultData(datamap); | |||||
| } | |||||
| } | } | ||||
| @@ -863,8 +863,6 @@ public class WxFlowServiceImpl implements WxFlowService { | |||||
| //给发起人发送驳回消息 | //给发起人发送驳回消息 | ||||
| Map<String,String> msgReplaceMap = new HashedMap(); | Map<String,String> msgReplaceMap = new HashedMap(); | ||||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | |||||
| wxMsgValidationcode.setTenantId(tenantId); | |||||
| msgReplaceMap.put("contract",(String)getVariableByKey(variables,"contractNumber")); | msgReplaceMap.put("contract",(String)getVariableByKey(variables,"contractNumber")); | ||||
| msgReplaceMap.put("page",Constant.adminPage); | msgReplaceMap.put("page",Constant.adminPage); | ||||
| WxMsgRecord wxMsgRecord = new WxMsgRecord(); | WxMsgRecord wxMsgRecord = new WxMsgRecord(); | ||||
| @@ -75,7 +75,7 @@ public class WxMsgCallbackServiceImpl implements WxMsgCallbackService { | |||||
| List<WxMsgCallback> wxMsgCallbacks = JSONArray.parseArray(param.get("item"), WxMsgCallback.class); | List<WxMsgCallback> wxMsgCallbacks = JSONArray.parseArray(param.get("item"), WxMsgCallback.class); | ||||
| wxMsgConfig = list.get(0); | wxMsgConfig = list.get(0); | ||||
| wxMsgConfig.setRemains(wxMsgConfig.getRemains() - wxMsgCallbacks.size()); | wxMsgConfig.setRemains(wxMsgConfig.getRemains() - wxMsgCallbacks.size()); | ||||
| wxMsgConfigMapper.updateByPrimaryKeySelective(wxMsgConfig); | |||||
| //wxMsgConfigMapper.updateByPrimaryKeySelective(wxMsgConfig); | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| for (WxMsgCallback wxMsgCallback : wxMsgCallbacks) { | for (WxMsgCallback wxMsgCallback : wxMsgCallbacks) { | ||||
| WxMsgCallback callback=wxMsgCallbackMapper.queryCallbackByBatchNoAndPhone(wxMsgCallback); | WxMsgCallback callback=wxMsgCallbackMapper.queryCallbackByBatchNoAndPhone(wxMsgCallback); | ||||
| @@ -8,12 +8,13 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.enums.EnumMsgModel; | |||||
| import com.iformall.enums.EnumMsgSendStatus; | |||||
| import com.iformall.enums.EnumVerifyCode; | |||||
| import com.iformall.domain.po.msg.WxMsgRecord; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.WxMsgValidationcodeService; | import com.iformall.service.WxMsgValidationcodeService; | ||||
| import com.iformall.utils.*; | import com.iformall.utils.*; | ||||
| import org.apache.commons.collections.map.HashedMap; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -48,6 +49,9 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| @Autowired | @Autowired | ||||
| WxMsgCallbackMapper wxMsgCallbackMapper; | WxMsgCallbackMapper wxMsgCallbackMapper; | ||||
| @Autowired | |||||
| MqBaseProducer mqBaseProducer; | |||||
| @Override | @Override | ||||
| public PageInfo<WxMsgValidationcode> listAsPage(WxMsgValidationcode record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMsgValidationcode> listAsPage(WxMsgValidationcode record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMsgValidationcodeMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMsgValidationcodeMapper.findList(record)); | ||||
| @@ -107,7 +111,6 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | wxMsgValidationcodeModel = wxMsgValidationcodeModelMapper.findList(wxMsgValidationcodeModel).get(0); | ||||
| wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | wxMsgValidationcode.setSignature(wxMsgValidationcodeModel.getSignature()); | ||||
| String secret = wxMsgConfig.getSecret(); | String secret = wxMsgConfig.getSecret(); | ||||
| String bid = wxMsgConfig.getBid(); | String bid = wxMsgConfig.getBid(); | ||||
| String publickey = wxMsgConfig.getPublickey(); | String publickey = wxMsgConfig.getPublickey(); | ||||
| @@ -121,6 +124,21 @@ public class WxMsgValidationcodeServiceImpl implements WxMsgValidationcodeServic | |||||
| wxMsgValidationcode.setMsg(msg); | wxMsgValidationcode.setMsg(msg); | ||||
| String notifyUrl = wxMsgConfig.getNotifyurl(); | String notifyUrl = wxMsgConfig.getNotifyurl(); | ||||
| Integer modelId = wxMsgValidationcodeModel.getModelId(); | Integer modelId = wxMsgValidationcodeModel.getModelId(); | ||||
| //给发起人发送驳回消息 | |||||
| // Map<String,String> msgReplaceMap = new HashedMap(); | |||||
| // msgReplaceMap.put("contract",(String)getVariableByKey(variables,"contractNumber")); | |||||
| // msgReplaceMap.put("page",Constant.adminPage); | |||||
| // WxMsgRecord wxMsgRecord = new WxMsgRecord(); | |||||
| // wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | |||||
| // wxMsgRecord.setModelType(EnumMsgModel.VALIDATION_CODE.getCode()); | |||||
| // wxMsgRecord.setReceiver(wxMsgValidationcode.getPhone()); | |||||
| // wxMsgRecord.setTenantId(wxMsgConfig.getTenantId()); | |||||
| // wxMsgRecord.setDynamicContentMap(msgReplaceMap); | |||||
| // mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(),EnumMsgMqTag.DEFAULT.getCode(),EnumMsgMqKey.DEFAULT.getCode()); | |||||
| String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId); | String result = WiwideUtil.sendMsg(secret, bid, publickey, phone, signature, msg, notifyUrl, EnumVerifyCode.YES.getCode().toString(), modelId); | ||||
| JSONObject jsonObjectResult = JSONObject.parseObject(result); | JSONObject jsonObjectResult = JSONObject.parseObject(result); | ||||
| String ret = jsonObjectResult.get("ret").toString(); | String ret = jsonObjectResult.get("ret").toString(); | ||||
| @@ -113,7 +113,9 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <update id="updateRemains" parameterType="com.iformall.domain.po.WxMsgConfig"> | |||||
| update wx_msg_config set remains = if(remains - #{remains} < 0,0,remains - #{remains}) where `tenant_id` = #{tenantId} | |||||
| </update> | |||||