zhizhi wu 5 years ago
parent
commit
e1b7d6accd
  1. 1
      .gitignore
  2. 2
      health/src/main/java/com/ccsens/health/api/AbnormalController.java
  3. 1
      health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java
  4. 2
      health/src/main/java/com/ccsens/health/bean/dto/UserDto.java
  5. 14
      health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java
  6. 1
      health/src/main/java/com/ccsens/health/persist/dao/HealthAbnormalDao.java
  7. 13
      health/src/main/java/com/ccsens/health/service/AbnormalService.java
  8. 2
      health/src/main/java/com/ccsens/health/service/IAbnormalService.java
  9. 34
      health/src/main/resources/mapper_dao/HealthAbnormalDao.xml
  10. 1
      tall/src/main/java/com/ccsens/tall/config/SpringConfig.java
  11. 2
      tall/src/main/java/com/ccsens/tall/service/IUserService.java
  12. 29
      tall/src/main/java/com/ccsens/tall/service/UserService.java
  13. 12
      tall/src/main/java/com/ccsens/tall/web/UserController.java

1
.gitignore

@ -40,3 +40,4 @@ gen
hs_err_pid*
mbg.xml
resources/mbg.xml
resources/application.yml

2
health/src/main/java/com/ccsens/health/api/AbnormalController.java

@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@Api(tags = "打卡签到相关" , description = "")
@Api(tags = "异常人员相关" , description = "")
@RestController
@RequestMapping("/abnormal")
public class AbnormalController {

1
health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java

@ -2,7 +2,6 @@ package com.ccsens.health.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import javax.validation.constraints.NotNull;

2
health/src/main/java/com/ccsens/health/bean/dto/UserDto.java

@ -34,5 +34,7 @@ public class UserDto {
private String startTime;
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty("是否是搜索界面 0搜索界面 1全局概览")
private int search;
}
}

14
health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java

@ -1,5 +1,6 @@
package com.ccsens.health.bean.vo;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -18,9 +19,20 @@ public class AbnormalVo {
@ApiModelProperty("异常状态名称")
private String abnormalName;
@ApiModelProperty("异常状态code")
private String code;
private Integer code;
@ApiModelProperty("数量")
private Long number;
public String getAbnormalName(){
switch (code){
case 0: abnormalName = "健康"; break;
case 1: abnormalName = "治愈"; break;
case 2: abnormalName = "隔离"; break;
case 3: abnormalName = "疑似"; break;
case 4: abnormalName = "确诊"; break;
default:abnormalName = null;
}
return null;
}
}
@Data

1
health/src/main/java/com/ccsens/health/persist/dao/HealthAbnormalDao.java

@ -13,4 +13,5 @@ import java.util.List;
public interface HealthAbnormalDao extends HealthAbnormalMapper {
List<AbnormalVo.AbnormalStatisticsVo> getAbnormalList(@Param("post") Integer post, @Param("department")String department, @Param("healthType")Integer healthType);
List<AbnormalVo.AbnormalOverview> abnormalOverview(@Param("department")String department, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
}

13
health/src/main/java/com/ccsens/health/service/AbnormalService.java

@ -5,10 +5,12 @@ import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.ccsens.health.bean.dto.AbnormalDto;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.po.HealthAbnormal;
import com.ccsens.health.bean.vo.AbnormalVo;
import com.ccsens.health.persist.dao.HealthAbnormalDao;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.DateUtil;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import com.github.pagehelper.PageHelper;
@ -18,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Slf4j
@ -35,9 +38,15 @@ public class AbnormalService implements IAbnormalService{
* @return
*/
@Override
public List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params) {
public List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params) throws Exception {
AbnormalDto.SelectAbnormal selectAbnormal = params.getParam();
// Long startTime = selectAbnormal.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectAbnormal.getStartTime();
// Long endTime = selectAbnormal.getEndTime() == null ? System.currentTimeMillis() : selectAbnormal.getEndTime();
return null;
List<AbnormalVo.AbnormalOverview> abnormalOverviewList =
healthAbnormalDao.abnormalOverview(selectAbnormal.getDepartment(),selectAbnormal.getStartTime(),selectAbnormal.getEndTime());
return abnormalOverviewList;
}
/**

2
health/src/main/java/com/ccsens/health/service/IAbnormalService.java

@ -7,7 +7,7 @@ import com.ccsens.util.bean.dto.QueryDto;
import java.util.List;
public interface IAbnormalService {
List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params);
List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params) throws Exception;
void addAbnormal(QueryDto<AbnormalDto.AddAbnormal> params);

34
health/src/main/resources/mapper_dao/HealthAbnormalDao.xml

@ -14,6 +14,11 @@
<result column="endTime" property="endTime"/>
</resultMap>
<resultMap id="resultMap_abnormal_overview" type="com.ccsens.health.bean.vo.AbnormalVo$AbnormalOverview">
<result column="code" property="code"/>
<result column="number" property="number"/>
</resultMap>
<select id="getAbnormalList" resultMap="resultMap_abnormal_statistics" parameterType="java.util.Map">
select
a.id as id,
@ -46,4 +51,33 @@
a.health_status = #{healthType}
</if>
</select>
<select id="abnormalOverview" resultMap="resultMap_abnormal_statistics" parameterType="java.util.Map">
SELECT
a.health_status as code,
count(*) as number
FROM
t_health_abnormal a join (
SELECT
ha.health_status as h_status
FROM
t_health_abnormal ha LEFT JOIN t_member m on ha.wkno = m.wkno
WHERE
ha.rec_status = 0
<if test="department != null">
and
m.department = #{department}
</if>
<if test="endTime != null">
and
ha.start_time &lt;= #{endTime}
</if>
<if test="startTime != null">
and
ha.end_time &gt;= #{startTime}
</if>
) h on a.health_status = h.h_status
GROUP BY a.health_status
</select>
</mapper>

1
tall/src/main/java/com/ccsens/tall/config/SpringConfig.java

@ -143,6 +143,7 @@ public class SpringConfig implements WebMvcConfigurer {
.excludePathPatterns("/users/member")
.excludePathPatterns("/users/allMemberAll")
.excludePathPatterns("/users/userId")
.excludePathPatterns("/users/mergeUserId")
.addPathPatterns("/plugins/**")
.excludePathPatterns("/plugins/sign")
.excludePathPatterns("/plugins/fuzzy")

2
tall/src/main/java/com/ccsens/tall/service/IUserService.java

@ -74,4 +74,6 @@ public interface IUserService {
UserVo.UserSign changePhoneNotPassword(Long userId,UserDto.WxBindingPhone phoneInfo) throws Exception;
UserVo.TokenBean getTokenByUserId(Long userId);
void mergeUserId(Long userId, Long uselessId);
}

29
tall/src/main/java/com/ccsens/tall/service/UserService.java

@ -1244,6 +1244,35 @@ public class UserService implements IUserService {
sysBalanceLogDao.insertSelective(balanceLog);
}
/**
* 输入两个userid合并账号
*/
@Override
public void mergeUserId(Long userId, Long uselessId) {
SysUser user = userDao.selectByPrimaryKey(userId);
SysUser uselessUser = userDao.selectByPrimaryKey(userId);
if(ObjectUtil.isNull(user) || ObjectUtil.isNull(uselessUser)){
throw new BaseException(CodeEnum.NOT_MEMBER);
}
userDao.replaceAuth(userId, uselessId);
//查询所有关联userId的数据库表 auth表 attention表 balance表 project表 member表 DeliverPostLog表 proLog表
//依次将查出的数据的旧userId 替换成新的userId
userDao.replaceAttention(userId, uselessId);
userDao.replaceBalance(userId, uselessId);
userDao.replaceProject(userId, uselessId);
userDao.replaceMember(userId, uselessId);
userDao.replaceDeliverPostLog(userId, uselessId);
userDao.replaceProLog(userId, uselessId);
//将以前的余额添加至此账号
SysUser oldUser = userDao.selectByPrimaryKey(userId);
SysUser newUser = userDao.selectByPrimaryKey(uselessId);
updateBalance(oldUser, newUser);
//将以前的user删除
oldUser.setRecStatus((byte) 2);
userDao.updateByPrimaryKeySelective(oldUser);
}
/**
* 修改用户信息添加微信信息
*

12
tall/src/main/java/com/ccsens/tall/web/UserController.java

@ -302,6 +302,18 @@ public class UserController {
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "输入两个userid将两个账号合并(保留企业用户的id)",notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name="userId",value = "需要保留的userId",required = true,paramType = "query"),
@ApiImplicitParam(name="uselessId",value = "不需要保留的userId",required = true,paramType = "query")
})
@RequestMapping(value = "/mergeUserId",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
public JsonResponse mergeUserId(HttpServletRequest request,
@RequestParam(required = true) Long userId,Long uselessId) throws Exception {
userService.mergeUserId(userId,uselessId);
return JsonResponse.newInstance().ok();
}
@ApiOperation(value = "通过userId获取token",notes = "")
@ApiImplicitParams({

Loading…
Cancel
Save