|
|
@ -37,17 +37,22 @@ import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.UserAdviceConstant; |
|
|
|
import com.epmet.dao.UserAdviceDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.CustomerDTO; |
|
|
|
import com.epmet.dto.UserAdviceDTO; |
|
|
|
import com.epmet.dto.form.AdviceListFormDTO; |
|
|
|
import com.epmet.dto.form.ReplyAdviceFormDTO; |
|
|
|
import com.epmet.dto.result.AdviceDetailResultDTO; |
|
|
|
import com.epmet.dto.result.AdviceListResultDTO; |
|
|
|
import com.epmet.dto.result.MyAdviceListResultDTO; |
|
|
|
import com.epmet.dto.form.SubmitAdviceFormDTO; |
|
|
|
import com.epmet.dto.form.UserResiInfoFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.UserAdviceEntity; |
|
|
|
import com.epmet.entity.UserAdviceImgEntity; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.feign.OperCrmOpenFeignClient; |
|
|
|
import com.epmet.redis.UserAdviceRedis; |
|
|
|
import com.epmet.service.UserAdviceImgService; |
|
|
|
import com.epmet.service.UserAdviceService; |
|
|
|
import com.epmet.service.UserResiInfoService; |
|
|
|
import io.jsonwebtoken.lang.Collections; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
@ -76,6 +81,15 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd |
|
|
|
@Autowired |
|
|
|
private UserAdviceImgService userAdviceImgService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OperCrmOpenFeignClient operCrmOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserResiInfoService userResiInfoService; |
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
@ -293,6 +307,85 @@ public class UserAdviceServiceImpl extends BaseServiceImpl<UserAdviceDao, UserAd |
|
|
|
return baseDao.myAdviceList(pageSize, pageNo, loginUserId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param dto |
|
|
|
* @param loginUserId |
|
|
|
* @return void |
|
|
|
* @Description 居民端-回复建议 |
|
|
|
* @Author liushaowen |
|
|
|
* @Date 2020/11/10 10:57 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void submitAdvice(SubmitAdviceFormDTO dto, String loginUserId) { |
|
|
|
//审核图片文字
|
|
|
|
auditText(dto.getAdviceContent()); |
|
|
|
auditPic(dto.getImgList()); |
|
|
|
UserAdviceDTO userAdviceDTO = new UserAdviceDTO(); |
|
|
|
BeanUtils.copyProperties(dto,userAdviceDTO); |
|
|
|
|
|
|
|
//获取customerName
|
|
|
|
CustomerDTO customerDTO = new CustomerDTO(); |
|
|
|
customerDTO.setId(dto.getCustomerId()); |
|
|
|
Result<CustomerDTO> customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); |
|
|
|
if (customerInfo.success()){ |
|
|
|
userAdviceDTO.setCustomerName(customerInfo.getData().getCustomerName()); |
|
|
|
}else { |
|
|
|
logger.error("customerId:{},获取customerName失败",dto.getCustomerId()); |
|
|
|
} |
|
|
|
//获取gridName,agencyId
|
|
|
|
Result<GridInfoResultDTO> gridInfoResultDTOResult = govOrgOpenFeignClient.queryGridInfo(dto.getGridId()); |
|
|
|
if (gridInfoResultDTOResult.success()){ |
|
|
|
userAdviceDTO.setGridName(gridInfoResultDTOResult.getData().getGridName()); |
|
|
|
userAdviceDTO.setAgencyId(gridInfoResultDTOResult.getData().getParentAgencyId()); |
|
|
|
//获取agencyName
|
|
|
|
Result<CustomerAgencyDTO> agencyById = govOrgOpenFeignClient.getAgencyById(gridInfoResultDTOResult.getData().getParentAgencyId()); |
|
|
|
if (agencyById.success()){ |
|
|
|
userAdviceDTO.setAgencyName(agencyById.getData().getAllParentName()); |
|
|
|
}else { |
|
|
|
logger.error("agencyId:{},获取组织详情失败",gridInfoResultDTOResult.getData().getParentAgencyId()); |
|
|
|
} |
|
|
|
}else { |
|
|
|
logger.error("gridId:{},获取网格详情失败",dto.getGridId()); |
|
|
|
} |
|
|
|
|
|
|
|
//获取userName,regPhone
|
|
|
|
UserResiInfoFormDTO userResiInfoFormDTO = new UserResiInfoFormDTO(); |
|
|
|
userResiInfoFormDTO.setUserId(loginUserId); |
|
|
|
userResiInfoFormDTO.setCustomerId(dto.getCustomerId()); |
|
|
|
Result<UserResiInfoResultDTO> userResiInfoDTO = userResiInfoService.getUserResiInfoDTO(userResiInfoFormDTO); |
|
|
|
if (userResiInfoDTO.success()){ |
|
|
|
userAdviceDTO.setUserId(loginUserId); |
|
|
|
userAdviceDTO.setUserName(userResiInfoDTO.getData().getSurname()+userResiInfoDTO.getData().getName()); |
|
|
|
userAdviceDTO.setRegPhone(userResiInfoDTO.getData().getRegMobile()); |
|
|
|
}else { |
|
|
|
logger.error("userId:{},获取user注册信息失败",loginUserId); |
|
|
|
} |
|
|
|
//设置AdviceTime
|
|
|
|
userAdviceDTO.setAdviceTime(new Date()); |
|
|
|
//设置adviceType
|
|
|
|
if (StringUtils.isBlank(dto.getAdviceType())){ |
|
|
|
userAdviceDTO.setAdviceType("*"); |
|
|
|
} |
|
|
|
baseDao.saveUserAdvice(userAdviceDTO); |
|
|
|
//如果imgList不为空,插入advice_img表
|
|
|
|
List<String> govImgList = dto.getImgList(); |
|
|
|
if (!Collections.isEmpty(govImgList)) { |
|
|
|
List<UserAdviceImgEntity> userAdviceImgEntities = new ArrayList<>(); |
|
|
|
for (int i = 0; i < govImgList.size(); i++) { |
|
|
|
//最多存三张图片
|
|
|
|
if (i == 3) { |
|
|
|
break; |
|
|
|
} |
|
|
|
UserAdviceImgEntity entity = new UserAdviceImgEntity(); |
|
|
|
entity.setImgUrl(govImgList.get(i)); |
|
|
|
entity.setAdviceId(userAdviceDTO.getId()); |
|
|
|
entity.setType("resi"); |
|
|
|
userAdviceImgEntities.add(entity); |
|
|
|
} |
|
|
|
userAdviceImgService.insertBatch(userAdviceImgEntities); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void auditText(String text) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|