forked from rongchao/epmet-cloud-rizhao
50 changed files with 1037 additions and 234 deletions
@ -0,0 +1,37 @@ |
|||
package com.epmet.evaluationindex.screen.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* desc:下级组织单项排行分数 form |
|||
* |
|||
* @DateTime 2020/8/20 9:54 上午 |
|||
*/ |
|||
@Data |
|||
public class SubSingleIndexRankFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -2920561669035794486L; |
|||
@NotBlank(message = "客户ID不能为空") |
|||
private String customerId; |
|||
/** |
|||
* 机关ID |
|||
*/ |
|||
@NotBlank(message = "机关ID不能为空") |
|||
private String agencyId; |
|||
@NotBlank(message = "指标code不能为空") |
|||
private String indexCode; |
|||
|
|||
/** |
|||
* 默认查询前几名 |
|||
*/ |
|||
private Integer topNum; |
|||
|
|||
private String monthId; |
|||
private String orgType; |
|||
private String sort; |
|||
|
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.epmet.evaluationindex.screen.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/10/22 10:52 上午 |
|||
*/ |
|||
@Data |
|||
public class TreeByTypeFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = -1438758394814978472L; |
|||
|
|||
public interface TreeByType extends CustomerClientShowGroup{} |
|||
|
|||
@NotBlank(message = "bizType不能为空",groups = TreeByType.class) |
|||
private String bizType; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.datareport.controller.backdoor; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.datareport.service.backdoor.BackDoorService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/10/21 5:17 下午 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("backdoor") |
|||
public class BackDoorController { |
|||
|
|||
@Autowired |
|||
private BackDoorService backDoorService; |
|||
|
|||
@PostMapping("backdoor") |
|||
public Object backDoor(@RequestHeader("Data-Type")String dataType, @RequestHeader("AppId")String appId, @RequestHeader("target")String target, @RequestBody(required = false) Object o){ |
|||
return backDoorService.backDoor(dataType,appId,target,o); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.datareport.service.backdoor; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/10/21 5:17 下午 |
|||
*/ |
|||
public interface BackDoorService { |
|||
|
|||
Object backDoor(String dataType, String appId, String target, Object o); |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.datareport.service.backdoor.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.HttpClientManager; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.datareport.constant.*; |
|||
import com.epmet.datareport.service.backdoor.BackDoorService; |
|||
import com.epmet.dto.result.AppIdInfoResultDTO; |
|||
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/10/21 5:17 下午 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class BackDoorServiceImpl implements BackDoorService { |
|||
|
|||
@Autowired |
|||
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|||
|
|||
@Override |
|||
public Object backDoor(String dataType, String appId, String target, Object o) { |
|||
Result<AppIdInfoResultDTO> appIdInfoResultDTOResult = commonServiceOpenFeignClient.appIdInfo(appId); |
|||
if (!appIdInfoResultDTOResult.success()){ |
|||
throw new RenException("获取accessToken失败......"); |
|||
} |
|||
AppIdInfoResultDTO data = appIdInfoResultDTOResult.getData(); |
|||
String url = FactConstant.URL.concat(target); |
|||
Map<String,String> headerMap = new HashMap<>(16); |
|||
headerMap.put("AccessToken",data.getAccessToken()); |
|||
headerMap.put("AppId",data.getAppId()); |
|||
headerMap.put("AuthType","jwt"); |
|||
headerMap.put("Data-Type",dataType); |
|||
Result<String> stringResult = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(o),headerMap); |
|||
log.info(JSON.toJSONString(stringResult)); |
|||
if (!stringResult.success()){ |
|||
throw new RenException("请求【"+url+"】失败......"+stringResult.error()); |
|||
} |
|||
JSONObject jsonObject = JSON.parseObject(stringResult.getData()); |
|||
return jsonObject; |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
package com.epmet.dto.indexcollect.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotEmpty; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 客户业务组织关系 入参 |
|||
*/ |
|||
@Data |
|||
public class CustomerBizOrgFormDTO implements Serializable { |
|||
|
|||
|
|||
/** |
|||
* 当为true时后台将删除本月数据 |
|||
*/ |
|||
@NotEmpty(message = "客户Id不能为空") |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 业务类型:智慧社区: community |
|||
*/ |
|||
@NotEmpty(message = "业务类型不能为空") |
|||
private String bizType; |
|||
} |
@ -0,0 +1,40 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.evaluationindex.screen; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; |
|||
import com.epmet.entity.evaluationindex.screen.ScreenCustomerBizOrgEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 组织机构信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-18 |
|||
*/ |
|||
@Mapper |
|||
public interface ScreenCustomerBizOrgDao extends BaseDao<ScreenCustomerBizOrgEntity> { |
|||
|
|||
int deleteByBizType(CustomerBizOrgFormDTO formDTO); |
|||
|
|||
int batchInsert(@Param("list") List<ScreenCustomerBizOrgEntity> list); |
|||
} |
@ -0,0 +1,52 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
package com.epmet.entity.evaluationindex.screen; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* 组织机构信息 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-08-21 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("screen_customer_biz_org") |
|||
public class ScreenCustomerBizOrgEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 业务类型 community:智慧社区 |
|||
*/ |
|||
private String bizType; |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.dao.evaluationindex.screen.ScreenCustomerBizOrgDao"> |
|||
<delete id="deleteByBizType"> |
|||
delete from screen_customer_biz_org |
|||
where CUSTOMER_ID = #{customerId} |
|||
and BIZ_TYPE = #{bizType,jdbcType=VARCHAR} |
|||
</delete> |
|||
<insert id="batchInsert"> |
|||
insert into screen_customer_biz_org |
|||
( |
|||
ID, |
|||
CUSTOMER_ID, |
|||
ORG_ID, |
|||
BIZ_TYPE, |
|||
DEL_FLAG, |
|||
REVISION, |
|||
CREATED_BY, |
|||
CREATED_TIME, |
|||
UPDATED_BY, |
|||
UPDATED_TIME |
|||
) values |
|||
<foreach collection="list" item="item" separator=","> |
|||
( |
|||
(SELECT REPLACE(UUID(), '-', '') AS id), |
|||
#{item.customerId}, |
|||
#{item.orgId}, |
|||
#{item.bizType}, |
|||
0, |
|||
0, |
|||
'APP_USER', |
|||
now(), |
|||
'APP_USER', |
|||
now() |
|||
) |
|||
</foreach> |
|||
</insert> |
|||
</mapper> |
@ -0,0 +1,13 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Data |
|||
public class GetJwtAccessTokenFormDTO { |
|||
|
|||
@NotBlank(message = "AppId不能为空") |
|||
private String appId; |
|||
|
|||
} |
@ -0,0 +1,32 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/10/21 5:30 下午 |
|||
*/ |
|||
@Data |
|||
public class AppIdInfoResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 4556971930323763712L; |
|||
|
|||
/** |
|||
* 应用ID |
|||
*/ |
|||
private String appId; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 密钥 |
|||
*/ |
|||
private String secret; |
|||
|
|||
private String accessToken; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class GetJwtAccessTokenResultDTO { |
|||
|
|||
private String customerId; |
|||
private String token; |
|||
private Long ts; |
|||
|
|||
} |
Loading…
Reference in new issue