Browse Source

修复相关代码提交

master
主管理员 4 days ago
parent
commit
11e5ce0a79
8 changed files with 103 additions and 4 deletions
  1. +40
    -0
      ruoyi-catdog/src/main/java/com/ruoyi/applet/contoller/ApiAppletAddressController.java
  2. +29
    -1
      ruoyi-catdog/src/main/java/com/ruoyi/applet/contoller/ApiAppletOutDateController.java
  3. +9
    -0
      ruoyi-catdog/src/main/java/com/ruoyi/model/domain/AppletAddress.java
  4. +7
    -0
      ruoyi-catdog/src/main/java/com/ruoyi/model/domain/AppletOutDate.java
  5. +4
    -0
      ruoyi-catdog/src/main/java/com/ruoyi/model/mapper/AppletOutDateMapper.java
  6. +1
    -0
      ruoyi-catdog/src/main/java/com/ruoyi/model/service/IAppletOutDateService.java
  7. +6
    -0
      ruoyi-catdog/src/main/java/com/ruoyi/model/service/impl/AppletOutDateServiceImpl.java
  8. +7
    -3
      ruoyi-catdog/src/main/resources/mapper/model/AppletAddressMapper.xml

+ 40
- 0
ruoyi-catdog/src/main/java/com/ruoyi/applet/contoller/ApiAppletAddressController.java View File

@ -7,6 +7,7 @@ import com.ruoyi.model.service.IAppletAddressService;
import com.ruoyi.model.service.IAppletOutDateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -19,15 +20,54 @@ public class ApiAppletAddressController {
@Autowired
private IAppletAddressService appletAddressService;
@Autowired
private IAppletOutDateService appletOutDateService;
@ApiOperation("地址-地址列表数据查询")
@GetMapping("/addressList")
public AjaxResult outDateList(AppletAddress appletAddress){
if(appletAddress.getUserId() == null){
return AjaxResult.error("用户标识不能为空");
}
List<AppletAddress> addressList = appletAddressService.selectAppletAddressList(appletAddress);
if(addressList.size()>0){
//如果地址信息不为空则循环设置不接单日期
for (AppletAddress appletAddress1 : addressList){
if(appletAddress1.getId() != null){
AppletOutDate appletOutDate = new AppletOutDate();
appletOutDate.setAddressId(appletAddress1.getId());
List<AppletOutDate> outDateList = appletOutDateService.selectAppletOutDateList(appletOutDate);
appletAddress1.setAppletOutDate(outDateList);
}
}
}
return AjaxResult.success("地址列表数据",addressList);
}
//跟胡地址标识查询地址详情
@ApiOperation("地址-地址详情查询")
@GetMapping("/addressDetail/{id}")
public AjaxResult addressDetail( AppletAddress appletAddress){
AppletAddress address = appletAddressService.selectAppletAddressById(appletAddress.getId());
if(address.getId() != null){
AppletOutDate appletOutDate = new AppletOutDate();
appletOutDate.setAddressId(address.getId());
List<AppletOutDate> outDateList = appletOutDateService.selectAppletOutDateList(appletOutDate);
address.setAppletOutDate(outDateList);
}
return AjaxResult.success("地址详情",address);
}
@ApiOperation("地址-地址添加")
@PostMapping("/insertAddress")
public AjaxResult insertOutDate(@RequestBody AppletAddress appletAddress){


+ 29
- 1
ruoyi-catdog/src/main/java/com/ruoyi/applet/contoller/ApiAppletOutDateController.java View File

@ -10,6 +10,9 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
@Api(description = "接单地址-不接单日期相关接口")
@ -30,7 +33,32 @@ public class ApiAppletOutDateController {
@ApiOperation("接单地址-不接单日期添加")
@PostMapping("/insertOutDate")
public AjaxResult insertOutDate(@RequestBody AppletOutDate appletOutDate){
return toAjax(appletOutDateService.insertAppletOutDate(appletOutDate));
//地址标识必须输入
if(appletOutDate.getAddressId() == null){
return AjaxResult.error("地址标识必须输入");
}
//删除之前的不接单日期信息
appletOutDateService.deleteAppletOutDateByIdList(appletOutDate.getAddressId());
// //不接单日期必须输入
// if(appletOutDate.getDataJson() == null){
// return AjaxResult.error("不接单日期必须输入");
// }
//得到不接单日期数据,用split截取批量增加
String[] split = appletOutDate.getDataJson().split(",");
for (int i = 0; i < split.length; i++) {
AppletOutDate appletOutDate1 = new AppletOutDate();
appletOutDate1.setAddressId(appletOutDate.getAddressId());
//把字符串2025-01-05转换为date类型
LocalDate localDate = LocalDate.parse(split[i]);
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
appletOutDate1.setDate(date); // 确保setDate接受Date类型
appletOutDateService.insertAppletOutDate(appletOutDate1);
}
return AjaxResult.success();
}
@ApiOperation("接单地址-不接单日期修改")


+ 9
- 0
ruoyi-catdog/src/main/java/com/ruoyi/model/domain/AppletAddress.java View File

@ -2,7 +2,9 @@ package com.ruoyi.model.domain;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -44,6 +46,13 @@ public class AppletAddress extends BaseEntity
private Long userId;
// 接单地址-不接单日期
@TableField(exist = false)
private List<AppletOutDate> appletOutDate;
/** 创建时间 */
private LocalDateTime createTime;


+ 7
- 0
ruoyi-catdog/src/main/java/com/ruoyi/model/domain/AppletOutDate.java View File

@ -1,7 +1,10 @@
package com.ruoyi.model.domain;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -13,6 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-03-28
*/
@Data
public class AppletOutDate extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -20,6 +24,9 @@ public class AppletOutDate extends BaseEntity
/** 唯一标识 */
private Long id;
@TableField(exist = false)
private String dataJson;
/** 日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")


+ 4
- 0
ruoyi-catdog/src/main/java/com/ruoyi/model/mapper/AppletOutDateMapper.java View File

@ -2,6 +2,7 @@ package com.ruoyi.model.mapper;
import java.util.List;
import com.ruoyi.model.domain.AppletOutDate;
import org.apache.ibatis.annotations.Delete;
/**
* 不接单日期Mapper接口
@ -58,4 +59,7 @@ public interface AppletOutDateMapper
* @return 结果
*/
public int deleteAppletOutDateByIds(Long[] ids);
@Delete("delete from applet_out_date where address_id=#{addressId}")
public int deleteAppletOutDateByIdList(Long addressId);
}

+ 1
- 0
ruoyi-catdog/src/main/java/com/ruoyi/model/service/IAppletOutDateService.java View File

@ -50,6 +50,7 @@ public interface IAppletOutDateService
* @return 结果
*/
public int deleteAppletOutDateByIds(Long[] ids);
public int deleteAppletOutDateByIdList(Long addressId);
/**
* 删除不接单日期信息


+ 6
- 0
ruoyi-catdog/src/main/java/com/ruoyi/model/service/impl/AppletOutDateServiceImpl.java View File

@ -82,6 +82,12 @@ public class AppletOutDateServiceImpl implements IAppletOutDateService
return appletOutDateMapper.deleteAppletOutDateByIds(ids);
}
@Override
public int deleteAppletOutDateByIdList(Long addressId){
return appletOutDateMapper.deleteAppletOutDateByIdList(addressId);
}
/**
* 删除不接单日期信息
*


+ 7
- 3
ruoyi-catdog/src/main/resources/mapper/model/AppletAddressMapper.xml View File

@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectAppletAddressVo">
select id, area, address, status, range_no, user_id, del_flag, create_by, create_time, update_by, update_time from applet_address </sql>
select id, area, address, status, range_no, user_id, del_flag, create_by, create_time, update_by, update_time, longitude, latitude from applet_address </sql>
<select id="selectAppletAddressList" parameterType="AppletAddress" resultMap="AppletAddressResult">
<include refid="selectAppletAddressVo"/>
@ -53,6 +53,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -67,7 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
</trim>
</insert>
@ -84,7 +87,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
</trim>
where id = #{id}
</update>


Loading…
Cancel
Save