Browse Source

Merge remote-tracking branch 'origin/dev'

master
yinzuomei 5 years ago
parent
commit
42109cd5cd
  1. 1
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java
  2. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java
  3. 31
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java
  4. 26
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java
  5. 5
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java
  6. 7
      epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java
  7. 26
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java
  8. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java
  9. 10
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java
  10. 18
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java
  11. 14
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java
  12. 163
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java
  13. 6
      epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml

1
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java

@ -181,6 +181,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService {
rank.setResolvedRatio(convertPercentStr(o.getResolvedRatio(),NumConstant.ONE));
rank.setResponseRatio(convertPercentStr(o.getResponseRatio(),NumConstant.ONE));
rank.setSatisfactionRatio(convertPercentStr(o.getSatisfactionRatio(),NumConstant.ONE));
rank.setParentAgencyName(o.getParentAgencyName());
result.add(rank);
});
return result;

5
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java

@ -48,4 +48,9 @@ public class AddTemplateFormDTO implements Serializable {
* 关键字名称
*/
private List<String> nameList;
/**
* 是否同步到所有客户
*/
private Boolean isSync = true;
}

31
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/1/11 14:53
*/
@NoArgsConstructor
@Data
public class DelPersonalTempFormDTO implements Serializable {
private static final long serialVersionUID = -1445036628319660147L;
/**
* 客户ID
*/
private String customerId;
/**
* 所属端 居民端resi 工作端work
*/
private String clientType;
/**
* 模板id
*/
private List<String> tempIdList;
}

26
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhaoqifeng
* @dscription
* @date 2021/1/11 14:47
*/
@NoArgsConstructor
@Data
public class InitAllFormDTO implements Serializable {
private static final long serialVersionUID = 5198153778356904936L;
/**
* 测试号APPID
*/
private String appId;
/**
* 模板ID
*/
private String tempId;
}

5
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java

@ -36,4 +36,9 @@ public class InitFormDTO implements Serializable {
* 工作端需要同步的模板id数组
*/
private List<String> workTempIdList;
/**
* 1 已同步0 未同步
*/
private String sync;
}

7
epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java

@ -17,9 +17,14 @@ public class TemplateDTO implements Serializable {
*/
private String id;
/**
* 模板ID
* 公共模板ID
*/
private String tmplId;
private String personalId;
/**
* 客户模板ID
*/
private String personalTempId;
/**
* 标题
*/

26
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java

@ -146,4 +146,30 @@ public class SubscribeController {
CustomerTempResultDTO result = subscribeService.getCustomerTemplate(formDTO);
return new Result<CustomerTempResultDTO>().ok(result);
}
/**
* 同步单一模板到所有客户
* @author zhaoqifeng
* @date 2021/1/11 14:49
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("initall")
public Result initAll(@RequestBody InitAllFormDTO formDTO) {
subscribeService.initAll(formDTO);
return new Result();
}
/**
* 删除客户模板
* @author zhaoqifeng
* @date 2021/1/11 14:54
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("delpersonaltemp")
public Result delPersonalTemp(@RequestBody DelPersonalTempFormDTO formDTO) {
subscribeService.delPersonalTemp(formDTO);
return new Result();
}
}

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java

@ -105,4 +105,6 @@ public interface PersonalTemplateDao extends BaseDao<PersonalTemplateEntity> {
List<PersonalTemplateDTO> selectListByKey(@Param("appId") String appId, @Param("tid") String tid, @Param("keyIds") String keyIds);
List<TemplateListV2ResultDTO> selectTemplateListV2(TemplateListV2FormDTO formDTO);
PersonalTemplateDTO getTempByPid();
}

10
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java

@ -156,4 +156,14 @@ public interface PersonalTemplateService extends BaseService<PersonalTemplateEnt
List<PersonalTemplateDTO> getListByKey(String appId, String tid, String keyIds);
List<TemplateListV2ResultDTO> templateListV2(TemplateListV2FormDTO formDTO);
/**
* 获取个人模板
* @author zhaoqifeng
* @date 2021/1/11 15:32
* @param customerId
* @param pid
* @return com.epmet.dto.PersonalTemplateDTO
*/
PersonalTemplateDTO getTempByPid(String customerId, String pid);
}

18
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java

@ -102,4 +102,22 @@ public interface SubscribeService {
*/
CustomerTempResultDTO getCustomerTemplate(InitFormDTO formDTO);
/**
* 同步单一模板到所有客户
* @author zhaoqifeng
* @date 2021/1/11 14:49
* @param formDTO
* @return void
*/
void initAll(InitAllFormDTO formDTO);
/**
* 删除客户模板
* @author zhaoqifeng
* @date 2021/1/11 14:54
* @param formDTO
* @return void
*/
void delPersonalTemp(DelPersonalTempFormDTO formDTO);
}

14
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java

@ -165,4 +165,18 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl<PersonalTemplat
public List<TemplateListV2ResultDTO> templateListV2(TemplateListV2FormDTO formDTO) {
return baseDao.selectTemplateListV2(formDTO);
}
/**
* 获取个人模板
*
* @param customerId
* @param pid
* @return com.epmet.dto.PersonalTemplateDTO
* @author zhaoqifeng
* @date 2021/1/11 15:32
*/
@Override
public PersonalTemplateDTO getTempByPid(String customerId, String pid) {
return baseDao.selectSetTemp(customerId, pid);
}
}

163
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java

@ -199,44 +199,46 @@ public class SubscribeServiceImpl implements SubscribeService {
personalTemplateDTO.setKeyWords(keywords);
personalTemplateDTO.setType(formDTO.getType());
personalTemplateService.save(personalTemplateDTO);
//获取客户列表
List<PaCustomerDTO> customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId());
List<String> customerNames = new ArrayList<>();
if (null != customerList && customerList.size() > NumConstant.ZERO) {
for (PaCustomerDTO paCustomerDTO : customerList) {
//获取小程序调用令牌
AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType());
if (null == authDTO) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权");
customerNames.add(paCustomerDTO.getCustomerName());
continue;
}
WxResult<String> wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request);
if (!wxResult1.success()) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg());
customerNames.add(paCustomerDTO.getCustomerName());
continue;
if (formDTO.getIsSync()) {
//获取客户列表
List<PaCustomerDTO> customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId());
List<String> customerNames = new ArrayList<>();
if (null != customerList && customerList.size() > NumConstant.ZERO) {
for (PaCustomerDTO paCustomerDTO : customerList) {
//获取小程序调用令牌
AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType());
if (null == authDTO) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权");
customerNames.add(paCustomerDTO.getCustomerName());
continue;
}
WxResult<String> wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request);
if (!wxResult1.success()) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg());
customerNames.add(paCustomerDTO.getCustomerName());
continue;
}
String tmplId = wxResult1.getData();
PersonalTemplateDTO templateDTO = new PersonalTemplateDTO();
templateDTO.setCustomerId(paCustomerDTO.getId());
templateDTO.setClientType(authInfo.getClientType());
templateDTO.setAppId(authDTO.getAuthorizerAppid());
templateDTO.setPid(priTmplId);
templateDTO.setPriTmplId(tmplId);
templateDTO.setTid(formDTO.getTid());
templateDTO.setKeyIds(keyIds);
templateDTO.setTitle(formDTO.getTitle());
templateDTO.setSceneDesc(formDTO.getSceneDesc());
templateDTO.setKeyWords(keywords);
templateDTO.setType(formDTO.getType());
personalTemplateService.save(templateDTO);
}
String tmplId = wxResult1.getData();
PersonalTemplateDTO templateDTO = new PersonalTemplateDTO();
templateDTO.setCustomerId(paCustomerDTO.getId());
templateDTO.setClientType(authInfo.getClientType());
templateDTO.setAppId(authDTO.getAuthorizerAppid());
templateDTO.setPid(priTmplId);
templateDTO.setPriTmplId(tmplId);
templateDTO.setTid(formDTO.getTid());
templateDTO.setKeyIds(keyIds);
templateDTO.setTitle(formDTO.getTitle());
templateDTO.setSceneDesc(formDTO.getSceneDesc());
templateDTO.setKeyWords(keywords);
templateDTO.setType(formDTO.getType());
personalTemplateService.save(templateDTO);
}
}
if (customerNames.size() > NumConstant.ZERO) {
String names = String.join(",", customerNames);
throw new RenException("客户[" + names + "]添加模板失败");
if (customerNames.size() > NumConstant.ZERO) {
String names = String.join(",", customerNames);
throw new RenException("客户[" + names + "]添加模板失败");
}
}
}
@ -348,7 +350,6 @@ public class SubscribeServiceImpl implements SubscribeService {
log.error("居民端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg());
}
});
resultDTO.setResiList(resiList);
AuthorizationInfoDTO workAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "work");
if (null == workAuthDTO) {
@ -371,10 +372,100 @@ public class SubscribeServiceImpl implements SubscribeService {
log.error("工作端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg());
}
});
// resultDTO.setResiList(resiList.stream().filter(item -> formDTO.getSync().equals(item.getState())).collect(Collectors.toList()));
// resultDTO.setWorkList(workList.stream().filter(item -> formDTO.getSync().equals(item.getState())).collect(Collectors.toList()));
resultDTO.setResiList(resiList);
resultDTO.setWorkList(workList);
return resultDTO;
}
/**
* 同步单一模板到所有客户
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/1/11 14:49
*/
@Override
public void initAll(InitAllFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId());
PersonalTemplateDTO publicDTO = personalTemplateService.get(formDTO.getTempId());
//获取客户列表
List<PaCustomerDTO> customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId());
List<String> customerNames = new ArrayList<>();
if (null != customerList && customerList.size() > NumConstant.ZERO) {
for (PaCustomerDTO paCustomerDTO : customerList) {
PersonalTemplateDTO personalTemplateDTO = personalTemplateService.getTempByPid(paCustomerDTO.getId(), publicDTO.getPriTmplId());
if (null != personalTemplateDTO) {
//获取小程序调用令牌
AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType());
List<String> keyIds = Arrays.asList(publicDTO.getKeyIds().split(","));
List<Integer> keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList());
WxAddTemplateReq request = new WxAddTemplateReq();
request.setTid(publicDTO.getTid());
request.setKidList(keyIdList);
request.setSceneDesc(publicDTO.getSceneDesc());
WxResult<String> wxResult = wxMaSubscribeService.addTemplate(authInfo.getAuthorizerAccessToken(), request);
if (null == authDTO) {
log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权");
customerNames.add(paCustomerDTO.getCustomerName());
continue;
}
String tmplId = wxResult.getData();
PersonalTemplateDTO templateDTO = new PersonalTemplateDTO();
templateDTO.setCustomerId(paCustomerDTO.getId());
templateDTO.setClientType(authInfo.getClientType());
templateDTO.setAppId(authDTO.getAuthorizerAppid());
templateDTO.setPid(publicDTO.getPriTmplId());
templateDTO.setPriTmplId(tmplId);
templateDTO.setTid(publicDTO.getTid());
templateDTO.setKeyIds(publicDTO.getKeyIds());
templateDTO.setTitle(publicDTO.getTitle());
templateDTO.setSceneDesc(publicDTO.getSceneDesc());
templateDTO.setKeyWords(publicDTO.getKeyWords());
templateDTO.setType(publicDTO.getType());
personalTemplateService.save(templateDTO);
}
}
}
if (customerNames.size() > NumConstant.ZERO) {
String names = String.join(",", customerNames);
log.error("客户[" + names + "]添加模板失败");
}
}
/**
* 删除客户模板
*
* @param formDTO
* @return void
* @author zhaoqifeng
* @date 2021/1/11 14:54
*/
@Override
public void delPersonalTemp(DelPersonalTempFormDTO formDTO) {
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType());
if (null == authInfo) {
throw new RenException("未授权或token已过期");
}
formDTO.getTempIdList().forEach(tempId -> {
PersonalTemplateDTO dto = personalTemplateService.get(tempId);
WxDelTemplateReq request = new WxDelTemplateReq();
request.setPriTmplId(dto.getPriTmplId());
WxResult wxResult = wxMaSubscribeService.delTemplate(authInfo.getAuthorizerAccessToken(), request);
if (!wxResult.success()) {
throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg());
}
personalTemplateService.deleteById(dto.getId());
});
}
private WxGetCategoryResult getCategoryResult(String accessToken) {
WxResult<WxGetCategoryResult> wxResult = wxMaSubscribeService.getCategory(accessToken);

6
epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml

@ -49,13 +49,16 @@
SELECT
t1.ID AS id,
t1.PRI_TMPL_ID AS tmplId,
IFNULL(t2.ID, '') AS personalId,
IFNULL(t2.PRI_TMPL_ID, '') AS personalTempId,
t1.TITLE AS title,
IF(ISNULL(t2.ID),'0','1') AS state
FROM
(SELECT
ID,
TITLE,
PRI_TMPL_ID
PRI_TMPL_ID,
CREATED_TIME
FROM
personal_template
WHERE
@ -74,6 +77,7 @@
AND CUSTOMER_ID = #{customerId}
AND CLIENT_TYPE = #{clientType}) t2
ON t1.PRI_TMPL_ID = t2.PID
ORDER BY t1.CREATED_TIME DESC
</select>
<select id="selectTemplateList" resultType="com.epmet.dto.result.GetTemplateListResultDTO">

Loading…
Cancel
Save