This commit is contained in:
xiaofajia 2024-10-10 09:14:34 +08:00
commit 8fdede5a19
21 changed files with 462 additions and 37 deletions

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.app.service;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
/**
* @author vinjor-m
* @description 维修模块微信登录逻辑
**/
public interface WechatLoginService {
/**
* 维修系统-微信授权登录-未注册自动注册
* @author vinjor-M
* @date 15:14 2024/10/9
* @param decryptResult TODO
* @param openId TODO
* @param inviteId TODO
* @return cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
**/
AdminUserDO wechatLogin(String decryptResult,String openId,String inviteId);
}

View File

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 维修记录 管理 API
* @author lzt
*/
@Tag(name = "管理后台 - 维修记录")
@RestController
@RequestMapping("/dl/repair-records")
@Validated
public class RepairRecordsController {
@Resource
private RepairRecordsService repairRecordsService;
@PostMapping("/create")
@Operation(summary = "创建维修记录")
public CommonResult<String> createRepairRecords(@Valid @RequestBody RepairRecordsSaveReqVO createReqVO) {
return success(repairRecordsService.createRepairRecords(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修记录")
public CommonResult<Boolean> updateRepairRecords(@Valid @RequestBody RepairRecordsSaveReqVO updateReqVO) {
repairRecordsService.updateRepairRecords(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修记录")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteRepairRecords(@RequestParam("id") String id) {
repairRecordsService.deleteRepairRecords(id);
return success(true);
}
// @GetMapping("/get")
// @Operation(summary = "获得维修记录")
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
// public CommonResult<RepairRecordsRespVO> getRecords(@RequestParam("id") String id) {
// RepairRecords records = repairRecordsService.getRepairRecords(id);
// return success(BeanUtils.toBean(records, RepairRecordsRespVO.class));
// }
/**
* 维修工查询维修记录
* @param pageReqVO 维修工分页查询条件
*
*/
@GetMapping("/page")
@Operation(summary = "获得维修记录分页")
public List<RepairRecordsRespVO> queryAllRepairRecords(@RequestBody RepairRecordsPageReqVO pageReqVO) {
return repairRecordsService.queryAllRepairRecords(pageReqVO);
}
}

View File

@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 维修工人")
@ -31,19 +34,30 @@ public class RepairWorkerController {
@Resource
private RepairWorkerService workerService;
/**
* 批量创建维修工人
* @author PQZ
* @date 18:32 2024/10/9
* @param userList 选中的用户集合
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.String>
**/
@PostMapping("/create")
@Operation(summary = "创建维修工人")
public CommonResult<String> createWorker(@Valid @RequestBody RepairWorkerSaveReqVO createReqVO) {
return success(workerService.createWorker(createReqVO));
public CommonResult<Boolean> createWorker(@RequestBody List<UserDTO> userList) {
workerService.saveWorkers(userList);
return success(true);
}
@PutMapping("/update")
@Operation(summary = "更新维修工人")
public CommonResult<Boolean> updateWorker(@Valid @RequestBody RepairWorkerSaveReqVO updateReqVO) {
public CommonResult<Boolean> updateWorker(@RequestBody RepairWorkerSaveReqVO updateReqVO) {
workerService.updateWorker(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修工人")
@Parameter(name = "id", description = "编号", required = true)

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.base.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 维修记录 DO
*
* @author lzt
*/
@TableName("dl_repair_records")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RepairRecords extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 工单id
*/
private String ticketId;
/**
* 工单子表id
*/
private String repairTitemId;
/**
* 记录类型repair_records_type
*/
private String type;
/**
* 记录描述
*/
private String remark;
/**
* 过程记录中的图片多个拼接
*/
private String image;
/**
* 处理人
*/
private String dealUserName;
/**
* 处理人员工表id
*/
private String dealUserId;
}

View File

@ -28,7 +28,7 @@ public class RepairWorker extends TenantBaseDO {
/**
* 用户id
*/
private String userId;
private Long userId;
/**
* 维修工人名称
*/

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.base.mapper;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 维修记录 Mapper
*
* @author lzt
*/
@Mapper
public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
/**
* 查询维修记录
* @author lzt
* @param entity 查询条件
* @return List<RepairRecordsRespVO>
* @date 2024年10月9日
*/
List<RepairRecordsRespVO> queryAllRepairRecords(@Param("entity") RepairRecordsPageReqVO entity);
}

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.util.List;
/**
* 维修记录 Service 接口
*
* @author lzt
*/
public interface RepairRecordsService extends IService<RepairRecords> {
/**
* 创建维修记录
*
* @param createReqVO 创建信息
* @return 编号
*/
String createRepairRecords(@Valid RepairRecordsSaveReqVO createReqVO);
/**
* 更新维修记录
*
* @param updateReqVO 更新信息
*/
void updateRepairRecords(@Valid RepairRecordsSaveReqVO updateReqVO);
/**
* 删除维修记录
*
* @param id 编号
*/
void deleteRepairRecords(String id);
// /**
// * 获得维修记录
// *
// * @param id 编号
// * @return 维修记录
// */
// RepairRecords getRepairRecords(String id);
/**
* 获得维修记录
*
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
*/
List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO);
}

View File

@ -1,17 +1,16 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
import java.util.List;
/**
* 维修工人 Service 接口
@ -20,13 +19,14 @@ import javax.validation.Valid;
*/
public interface RepairWorkerService extends IService<RepairWorker> {
/**
* 创建维修工人
*
* @param createReqVO 创建信息
* @return 编号
*/
String createWorker(@Valid RepairWorkerSaveReqVO createReqVO);
* 批量创建维修工人
* @author PQZ
* @date 18:33 2024/10/9
* @param userList 选中用户集合
**/
void saveWorkers(List<UserDTO> userList);
/**
* 更新维修工人
@ -60,4 +60,4 @@ public interface RepairWorkerService extends IService<RepairWorker> {
**/
IPage<RepairWorkerRespVO> queryListPage(RepairWorkerPageReqVO pageReqVO, Page<RepairWorkerRespVO> page);
}
}

View File

@ -0,0 +1,73 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsSaveReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
/**
* 维修记录 Service 实现类
*
* @author lzt
*/
@Service
@Validated
public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, RepairRecords> implements RepairRecordsService {
@Resource
private RepairRecordsMapper repairRecordsMapper;
@Override
public String createRepairRecords(RepairRecordsSaveReqVO createReqVO) {
// 插入
RepairRecords records = BeanUtils.toBean(createReqVO, RepairRecords.class);
repairRecordsMapper.insert(records);
// 返回
return records.getId();
}
@Override
public void updateRepairRecords(RepairRecordsSaveReqVO updateReqVO) {
// 更新
RepairRecords updateObj = BeanUtils.toBean(updateReqVO, RepairRecords.class);
repairRecordsMapper.updateById(updateObj);
}
@Override
public void deleteRepairRecords(String id) {
// 删除
repairRecordsMapper.deleteById(id);
}
// @Override
// public RepairRecords getRepairRecords(String id) {
// return repairRecordsMapper.selectById(id);
// }
/**
* 查询维修记录
* @apiNote lzt
* @param pageReqVO 查询条件
* @return queryAllRepairRecords 所有维修记录
* @date
*/
@Override
public List<RepairRecordsRespVO> queryAllRepairRecords(RepairRecordsPageReqVO pageReqVO) {
return repairRecordsMapper.queryAllRepairRecords(pageReqVO);
}
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
@ -7,6 +8,7 @@ import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -14,6 +16,8 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 维修工人 Service 实现类
@ -27,13 +31,26 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
@Resource
private RepairWorkerMapper workerMapper;
/**
* 批量创建维修工人
*
* @param userList 选中用户集合
* @author PQZ
* @date 18:33 2024/10/9
**/
@Override
public String createWorker(RepairWorkerSaveReqVO createReqVO) {
// 插入
RepairWorker worker = BeanUtils.toBean(createReqVO, RepairWorker.class);
workerMapper.insert(worker);
// 返回
return worker.getId();
public void saveWorkers(List<UserDTO> userList) {
if (CollectionUtil.isNotEmpty(userList)){
List<RepairWorker> saveList = new ArrayList<>();
userList.forEach(item -> {
RepairWorker worker = new RepairWorker();
worker.setUserId(item.getId());
worker.setUserName(item.getNickname());
saveList.add(worker);
});
saveBatch(saveList);
}
}
@Override

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "接受维修记录的分页查询参数")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RepairRecordsPageReqVO extends RepairRecords {
}

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 维修记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class RepairRecordsRespVO extends RepairRecords {
}

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 维修记录新增/修改 Request VO")
@Data
public class RepairRecordsSaveReqVO extends RepairRecords {
}

View File

@ -6,11 +6,11 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "接受页查询参数")
@Schema(description = "接受查询参数")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RepairWorkerPageReqVO extends RepairWorker {
}
}

View File

@ -1,10 +1,9 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import com.alibaba.excel.annotation.*;
import lombok.Data;
@Schema(description = "管理后台 - 维修工人 Response VO")
@Data
@ -13,4 +12,4 @@ public class RepairWorkerRespVO extends RepairWorker {
}
}

View File

@ -2,14 +2,10 @@ package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import lombok.Data;
@Schema(description = "管理后台 - 维修工人新增/修改 Request VO")
@Data
public class RepairWorkerSaveReqVO extends RepairWorker {
}
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryAllRepairRecords" resultType="cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO">
SELECT *
FROM dl_repair_records
<where>
<if test="entity.someField != null">
AND some_column = #{entity.someField}
</if>
</where>
</select>
</mapper>

View File

@ -21,7 +21,11 @@
<if test="entity.userName != null and entity.userName != ''">
and main.user_name = #{entity.userName}
</if>
<if test="entity.workType != null and entity.workType != ''">
and main.work_type = #{entity.workType}
</if>
</where>
order by main.create_time desc
</select>
</mapper>

View File

@ -432,12 +432,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
//如果查不到则新增查到了则更新
UserSaveReqVO user = new UserSaveReqVO();
if (wxUser == null) {
// 新增
// 直接新注册一个账号
user.setUsername(phoneNumber);
user.setNickname(phoneNumber);
user.setMobile(phoneNumber);
user.setPassword(passwordEncoder.encode("123456"));
user.setRepairOpenId(openId);
//TODO 客户后期没有租户ID
user.setTenantId(180L);
if (null!=inviteId){
//绑定上级
@ -453,7 +454,6 @@ public class AdminAuthServiceImpl implements AdminAuthService {
}else {
//更新
user.setId(wxUser.getId());
user.setNickname(phoneNumber);
user.setRepairOpenId(openId);
if (ObjectUtil.isEmpty(user.getInviteId())){
if (null!=inviteId){

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
"avatar": "",
"version": "4.9.2",
"createdTime": "2024-10-9 10:34:15",
"updatedTime": "2024-10-9 13:49:58",
"updatedTime": "2024-10-9 17:32:50",
"dbConns": [],
"profile": {
"default": {
@ -683,7 +683,7 @@
"optionsFetcher": ""
}
},
"menuWidth": "297px"
"menuWidth": "266px"
},
"entities": [
{
@ -24096,6 +24096,24 @@
"uiHint": "642D2E0A-8846-4549-BE56-8C0473F26EDE",
"baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64"
},
{
"defKey": "cus_can_read",
"defName": "配件清单客户是否可见",
"comment": "",
"type": "",
"len": "",
"scale": "",
"primaryKey": false,
"notNull": false,
"autoIncrement": false,
"defaultValue": "",
"hideInGraph": false,
"refDict": "FA7F294D-D46F-470F-B159-8730EB858893",
"baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
"extProps": {},
"domain": "6F7C1C5C-D159-41E6-BF9D-54DEEFA79AFF",
"id": "116FC04F-0B4C-4599-80B8-D27093B67B14"
},
{
"defKey": "tenant_id",
"defName": "租户号",
@ -24352,7 +24370,8 @@
"type": "P",
"sysProps": {
"nameTemplate": "{defKey}[{defName}]"
}
},
"notes": {}
},
{
"id": "341FA654-5D25-48C9-B558-C0C0CF2C7877",