Commit 50ad4dfa authored by lisong's avatar lisong

更新

parent 95bdca29
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
......@@ -45,5 +45,5 @@ public class TzsUserQualificationsDto extends BaseDto {
private String file;
@ApiModelProperty(value = "用户信息id")
private String userId;
private String userInfoId;
}
......@@ -44,7 +44,7 @@ public class TzsUserInfo extends BaseEntity {
* 性别
*/
@TableField("gender")
private Integer gender;
private String gender;
/**
* 岗位
......
......@@ -65,6 +65,6 @@ public class TzsUserQualifications extends BaseEntity {
/**
* 用户信息id
*/
@TableField("user_id")
private String userId;
@TableField("user_info_id")
private String userInfoId;
}
......@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
Page<TzsUserInfoDto> selectPageMessage (@Param("page") Page<TzsUserInfoDto> page, @Param("dto") TzsUserInfoDto dto);
}
......@@ -3,9 +3,20 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserQualificationsDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserQualifications;
import java.util.List;
import java.util.Map;
public interface ITzsUserInfoService extends IService<TzsUserInfo> {
Page<TzsUserInfoDto> page (TzsUserInfoDto dto, Page<TzsUserInfoDto> page);
void addQualificationsMessage(String userId, List<TzsUserQualifications> list);
void deleteBatch (List<Long> ids);
Map<String, Object> getDetail(Long id);
}
package com.yeejoin.amos.boot.module.tzs.api.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class TzsUserInfoVo {
/**
* 姓名
*/
@TableField("name")
private String name;
/**
* 证件类型
*/
@TableField("certificate_type")
private String certificateType;
/**
* 证件编号
*/
@TableField("certificate_num")
private String certificateNum;
/**
* 性别
*/
@TableField("gender")
private String gender;
/**
* 岗位
*/
@TableField("post")
private String post;
/**
* 联系电话
*/
@TableField("phone")
private String phone;
/**
* 出生日期
*/
@TableField("birthday")
private Date birthday;
/**
* 学历
*/
@TableField("education")
private String education;
/**
* 专业
*/
@TableField("speciality")
private String speciality;
/**
* 邮箱
*/
@TableField("email")
private String email;
/**
* 住址
*/
@TableField("address")
private String address;
/**
* 证件照片
*/
@TableField(value = "identification")
private List identification;
/**
* 账户名
*/
@TableField("amos_user_name")
private String amosUserName;
/**
* 单位名称
*/
@TableField("unit_name")
private String unitName;
/**
* 头像
*/
@TableField(value = "profile")
private List profile;
/**
* 平台账号id
*/
@TableField("amos_user_id")
private String amosUserId;
}
package com.yeejoin.amos.boot.module.tzs.api.vo;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 用户资质信息
*/
@Data
public class TzsUserQualificationsVo extends BaseDto {
@ApiModelProperty(value = "证书类型")
private String certificateType;
@ApiModelProperty(value = "证书编号")
private String certificateNum;
@ApiModelProperty(value = "发证机关")
private String issuingUnit;
@ApiModelProperty(value = "作业项目id")
private String projectId;
@ApiModelProperty(value = "发证日志")
private Date issuingDate;
@ApiModelProperty(value = "有效期")
private String expirationDate;
@ApiModelProperty(value = "附件")
private List file;
@ApiModelProperty(value = "用户信息id")
private String userInfoId;
}
......@@ -4,6 +4,7 @@
<select id="selectPageMessage" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserInfoDto">
SELECT
sequence_nbr ,
name,
certificate_type,
certificate_num,
......@@ -21,6 +22,7 @@
FROM
tzs_user_info
<where>
is_delete = false
<if test="dto.name != '' and dto.name != null">
and name like concat('%',#{dto.name},'%')
</if>
......
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserQualifications;
import com.yeejoin.amos.boot.module.tzs.api.service.ITzsUserInfoService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsUserInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import liquibase.pro.packaged.A;
import liquibase.pro.packaged.O;
import liquibase.pro.packaged.S;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "用户信息Api")
@RequestMapping(value = "/userInfo")
......@@ -30,9 +44,34 @@ public class TzsUserInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增人员信息", notes = "新增人员信息")
public ResponseModel<TzsUserInfoDto> save(@RequestBody TzsUserInfoDto model) {
model = tzsUserInfoServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
public ResponseModel<TzsUserInfoDto> save(@RequestBody JSONObject map) {
Object userInfo = map.get("userInfo");
TzsUserInfoDto tzsUserInfo = JSON.parseObject(JSON.toJSONString(userInfo), TzsUserInfoDto.class);
Map<String, Object> qualificationsInfo = (Map<String, Object>)map.get("qualificationsInfo");
Object subForm = qualificationsInfo.get("subForm");
List<TzsUserQualifications> list = JSON.parseArray(JSON.toJSONString(subForm), TzsUserQualifications.class);
tzsUserInfo = tzsUserInfoServiceImpl.createWithModel(tzsUserInfo);
tzsUserInfoService.addQualificationsMessage(String.valueOf(tzsUserInfo.getSequenceNbr()),list);
return ResponseHelper.buildResponse(tzsUserInfo);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/deleteBatch")
@ApiOperation(httpMethod = "POST", value = "批量删除", notes = "批量删除")
public ResponseModel<Object> deleteBatch(@RequestBody JSONObject map) {
List<Long> ids = (List<Long>) map.get("ids");
tzsUserInfoService.deleteBatch(ids);
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getDetail")
@ApiOperation(httpMethod = "GET", value = "详情", notes = "详情")
public ResponseModel<Map<String, Object>> queryForPage(@RequestParam(value = "id") Long id) {
return ResponseHelper.buildResponse(tzsUserInfoService.getDetail(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.TzsUserQualificationsDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsUserQualifications;
import com.yeejoin.amos.boot.module.tzs.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.boot.module.tzs.api.mapper.TzsUserQualificationsMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.ITzsUserInfoService;
import com.yeejoin.amos.boot.module.tzs.api.vo.TzsUserInfoVo;
import com.yeejoin.amos.boot.module.tzs.api.vo.TzsUserQualificationsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserInfo, TzsUserInfoMapper> implements ITzsUserInfoService {
@Autowired
private TzsUserInfoMapper tzsUserInfoMapper;
@Autowired
private TzsUserQualificationsServiceImpl tzsUserQualificationsService;
@Override
public Page<TzsUserInfoDto> page(TzsUserInfoDto dto, Page<TzsUserInfoDto> page) {
return tzsUserInfoMapper.selectPageMessage(page,dto);
}
@Override
public void addQualificationsMessage(String userId, List<TzsUserQualifications> list) {
list.forEach(item -> {
item.setUserInfoId(userId);
});
tzsUserQualificationsService.saveOrUpdateBatch(list);
}
@Override
public void deleteBatch(List<Long> ids) {
LambdaQueryWrapper<TzsUserInfo> lambda = new QueryWrapper<TzsUserInfo>().lambda();
lambda.in(TzsUserInfo::getSequenceNbr, ids);
TzsUserInfo tzsUserInfo = new TzsUserInfo();
tzsUserInfo.setIsDelete(true);
tzsUserInfoMapper.update(tzsUserInfo, lambda);
LambdaQueryWrapper<TzsUserQualifications> qualificationsLambda = new QueryWrapper<TzsUserQualifications>().lambda();
qualificationsLambda.in(TzsUserQualifications::getUserInfoId, ids);
TzsUserQualifications tzsUserQualifications = new TzsUserQualifications();
tzsUserQualifications.setIsDelete(true);
tzsUserQualificationsService.update(tzsUserQualifications, qualificationsLambda);
}
@Override
public Map<String, Object> getDetail(Long id) {
Map<String, Object> maps = new HashMap<>();
TzsUserInfo tzsUserInfo = tzsUserInfoMapper.selectById(id);
TzsUserInfoVo tzsUserInfoVo = new TzsUserInfoVo();
BeanUtils.copyProperties(tzsUserInfo, tzsUserInfoVo, "identification","profile");
tzsUserInfoVo.setIdentification(ObjectUtils.isEmpty(tzsUserInfo.getIdentification()) ? new ArrayList() : JSON.parseArray(tzsUserInfo.getIdentification()));
tzsUserInfoVo.setProfile(ObjectUtils.isEmpty(tzsUserInfo.getProfile()) ? new ArrayList() : JSON.parseArray(tzsUserInfo.getProfile()));
maps.put("userInfo", tzsUserInfoVo);
LambdaQueryWrapper<TzsUserQualifications> lambda = new QueryWrapper<TzsUserQualifications>().lambda();
lambda.eq(TzsUserQualifications::getUserInfoId, id);
ArrayList<TzsUserQualificationsVo> tzsUserQualificationsVos = new ArrayList<>();
List<TzsUserQualifications> list = tzsUserQualificationsService.getBaseMapper().selectList(lambda);
list.forEach(item ->{
TzsUserQualificationsVo vo = new TzsUserQualificationsVo();
BeanUtils.copyProperties(item, vo,"file");
vo.setFile(ObjectUtils.isEmpty(item.getFile()) ? new ArrayList() : JSON.parseArray(item.getFile()));
tzsUserQualificationsVos.add(vo);
});
HashMap<String, Object> map2 = new HashMap<>();
map2.put("subForm", tzsUserQualificationsVos);
maps.put("qualificationsInfo",map2);
return maps;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment