添加服务指令接口

This commit is contained in:
yangjun 2025-03-31 16:49:41 +08:00
parent df164fdb69
commit 7985fac35f
6 changed files with 393 additions and 0 deletions

View File

@ -0,0 +1,134 @@
package com.nu.modules.NuBizNuCustomerServer.controller;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
import com.nu.modules.NuBizNuCustomerServer.entity.NuBizNuCustomerServer;
import com.nu.modules.NuBizNuCustomerServer.service.INuBizNuCustomerServerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
* @Description: 护理单元客户配置服务指令
* @Author: jeecg-boot
* @Date: 2025-03-31
* @Version: V1.0
*/
@Api(tags="护理单元客户配置服务指令")
@RestController
@RequestMapping("/nuIpadApi/nuBizNuCustomerServer")
@Slf4j
public class NuBizNuCustomerServerController extends JeecgController<NuBizNuCustomerServer, INuBizNuCustomerServerService> {
@Autowired
private INuBizNuCustomerServerService nuBizNuCustomerServerService;
/**
* 分页列表查询
*
* @param nuBizNuCustomerServer
* @return
*/
//@AutoLog(value = "护理单元客户配置服务指令-分页列表查询")
@ApiOperation(value="护理单元客户配置服务指令-分页列表查询", notes="护理单元客户配置服务指令-分页列表查询")
@GetMapping(value = "/getNclist")
public Result<List<Map<String,Object>>> getNclist(NuBizNuCustomerServer nuBizNuCustomerServer) {
List<Map<String,Object>> pageList = nuBizNuCustomerServerService.getNclist(nuBizNuCustomerServer);
return Result.OK(pageList);
}
/**
* 添加
*
* @param nuBizNuCustomerServer
* @return
*/
@AutoLog(value = "护理单元客户配置服务指令-添加")
@ApiOperation(value="护理单元客户配置服务指令-添加", notes="护理单元客户配置服务指令-添加")
// @RequiresPermissions("NuBizNuCustomerServer:nu_biz_nu_customer_server:add")
@PostMapping(value = "/addNuCustomerServer")
public Result<String> addNuCustomerServer(@RequestBody NuBizNuCustomerServer nuBizNuCustomerServer) {
nuBizNuCustomerServerService.save(nuBizNuCustomerServer);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param nuBizNuCustomerServer
* @return
*/
@AutoLog(value = "护理单元客户配置服务指令-编辑")
@ApiOperation(value="护理单元客户配置服务指令-编辑", notes="护理单元客户配置服务指令-编辑")
// @RequiresPermissions("NuBizNuCustomerServer:nu_biz_nu_customer_server:edit")
@RequestMapping(value = "/editNuCustomerServer", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> editNuCustomerServer(@RequestBody NuBizNuCustomerServer nuBizNuCustomerServer) {
nuBizNuCustomerServerService.updateById(nuBizNuCustomerServer);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "护理单元客户配置服务指令-通过id删除")
@ApiOperation(value="护理单元客户配置服务指令-通过id删除", notes="护理单元客户配置服务指令-通过id删除")
// @RequiresPermissions("NuBizNuCustomerServer:nu_biz_nu_customer_server:delete")
@DeleteMapping(value = "/deleteNuCustomerServer")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
nuBizNuCustomerServerService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "护理单元客户配置服务指令-通过id查询")
@ApiOperation(value="护理单元客户配置服务指令-通过id查询", notes="护理单元客户配置服务指令-通过id查询")
@GetMapping(value = "/queryById")
public Result<NuBizNuCustomerServer> queryById(@RequestParam(name="id",required=true) String id) {
NuBizNuCustomerServer nuBizNuCustomerServer = nuBizNuCustomerServerService.getById(id);
if(nuBizNuCustomerServer==null) {
return Result.error("未找到对应数据");
}
return Result.OK(nuBizNuCustomerServer);
}
}

View File

@ -0,0 +1,120 @@
package com.nu.modules.NuBizNuCustomerServer.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import org.jeecg.common.constant.ProvinceCityArea;
import org.jeecg.common.util.SpringContextUtils;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 护理单元客户配置服务指令
* @Author: jeecg-boot
* @Date: 2025-03-31
* @Version: V1.0
*/
@Data
@TableName("nu_biz_nu_customer_server")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="nu_biz_nu_customer_server对象", description="护理单元客户配置服务指令")
public class NuBizNuCustomerServer implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private java.lang.String id;
/**护理单元id*/
@Excel(name = "护理单元id", width = 15)
@ApiModelProperty(value = "护理单元id")
private java.lang.String nuId;
/**客户id*/
@Excel(name = "客户id", width = 15)
@ApiModelProperty(value = "客户id")
private java.lang.String customerId;
/**服务类别id*/
@Excel(name = "服务类别id", width = 15)
@ApiModelProperty(value = "服务类别id")
private java.lang.String categoryId;
/**服务类型id*/
@Excel(name = "服务类型id", width = 15)
@ApiModelProperty(value = "服务类型id")
private java.lang.String typeId;
/**服务指令id*/
@Excel(name = "服务指令id", width = 15)
@ApiModelProperty(value = "服务指令id")
private java.lang.String directiveId;
/**护理单元名称*/
@Excel(name = "护理单元名称", width = 15)
@ApiModelProperty(value = "护理单元名称")
private java.lang.String nuName;
/**客户姓名*/
@Excel(name = "客户姓名", width = 15)
@ApiModelProperty(value = "客户姓名")
private java.lang.String customerName;
/**服务类别名称*/
@Excel(name = "服务类别名称", width = 15)
@ApiModelProperty(value = "服务类别名称")
private java.lang.String categoryName;
/**服务类型名称*/
@Excel(name = "服务类型名称", width = 15)
@ApiModelProperty(value = "服务类型名称")
private java.lang.String typeName;
/**服务指令名称*/
@Excel(name = "服务指令名称", width = 15)
@ApiModelProperty(value = "服务指令名称")
private java.lang.String directiveName;
/**定位*/
@Excel(name = "定位", width = 15)
@ApiModelProperty(value = "定位")
private java.lang.String positioning;
/**服务标签名称*/
@Excel(name = "服务标签名称", width = 15)
@ApiModelProperty(value = "服务标签名称")
private java.lang.String tagName;
/**周期类型*/
@Excel(name = "周期类型", width = 15)
@ApiModelProperty(value = "周期类型")
private java.lang.String cycleType;
/**开始时间*/
@ApiModelProperty(value = "开始时间")
private java.lang.String startTime;
/**结束时间*/
@ApiModelProperty(value = "结束时间")
private java.lang.String endTime;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**所属部门*/
@ApiModelProperty(value = "所属部门")
private java.lang.String sysOrgCode;
}

View File

@ -0,0 +1,18 @@
package com.nu.modules.NuBizNuCustomerServer.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nu.modules.NuBizNuCustomerServer.entity.NuBizNuCustomerServer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 护理单元客户配置服务指令
* @Author: jeecg-boot
* @Date: 2025-03-31
* @Version: V1.0
*/
public interface NuBizNuCustomerServerMapper extends BaseMapper<NuBizNuCustomerServer> {
List<NuBizNuCustomerServer> getGroupPositioning(NuBizNuCustomerServer nuBizNuCustomerServer);
}

View File

@ -0,0 +1,8 @@
<?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="com.nu.modules.NuBizNuCustomerServer.mapper.NuBizNuCustomerServerMapper">
<select id="getGroupPositioning" resultType="com.nu.modules.NuBizNuCustomerServer.entity.NuBizNuCustomerServer">
</select>
</mapper>

View File

@ -0,0 +1,18 @@
package com.nu.modules.NuBizNuCustomerServer.service;
import com.nu.modules.NuBizNuCustomerServer.entity.NuBizNuCustomerServer;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* @Description: 护理单元客户配置服务指令
* @Author: jeecg-boot
* @Date: 2025-03-31
* @Version: V1.0
*/
public interface INuBizNuCustomerServerService extends IService<NuBizNuCustomerServer> {
List<Map<String,Object>> getNclist(NuBizNuCustomerServer nuBizNuCustomerServer);
}

View File

@ -0,0 +1,95 @@
package com.nu.modules.NuBizNuCustomerServer.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.nu.modules.NuBizNuCustomerServer.entity.NuBizNuCustomerServer;
import com.nu.modules.NuBizNuCustomerServer.mapper.NuBizNuCustomerServerMapper;
import com.nu.modules.NuBizNuCustomerServer.service.INuBizNuCustomerServerService;
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceCategory;
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceDirective;
import com.nu.modules.nuApiServiceCategory.entity.NuConfigServiceType;
import com.nu.modules.nuApiServiceCategory.service.INuConfigServiceCategoryService;
import com.nu.modules.nuApiServiceCategory.service.INuConfigServiceDirectiveService;
import com.nu.modules.nuApiServiceCategory.service.INuConfigServiceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.*;
/**
* @Description: 护理单元客户配置服务指令
* @Author: jeecg-boot
* @Date: 2025-03-31
* @Version: V1.0
*/
@Service
public class NuBizNuCustomerServerServiceImpl extends ServiceImpl<NuBizNuCustomerServerMapper, NuBizNuCustomerServer> implements INuBizNuCustomerServerService {
@Autowired
private INuConfigServiceCategoryService nuConfigServiceCategoryService;
@Autowired
private INuConfigServiceTypeService nuConfigServiceTypeService;
@Autowired
private INuConfigServiceDirectiveService nuConfigServiceDirectiveService;
@Override
public List<Map<String,Object>> getNclist(NuBizNuCustomerServer nuBizNuCustomerServer) {
QueryWrapper<NuBizNuCustomerServer> nuBizNuCustomerServerQueryWrapper = new QueryWrapper<>();
nuBizNuCustomerServerQueryWrapper.eq(StringUtils.isNotEmpty(nuBizNuCustomerServer.getNuId()),"nu_id",nuBizNuCustomerServer.getNuId());
nuBizNuCustomerServerQueryWrapper.eq(StringUtils.isNotEmpty(nuBizNuCustomerServer.getCustomerId()),"customer_id",nuBizNuCustomerServer.getCustomerId());
List<NuBizNuCustomerServer> groupList = baseMapper.selectList(nuBizNuCustomerServerQueryWrapper);
String groupPositioning[] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"};
List<Map<String,Object>> allList = new ArrayList<>();
for(String groupPositioning1 : groupPositioning){
Map<String,Object> posMap = new HashMap<>();
posMap.put("positioning",groupPositioning1);
List<Map<String,Object>> childrenList = new ArrayList<>();
for(NuBizNuCustomerServer par : groupList){
if(StringUtils.equals(groupPositioning1,par.getPositioning())){
Map<String,Object> map = new HashMap<>();
map.put("id",par.getId());
map.put("directiveName",par.getDirectiveName());
map.put("tagName",par.getTagName());
map.put("startTime",par.getStartTime());
map.put("endTime",par.getEndTime());
map.put("cycleType",par.getCycleType());
childrenList.add(map);
}
}
posMap.put("children",childrenList);
allList.add(posMap);
}
return allList;
}
@Override
public boolean save(NuBizNuCustomerServer nuBizNuCustomerServer) {
NuConfigServiceDirective nuConfigServiceDirective = nuConfigServiceDirectiveService.getById(nuBizNuCustomerServer.getDirectiveId());
NuConfigServiceCategory nuConfigServiceCategory = nuConfigServiceCategoryService.getById(nuConfigServiceDirective.getCategoryId());
NuConfigServiceType nuConfigServiceType = nuConfigServiceTypeService.getById(nuConfigServiceDirective.getTypeId());
nuBizNuCustomerServer.setCategoryId(nuConfigServiceCategory.getId());
nuBizNuCustomerServer.setCategoryName(nuConfigServiceCategory.getCategoryName());
nuBizNuCustomerServer.setTypeId(nuConfigServiceType.getId());
nuBizNuCustomerServer.setTypeName(nuConfigServiceType.getTypeName());
baseMapper.insert(nuBizNuCustomerServer);
return true;
}
@Override
public boolean updateById(NuBizNuCustomerServer nuBizNuCustomerServer) {
NuConfigServiceDirective nuConfigServiceDirective = nuConfigServiceDirectiveService.getById(nuBizNuCustomerServer.getDirectiveId());
NuConfigServiceCategory nuConfigServiceCategory = nuConfigServiceCategoryService.getById(nuConfigServiceDirective.getCategoryId());
NuConfigServiceType nuConfigServiceType = nuConfigServiceTypeService.getById(nuConfigServiceDirective.getTypeId());
nuBizNuCustomerServer.setCategoryId(nuConfigServiceCategory.getId());
nuBizNuCustomerServer.setCategoryName(nuConfigServiceCategory.getCategoryName());
nuBizNuCustomerServer.setTypeId(nuConfigServiceType.getId());
nuBizNuCustomerServer.setTypeName(nuConfigServiceType.getTypeName());
baseMapper.updateById(nuBizNuCustomerServer);
return true;
}
}