type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
driver-class-name: com.mysql.cj.jdbc.Driver | driver-class-name: com.mysql.cj.jdbc.Driver | ||||
# 填写你数据库的url、登录名、密码和数据库名 | # 填写你数据库的url、登录名、密码和数据库名 | ||||
url: jdbc:mysql://192.168.11.242:3306/tuoheng_hhz?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||||
url: jdbc:mysql://rm-uf6z740323e8053pj.mysql.rds.aliyuncs.com:3306/tuoheng_hhz?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||||
username: root | username: root | ||||
password: idontcare | |||||
password: TH22#2022 | |||||
druid: | druid: | ||||
# 连接池的配置信息 | # 连接池的配置信息 | ||||
# 初始连接数 | # 初始连接数 | ||||
# 缓存库默认索引0 | # 缓存库默认索引0 | ||||
database: 0 | database: 0 | ||||
# Redis服务器地址 | # Redis服务器地址 | ||||
host: 192.168.11.242 | |||||
host: r-uf6cdzjifj20jszykr.redis.rds.aliyuncs.com | |||||
# Redis服务器连接端口 | # Redis服务器连接端口 | ||||
port: 6379 | port: 6379 | ||||
# Redis服务器连接密码(默认为空) | # Redis服务器连接密码(默认为空) |
package com.tuoheng.api.entity.domain; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.tuoheng.common.common.BaseEntity; | |||||
import lombok.Data; | |||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import java.io.Serializable; | |||||
/** | |||||
* <p> | |||||
* 企业管理表 | |||||
* </p> | |||||
* | |||||
* @author 拓恒 | |||||
* @since 2022-07-15 | |||||
*/ | |||||
@Data | |||||
@EqualsAndHashCode(callSuper = true) | |||||
@Accessors(chain = true) | |||||
@TableName("th_tenant") | |||||
public class Tenant extends BaseEntity implements Serializable { | |||||
private static final long serialVersionUID = 1L; | |||||
/** | |||||
* 租户名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 租户编号 | |||||
*/ | |||||
private String code; | |||||
/** | |||||
* 租户账号 | |||||
*/ | |||||
private String username; | |||||
/** | |||||
* 租户LOGO | |||||
*/ | |||||
private String logo; | |||||
/** | |||||
* 上级ID | |||||
*/ | |||||
private Integer pid; | |||||
/** | |||||
* 租户类型:1政府 2企业 3组织 | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 租户电话 | |||||
*/ | |||||
private String phone; | |||||
/** | |||||
* 租户邮箱 | |||||
*/ | |||||
private String email; | |||||
/** | |||||
* 省份编号 | |||||
*/ | |||||
private String provinceCode; | |||||
/** | |||||
* 省份名称 | |||||
*/ | |||||
private String provinceName; | |||||
/** | |||||
* 市区编号 | |||||
*/ | |||||
private String cityCode; | |||||
/** | |||||
* 市区名称 | |||||
*/ | |||||
private String cityName; | |||||
/** | |||||
* 区县编号 | |||||
*/ | |||||
private String districtCode; | |||||
/** | |||||
* 区县名称 | |||||
*/ | |||||
private String districtName; | |||||
/** | |||||
* 平台名称 | |||||
*/ | |||||
private String platformName; | |||||
/** | |||||
* 机场平台url | |||||
*/ | |||||
private String airportUrl; | |||||
/** | |||||
* 详细地址 | |||||
*/ | |||||
private String address; | |||||
/** | |||||
* 租户简介 | |||||
*/ | |||||
private String intro; | |||||
/** | |||||
* 状态:1正常 2禁用 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String note; | |||||
/** | |||||
* 排序号 | |||||
*/ | |||||
private Integer sort; | |||||
/** | |||||
* 租户头像url | |||||
*/ | |||||
private String portraitUrl; | |||||
private String password; | |||||
private Integer roleId; | |||||
} |
* 河道图片 | * 河道图片 | ||||
*/ | */ | ||||
private String streamImage; | private String streamImage; | ||||
/** | |||||
*手机号码 | |||||
*/ | |||||
private String phone; | |||||
} | } |
* 巡检河流数量 | * 巡检河流数量 | ||||
*/ | */ | ||||
private Integer streamGisNumber; | private Integer streamGisNumber; | ||||
/** | |||||
* 手机号码 | |||||
*/ | |||||
private String mobile; | |||||
} | } |
package com.tuoheng.api.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.api.entity.domain.Tenant; | |||||
/** | |||||
* <p> | |||||
* 企业管理表 Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author 拓恒 | |||||
* @since 2022-07-15 | |||||
*/ | |||||
public interface TenantMapper extends BaseMapper<Tenant> { | |||||
} |
package com.tuoheng.api.service; | |||||
import com.tuoheng.api.entity.domain.Tenant; | |||||
import com.tuoheng.common.common.IBaseService; | |||||
/** | |||||
* <p> | |||||
* 企业管理表 服务类 | |||||
* </p> | |||||
* | |||||
* @author 拓恒 | |||||
* @since 2022-07-15 | |||||
*/ | |||||
public interface ITenantService extends IBaseService<Tenant> { | |||||
} |
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.api.entity.domain.Feedback; | import com.tuoheng.api.entity.domain.Feedback; | ||||
import com.tuoheng.api.entity.domain.Stream; | import com.tuoheng.api.entity.domain.Stream; | ||||
import com.tuoheng.api.entity.domain.Tenant; | |||||
import com.tuoheng.api.entity.domain.User; | import com.tuoheng.api.entity.domain.User; | ||||
import com.tuoheng.api.entity.request.FeedbackQuery; | import com.tuoheng.api.entity.request.FeedbackQuery; | ||||
import com.tuoheng.api.mapper.FeedbackMapper; | import com.tuoheng.api.mapper.FeedbackMapper; | ||||
import com.tuoheng.api.mapper.StreamMapper; | import com.tuoheng.api.mapper.StreamMapper; | ||||
import com.tuoheng.api.mapper.TenantMapper; | |||||
import com.tuoheng.api.mapper.UserMapper; | import com.tuoheng.api.mapper.UserMapper; | ||||
import com.tuoheng.api.service.IFeedbackService; | import com.tuoheng.api.service.IFeedbackService; | ||||
import com.tuoheng.common.common.BaseServiceImpl; | import com.tuoheng.common.common.BaseServiceImpl; | ||||
@Autowired | @Autowired | ||||
private UserMapper userMapper; | private UserMapper userMapper; | ||||
@Autowired | |||||
private TenantMapper tenantMapper; | |||||
@Override | @Override | ||||
public JsonResult submit(Feedback feedback) { | public JsonResult submit(Feedback feedback) { | ||||
if(StringUtils.isEmpty(feedback.getOpenid())){ | |||||
if (StringUtils.isEmpty(feedback.getOpenid())) { | |||||
return JsonResult.error("openid为空"); | return JsonResult.error("openid为空"); | ||||
} | } | ||||
Stream stream = streamMapper.selectById(feedback.getStreamId()); | Stream stream = streamMapper.selectById(feedback.getStreamId()); | ||||
if(ObjectUtil.isNotNull(stream)){ | |||||
if (ObjectUtil.isNotNull(stream)) { | |||||
feedback.setTenantId(stream.getTenantId()); | feedback.setTenantId(stream.getTenantId()); | ||||
feedback.setStreamName(stream.getName()); | feedback.setStreamName(stream.getName()); | ||||
feedback.setStreamAdminId(stream.getStreamAdminId()); | feedback.setStreamAdminId(stream.getStreamAdminId()); | ||||
feedback.setStreamAdminName(stream.getStreamAdminName()); | feedback.setStreamAdminName(stream.getStreamAdminName()); | ||||
feedback.setType(1); | feedback.setType(1); | ||||
}else { | |||||
} else { | |||||
return JsonResult.error("河流信息不存在"); | return JsonResult.error("河流信息不存在"); | ||||
} | } | ||||
return super.add(feedback); | return super.add(feedback); | ||||
} | } | ||||
@Override | @Override | ||||
public JsonResult my(FeedbackQuery query) { | public JsonResult my(FeedbackQuery query) { | ||||
if(null == query.getPage() || null == query.getLimit()){ | |||||
if (null == query.getPage() || null == query.getLimit()) { | |||||
return JsonResult.error("分页数据为空"); | return JsonResult.error("分页数据为空"); | ||||
} | } | ||||
if(StringUtils.isEmpty(query.getOpenid())){ | |||||
if (StringUtils.isEmpty(query.getOpenid())) { | |||||
return JsonResult.error("openid为空"); | return JsonResult.error("openid为空"); | ||||
} | } | ||||
IPage<Feedback> pageData = feedbackMapper.selectPage(page, new LambdaQueryWrapper<Feedback>() | IPage<Feedback> pageData = feedbackMapper.selectPage(page, new LambdaQueryWrapper<Feedback>() | ||||
.eq(Feedback::getMark, 1) | .eq(Feedback::getMark, 1) | ||||
.eq(Feedback::getOpenid, query.getOpenid()) | .eq(Feedback::getOpenid, query.getOpenid()) | ||||
.eq(Feedback::getType,1) | |||||
.eq(Feedback::getType, 1) | |||||
.orderByDesc(Feedback::getCreateTime)); | .orderByDesc(Feedback::getCreateTime)); | ||||
pageData.getRecords().stream().map(vo -> { | pageData.getRecords().stream().map(vo -> { | ||||
Stream stream = streamMapper.selectById(vo.getStreamId()); | |||||
if(StringUtils.isNotNull(stream)){ | |||||
vo.setStreamImage(CommonUtils.getImageURL(stream.getImage())); | |||||
} | |||||
if (StringUtils.isNotNull(vo.getStatus())){ | |||||
if(vo.getStatus()==4){ | |||||
User user = userMapper.selectById(vo.getStreamAdminId()); | |||||
//判空 | |||||
if(StringUtils.isNull(user)){ | |||||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"当前反馈问题id"+vo.getId()+"查询不到对应责任河湖长"); | |||||
Stream stream = streamMapper.selectById(vo.getStreamId()); | |||||
if (StringUtils.isNotNull(stream)) { | |||||
vo.setStreamImage(CommonUtils.getImageURL(stream.getImage())); | |||||
} | } | ||||
vo.setRealname(user.getRealname()); | |||||
} | |||||
if(vo.getStatus()==3){ | |||||
User user = userMapper.selectById(Integer.parseInt(vo.getUpdateUser().toString())); | |||||
//判空 | |||||
if(StringUtils.isNull(user)){ | |||||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(),"当前反馈问题id"+vo.getId()+"查询不到对应责任河湖长"); | |||||
if (StringUtils.isNotNull(vo.getStatus())) { | |||||
if (vo.getStatus() == 4) { | |||||
User user = userMapper.selectById(vo.getStreamAdminId()); | |||||
//判空 | |||||
if (StringUtils.isNull(user)) { | |||||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "当前反馈问题id" + vo.getId() + "查询不到对应责任河湖长"); | |||||
} | |||||
vo.setRealname(user.getRealname()); | |||||
} | |||||
if (vo.getStatus() == 3) { | |||||
User user = userMapper.selectById(Integer.parseInt(vo.getUpdateUser().toString())); | |||||
//判空 | |||||
if (StringUtils.isNull(user)) { | |||||
Tenant tenant = tenantMapper.selectById(Integer.parseInt(vo.getUpdateUser().toString())); | |||||
vo.setRealname(tenant.getName()); | |||||
} else { | |||||
vo.setRealname(user.getRealname()); | |||||
} | |||||
} else if (vo.getStatus() == 1 || vo.getStatus() == 2) { | |||||
vo.setHandleTime(null); | |||||
} | |||||
} | } | ||||
vo.setRealname(user.getRealname()); | |||||
}else if(vo.getStatus()==1 || vo.getStatus()==2){ | |||||
vo.setHandleTime(null); | |||||
} | |||||
} | |||||
//反馈图片地址 | |||||
if(StringUtils.isNotEmpty(vo.getFeedbackUrl())){ | |||||
String[] feedbackUrls = vo.getFeedbackUrl().split(","); | |||||
if(StringUtils.isNotEmpty(feedbackUrls)){ | |||||
for (int i = 0; i < feedbackUrls.length; i++) { | |||||
if(StringUtils.isNotEmpty(feedbackUrls[i])){ | |||||
feedbackUrls[i] = CommonConfig.imageURL + feedbackUrls[i]; | |||||
//反馈图片地址 | |||||
if (StringUtils.isNotEmpty(vo.getFeedbackUrl())) { | |||||
String[] feedbackUrls = vo.getFeedbackUrl().split(","); | |||||
if (StringUtils.isNotEmpty(feedbackUrls)) { | |||||
for (int i = 0; i < feedbackUrls.length; i++) { | |||||
if (StringUtils.isNotEmpty(feedbackUrls[i])) { | |||||
feedbackUrls[i] = CommonConfig.imageURL + feedbackUrls[i]; | |||||
} | |||||
} | |||||
} | } | ||||
//反馈图片封面地址,取第一张图 | |||||
vo.setFeedbackCover(feedbackUrls[0]); | |||||
vo.setFeedbackUrl(StringUtils.join(feedbackUrls, ",")); | |||||
} | } | ||||
} | |||||
//反馈图片封面地址,取第一张图 | |||||
vo.setFeedbackCover(feedbackUrls[0]); | |||||
vo.setFeedbackUrl(StringUtils.join(feedbackUrls, ",")); | |||||
} | |||||
//处理图片地址 | |||||
if(StringUtils.isNotEmpty(vo.getHandleUrl())){ | |||||
String[] handleUrls = vo.getHandleUrl().split(","); | |||||
if(StringUtils.isNotEmpty(handleUrls)){ | |||||
for (int i = 0; i < handleUrls.length; i++) { | |||||
if(StringUtils.isNotEmpty(handleUrls[i])){ | |||||
handleUrls[i] = CommonConfig.imageURL + handleUrls[i]; | |||||
//处理图片地址 | |||||
if (StringUtils.isNotEmpty(vo.getHandleUrl())) { | |||||
String[] handleUrls = vo.getHandleUrl().split(","); | |||||
if (StringUtils.isNotEmpty(handleUrls)) { | |||||
for (int i = 0; i < handleUrls.length; i++) { | |||||
if (StringUtils.isNotEmpty(handleUrls[i])) { | |||||
handleUrls[i] = CommonConfig.imageURL + handleUrls[i]; | |||||
} | |||||
} | |||||
} | } | ||||
vo.setHandleUrl(StringUtils.join(handleUrls, ",")); | |||||
} | } | ||||
} | |||||
vo.setHandleUrl(StringUtils.join(handleUrls, ",")); | |||||
} | |||||
return vo; | |||||
return vo; | |||||
} | } | ||||
).collect(Collectors.toList()); | ).collect(Collectors.toList()); | ||||
return JsonResult.success(pageData); | return JsonResult.success(pageData); |
import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.api.entity.domain.Stream; | import com.tuoheng.api.entity.domain.Stream; | ||||
import com.tuoheng.api.entity.domain.User; | |||||
import com.tuoheng.api.entity.request.StreamQuery; | import com.tuoheng.api.entity.request.StreamQuery; | ||||
import com.tuoheng.api.entity.vo.CityInfoVo; | import com.tuoheng.api.entity.vo.CityInfoVo; | ||||
import com.tuoheng.api.entity.vo.StreamInfoVo; | import com.tuoheng.api.entity.vo.StreamInfoVo; | ||||
import com.tuoheng.api.mapper.StreamMapper; | import com.tuoheng.api.mapper.StreamMapper; | ||||
import com.tuoheng.api.mapper.UserMapper; | |||||
import com.tuoheng.api.service.ICityService; | import com.tuoheng.api.service.ICityService; | ||||
import com.tuoheng.api.service.IStreamService; | import com.tuoheng.api.service.IStreamService; | ||||
import com.tuoheng.common.common.BaseServiceImpl; | import com.tuoheng.common.common.BaseServiceImpl; | ||||
@Autowired | @Autowired | ||||
private ICityService cityService; | private ICityService cityService; | ||||
@Autowired | |||||
private UserMapper userMapper; | |||||
@Override | @Override | ||||
public JsonResult queryPage(StreamQuery query) { | public JsonResult queryPage(StreamQuery query) { | ||||
if (null == query.getPage() || null == query.getLimit()) { | if (null == query.getPage() || null == query.getLimit()) { | ||||
pageData.convert(x -> { | pageData.convert(x -> { | ||||
StreamInfoVo streamInfoVo = Convert.convert(StreamInfoVo.class, x); | StreamInfoVo streamInfoVo = Convert.convert(StreamInfoVo.class, x); | ||||
CityInfoVo cityInfoVo = null; | CityInfoVo cityInfoVo = null; | ||||
User user = userMapper.selectById(x.getStreamAdminId()); | |||||
if (null!=user) { | |||||
streamInfoVo.setMobile(user.getMobile()); | |||||
} | |||||
if (StringUtils.isNotEmpty(x.getVillageCode())) { | if (StringUtils.isNotEmpty(x.getVillageCode())) { | ||||
// 最后一级到村 | // 最后一级到村 | ||||
cityInfoVo = cityService.getCityInfoByCode(x.getVillageCode(), ""); | cityInfoVo = cityService.getCityInfoByCode(x.getVillageCode(), ""); |
package com.tuoheng.api.service.impl; | |||||
import com.tuoheng.api.entity.domain.Tenant; | |||||
import com.tuoheng.api.mapper.TenantMapper; | |||||
import com.tuoheng.api.service.ITenantService; | |||||
import com.tuoheng.common.common.BaseServiceImpl; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 企业管理表 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author 拓恒 | |||||
* @since 2022-07-15 | |||||
*/ | |||||
@Service | |||||
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService { | |||||
} |
type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
driver-class-name: com.mysql.cj.jdbc.Driver | driver-class-name: com.mysql.cj.jdbc.Driver | ||||
# 填写你数据库的url、登录名、密码和数据库名 | # 填写你数据库的url、登录名、密码和数据库名 | ||||
url: jdbc:mysql://192.168.11.242:3306/tuoheng_hhz?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||||
url: jdbc:mysql://rm-uf6z740323e8053pj.mysql.rds.aliyuncs.com:3306/tuoheng_hhz?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||||
username: root | username: root | ||||
password: idontcare | |||||
password: TH22#2022 | |||||
druid: | druid: | ||||
# 连接池的配置信息 | # 连接池的配置信息 | ||||
# 初始连接数 | # 初始连接数 | ||||
# 缓存库默认索引0 | # 缓存库默认索引0 | ||||
database: 0 | database: 0 | ||||
# Redis服务器地址 | # Redis服务器地址 | ||||
host: 192.168.11.242 | |||||
host: r-uf6cdzjifj20jszykr.redis.rds.aliyuncs.com | |||||
# Redis服务器连接端口 | # Redis服务器连接端口 | ||||
port: 6379 | port: 6379 | ||||
# Redis服务器连接密码(默认为空) | # Redis服务器连接密码(默认为空) |