ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorController.java
@@ -74,8 +74,8 @@ */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "证件、荣誉、资质记录", businessType = BusinessType.EXPORT) @PostMapping("/export/{ids}") public void export(HttpServletResponse response,@PathVariable Long[] ids) @PostMapping(value = {"/export/{ids}","/export"}) public void export(HttpServletResponse response,@PathVariable(required = false) Long[] ids) { List<ZHonor> list = zHonorService.selectByIds(ids); log.info("导出记录为:{}",list); ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java
@@ -15,6 +15,7 @@ import com.ruoyi.domain.dto.EmpowerDto; import com.ruoyi.domain.dto.Genealogy; import com.ruoyi.domain.dto.GenealogyExportDto; import com.ruoyi.domain.dto.RelationDto; import com.ruoyi.service.ZInfoUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; @@ -153,15 +154,12 @@ */ @GetMapping("/relation") public AjaxResult listMyRelation() { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); return zInfoUserService.searchMyRelation(userId); return zInfoUserService.searchMyRelation(); } @PostMapping("/relation") public AjaxResult addRelation(@RequestBody ZfRelation zfRelation){ return zInfoUserService.addRelation(zfRelation); } @PutMapping("/relation") ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelBaseController.java
@@ -1,9 +1,27 @@ package com.ruoyi.web.controller.zhang; import org.springframework.web.bind.annotation.RequestMapping; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZTravelBase; import com.ruoyi.service.ZTravelBaseService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.Collections; import java.util.List; import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; /** * <p> @@ -15,7 +33,98 @@ */ @RestController @RequestMapping("/zTravelBase") public class ZTravelBaseController { @Slf4j public class ZTravelBaseController extends BaseController { @Autowired private ZTravelBaseService zTravelBaseService; /** * 查询所有记录 */ @GetMapping("/all") public AjaxResult listAll(String fid,ZTravelBase zTravelBase){ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return zTravelBaseService.selectDataList(fid, zTravelBase,pageNum,pageSize); } /** * 根据id查询 */ @GetMapping("/{id}") public AjaxResult listById(@PathVariable Long id){ return AjaxResult.success(zTravelBaseService.getById(id)); } /** * 模板 */ @GetMapping("/model") public void getModel(HttpServletResponse response){ ZTravelBase zTravelBase = new ZTravelBase(); List<ZTravelBase> emptyList = Collections.singletonList(zTravelBase); ExcelUtil<ZTravelBase> util = new ExcelUtil<>(ZTravelBase.class); util.exportExcel(response, emptyList, "旅游基本信息记录数据"); } /** * 导出旅游基本信息记录列表 */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "旅游基本信息记录", businessType = BusinessType.EXPORT) @PostMapping("/export/{ids}") public void export(HttpServletResponse response,@PathVariable Long[] ids) { List<ZTravelBase> list = zTravelBaseService.selectByIds(ids); log.info("导出记录为:{}",list); ExcelUtil<ZTravelBase> util = new ExcelUtil<>(ZTravelBase.class); util.exportExcel(response, list, "旅游基本信息记录数据"); } /** * 导入旅游基本信息记录列表 */ @Log(title = "用户管理", businessType = BusinessType.IMPORT) @PostMapping("/importData") public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception { return zTravelBaseService.importExcel(file); } /** * 新增旅游基本信息记录 */ // @PreAuthorize("@ss.hasPermi('system:property:add')") @Log(title = "旅游基本信息记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody ZTravelBase zTravelBase) { return zTravelBaseService.mySave(zTravelBase); } /** * 修改旅游基本信息记录 */ // @PreAuthorize("@ss.hasPermi('system:property:edit')") @Log(title = "旅游基本信息记录", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody ZTravelBase zTravelBase) { return toAjax(zTravelBaseService.updateById(zTravelBase)); } // /** * 批量删除旅游基本信息记录 */ // @PreAuthorize("@ss.hasPermi('system:property:remove')") @Log(title = "旅游基本信息记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(zTravelBaseService.removeByIds(Arrays.asList(ids))); } } ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZTravelPriceController.java
@@ -1,9 +1,28 @@ package com.ruoyi.web.controller.zhang; import org.springframework.web.bind.annotation.RequestMapping; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.dto.PriceDto; import com.ruoyi.service.ZTravelPriceService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.Collections; import java.util.List; import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM; import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE; /** * <p> @@ -15,7 +34,97 @@ */ @RestController @RequestMapping("/zTravelPrice") public class ZTravelPriceController { @Slf4j public class ZTravelPriceController extends BaseController { @Autowired private ZTravelPriceService zTravelPriceService; /** * 查询所有记录 */ @GetMapping("/all") public AjaxResult listAll(ZTravelPrice zTravelPrice){ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return zTravelPriceService.selectDataList(zTravelPrice,pageNum,pageSize); } /** * 根据id查询 */ @GetMapping() public AjaxResult listById(Long id){ return AjaxResult.success(zTravelPriceService.getById(id)); } /** * 模板 */ @GetMapping("/model") public void getModel(HttpServletResponse response){ ZTravelPrice zTravelPrice = new ZTravelPrice(); List<ZTravelPrice> emptyList = Collections.singletonList(zTravelPrice); ExcelUtil<ZTravelPrice> util = new ExcelUtil<>(ZTravelPrice.class); util.exportExcel(response, emptyList, "旅游费用记录数据"); } /** * 导出旅游费用记录列表 */ // @PreAuthorize("@ss.hasPermi('system:property:export')") @Log(title = "旅游费用记录", businessType = BusinessType.EXPORT) @PostMapping("/export/{ids}") public void export(HttpServletResponse response,@PathVariable Long[] ids) { List<ZTravelPrice> list = zTravelPriceService.selectByIds(ids); log.info("导出记录为:{}",list); ExcelUtil<ZTravelPrice> util = new ExcelUtil<>(ZTravelPrice.class); util.exportExcel(response, list, "旅游费用记录数据"); } // /** // * 导入旅游费用记录列表 // */ // @Log(title = "用户管理", businessType = BusinessType.IMPORT) // @PostMapping("/importData") // public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception // { // return zTravelPriceService.importExcel(file); // } /** * 新增旅游费用记录 */ // @PreAuthorize("@ss.hasPermi('system:property:add')") @Log(title = "旅游费用记录", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody PriceDto priceDto) { return zTravelPriceService.mySave(priceDto); } /** * 修改旅游费用记录 */ // @PreAuthorize("@ss.hasPermi('system:property:edit')") @Log(title = "旅游费用记录", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody PriceDto priceDto) { return zTravelPriceService.myUpdate(priceDto); } // /** * 批量删除旅游费用记录 */ // @PreAuthorize("@ss.hasPermi('system:property:remove')") @Log(title = "旅游费用记录", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) { return zTravelPriceService.myRemove(ids); } } ruoyi-admin/src/main/resources/application-druid.yml
@@ -6,8 +6,8 @@ druid: # 主库数据源 master: url: jdbc:mysql://47.93.189.255:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://47.93.189.255:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: ZhangApp123! # password: 123456 zhang-content/src/main/java/com/ruoyi/domain/ZInfoUser.java
@@ -139,6 +139,18 @@ @Excel(name = "全生命周期", dateFormat = "yyyy-MM-dd") private Date deadDay; @Excel(name = "星座") private String constellation; @Excel(name = "微信号") private String wxNo; @Excel(name = "qq号") private String qqNo; @Excel(name = "生肖") private String shengXiao; /** * 图片地址 */ @@ -194,4 +206,6 @@ List<ZInfoUser> childList; } zhang-content/src/main/java/com/ruoyi/domain/ZTravelBase.java
@@ -1,9 +1,15 @@ package com.ruoyi.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * <p> @@ -14,138 +20,91 @@ * @since 2023-03-14 */ @TableName("z_travel_base") @Data public class ZTravelBase implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; private Long id; /** * 对应费用表id */ private String feeId; /** * 地点 */ @Excel(name = "地点") private String address; /** * 所有参加本次旅行的人物,用逗号隔开 */ @Excel(name = "人物") private String people; /** * 旅行记录的标题 */ @Excel(name = "标题") private String title; /** * 旅期 */ @Excel(name = "旅期") private String travelPeriod; /** * 所持的证件,多个用逗号隔开 */ @Excel(name = "所持证件") private String certificate; /** * 本次旅行总费用 */ @Excel(name = "总费用") private Double totalPrice; /** * 0:公费,1:自费 */ private Integer isSelf; @Excel(name = "公费或自费", readConverterExp = "0=公费,1=自费") private Integer self; /** * 备注信息 */ @Excel(name = "备注") private String remark; /** * 创建时间 */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; public Integer getId() { return id; } /** * 发生时间 */ @Excel(name = "时间", dateFormat = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date happenTime; public void setId(Integer id) { this.id = id; } @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @TableField(exist = false) private Date happenStartTime; public String getAddress() { return address; } @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @TableField(exist = false) private Date happenEndTime; public void setAddress(String address) { this.address = address; } /** * 电子文件路径 */ private String url; public String getPeople() { return people; } public void setPeople(String people) { this.people = people; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getTravelPeriod() { return travelPeriod; } public void setTravelPeriod(String travelPeriod) { this.travelPeriod = travelPeriod; } public String getCertificate() { return certificate; } public void setCertificate(String certificate) { this.certificate = certificate; } public Double getTotalPrice() { return totalPrice; } public void setTotalPrice(Double totalPrice) { this.totalPrice = totalPrice; } public Integer getIsSelf() { return isSelf; } public void setIsSelf(Integer isSelf) { this.isSelf = isSelf; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } @Override public String toString() { return "ZTravelBase{" + "id=" + id + ", address=" + address + ", people=" + people + ", title=" + title + ", travelPeriod=" + travelPeriod + ", certificate=" + certificate + ", totalPrice=" + totalPrice + ", isSelf=" + isSelf + ", remark=" + remark + "}"; } } zhang-content/src/main/java/com/ruoyi/domain/ZTravelPrice.java
@@ -1,10 +1,16 @@ package com.ruoyi.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Date; import java.util.List; /** * <p> @@ -15,17 +21,14 @@ * @since 2023-03-14 */ @TableName("z_travel_price") @Data public class ZTravelPrice implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; private String id; /** * 本次旅行的id */ private Integer travelId; /** * 餐费 @@ -53,86 +56,62 @@ private Double shopping; /** * 消费日期 * 起始日期 */ private LocalDateTime consumeDate; @JsonFormat(pattern = "yyyy-MM-dd") private Date startTime; /** * 结束日期 */ @JsonFormat(pattern = "yyyy-MM-dd") private Date endTime; /** * 创建日期 */ @JsonFormat(pattern = "yyyy-MM-dd") private Date createTime; /** * 总天数 */ private Integer totalDay; /** * 标题 */ private String title; /** * 总金额 */ private Double totalCost; /** * 所属用户id */ private Long myId; /** * 起始时间搜索传入 */ @TableField(exist = false) @JsonFormat(pattern = "yyyy-MM-dd") private Date start; /** * 结束时间搜索传入 */ @TableField(exist = false) @JsonFormat(pattern = "yyyy-MM-dd") private Date end; /** * 费用详细记录表 */ @TableField(exist = false) private List<ZTravelPriceDetail> detailList; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getTravelId() { return travelId; } public void setTravelId(Integer travelId) { this.travelId = travelId; } public Double getEat() { return eat; } public void setEat(Double eat) { this.eat = eat; } public Double getStay() { return stay; } public void setStay(Double stay) { this.stay = stay; } public Double getTraffic() { return traffic; } public void setTraffic(Double traffic) { this.traffic = traffic; } public Double getEntrance() { return entrance; } public void setEntrance(Double entrance) { this.entrance = entrance; } public Double getShopping() { return shopping; } public void setShopping(Double shopping) { this.shopping = shopping; } public LocalDateTime getConsumeDate() { return consumeDate; } public void setConsumeDate(LocalDateTime consumeDate) { this.consumeDate = consumeDate; } @Override public String toString() { return "ZTravelPrice{" + "id=" + id + ", travelId=" + travelId + ", eat=" + eat + ", stay=" + stay + ", traffic=" + traffic + ", entrance=" + entrance + ", shopping=" + shopping + ", consumeDate=" + consumeDate + "}"; } } zhang-content/src/main/java/com/ruoyi/domain/ZTravelPriceDetail.java
New file @@ -0,0 +1,77 @@ package com.ruoyi.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; /** * @Author Jinquan_Ou * @Description * @Date 2023-05-27 17:33 * @Version 1.0.0 **/ @Data public class ZTravelPriceDetail { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 对应旅游费用记录id */ private String feeId; /** * 餐费 */ private Double eat; /** * 住宿费 */ private Double stay; /** * 交通出行的费用 */ private Double traffic; /** * 门票费用 */ private Double entrance; /** * 购物费用 */ private Double shopping ; /** * 每日金额 */ private Double dayCost; /** * 总金额 */ private Double totalCost; /** * 消费日期 */ private String happenTime; /** * 内容 */ private String content; } zhang-content/src/main/java/com/ruoyi/domain/ZfRelation.java
@@ -22,7 +22,13 @@ private Long myId; private Long otherId; private String relation; private String otherName; private String otherUnit; private String otherPosition; private String otherPolitical; } zhang-content/src/main/java/com/ruoyi/domain/dto/PriceDto.java
New file @@ -0,0 +1,34 @@ package com.ruoyi.domain.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.domain.ZTravelPriceDetail; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; /** * @Author Jinquan_Ou * @Description * @Date 2023-05-27 19:03 * @Version 1.0.0 **/ @Data public class PriceDto implements Serializable { private static final long serialVersionUID = 1L; private String id; @JsonFormat(pattern = "yyyy-MM-dd") private Date startTime; @JsonFormat(pattern = "yyyy-MM-dd") private Date endTime; private String title; private List<ZTravelPriceDetail> detailList; } zhang-content/src/main/java/com/ruoyi/domain/dto/RelationDto.java
New file @@ -0,0 +1,23 @@ package com.ruoyi.domain.dto; import lombok.Data; import java.io.Serializable; /** * @Author Jinquan_Ou * @Description * @Date 2023-05-29 20:47 * @Version 1.0.0 **/ @Data public class RelationDto implements Serializable { private static final long serialVersionUID = 1L; private Long otherId; private String otherName; private String otherUnit; private String otherPosition; private String otherPolitical; private String relation; } zhang-content/src/main/java/com/ruoyi/mapper/ZTravelPriceDetailMapper.java
New file @@ -0,0 +1,17 @@ package com.ruoyi.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.domain.ZTravelPriceDetail; import org.apache.ibatis.annotations.Mapper; /** * @Author Jinquan_Ou * @Description * @Date 2023-05-27 18:52 * @Version 1.0.0 **/ @Mapper public interface ZTravelPriceDetailMapper extends BaseMapper<ZTravelPriceDetail> { } zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java
@@ -6,6 +6,7 @@ import com.ruoyi.domain.dto.EmpowerDto; import com.ruoyi.domain.dto.Genealogy; import com.ruoyi.domain.dto.GenealogyExportDto; import com.ruoyi.domain.dto.RelationDto; import java.util.List; @@ -23,7 +24,7 @@ List<ZInfoUser> selectByCondition(ZInfoUser zInfoUser); AjaxResult searchMyRelation(Long userId); AjaxResult searchMyRelation(); AjaxResult addRelation(ZfRelation zfRelation); zhang-content/src/main/java/com/ruoyi/service/ZTravelBaseService.java
@@ -2,7 +2,11 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZTravelBase; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** * <p> @@ -14,4 +18,11 @@ */ public interface ZTravelBaseService extends IService<ZTravelBase> { AjaxResult selectDataList(String fid, ZTravelBase zTravelBase, Integer pageNum, Integer pageSize); List<ZTravelBase> selectByIds(Long[] ids); AjaxResult mySave(ZTravelBase zTravelBase); AjaxResult importExcel(MultipartFile file); } zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceDetailService.java
New file @@ -0,0 +1,16 @@ package com.ruoyi.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.ZTravelPriceDetail; import org.springframework.stereotype.Service; /** * @Author Jinquan_Ou * @Description * @Date 2023-05-27 18:52 * @Version 1.0.0 **/ public interface ZTravelPriceDetailService extends IService<ZTravelPriceDetail> { } zhang-content/src/main/java/com/ruoyi/service/ZTravelPriceService.java
@@ -2,7 +2,13 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.dto.PriceDto; import org.springframework.web.multipart.MultipartFile; import java.util.List; /** * <p> @@ -14,4 +20,19 @@ */ public interface ZTravelPriceService extends IService<ZTravelPrice> { AjaxResult selectDataList(ZTravelPrice zTravelPrice, Integer pageNum, Integer pageSize); AjaxResult mySave(PriceDto priceDto); // AjaxResult importExcel(MultipartFile file); List<ZTravelPrice> selectCondition(ZTravelPrice zTravelPrice); List<ZTravelPrice> selectByIds(Long[] ids); AjaxResult myUpdate(PriceDto priceDto); AjaxResult myRemove(String[] ids); // AjaxResult importExcel(MultipartFile file); } zhang-content/src/main/java/com/ruoyi/service/impl/ZHonorServiceImpl.java
@@ -98,7 +98,7 @@ @Override public List<ZHonor> selectByIds(Long[] ids) { List<ZHonor> list = new ArrayList<>(); if(ids.length!=0) if(!(ids==null||ids.length==0)) list = listByIds(Arrays.asList(ids)); else list = list(); zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java
@@ -15,10 +15,7 @@ import com.ruoyi.domain.ZInfoUser; import com.ruoyi.domain.ZfEvent; import com.ruoyi.domain.ZfRelation; import com.ruoyi.domain.dto.EmpowerDto; import com.ruoyi.domain.dto.Genealogy; import com.ruoyi.domain.dto.GenealogyExportDto; import com.ruoyi.domain.dto.UserRelationDto; import com.ruoyi.domain.dto.*; import com.ruoyi.mapper.ZInfoUserMapper; import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfRelationService; @@ -45,6 +42,9 @@ @Autowired private ZfRelationService zfRelationService; @Autowired private ZInfoUserService zInfoUserService; @Override public AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize) { @@ -93,55 +93,24 @@ } @Override public AjaxResult searchMyRelation(Long userId) { public AjaxResult searchMyRelation() { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); LambdaQueryWrapper<ZfRelation> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZfRelation::getMyId,userId); List<ZfRelation> relationList = zfRelationService.list(lqw); ArrayList<UserRelationDto> otherUserList = new ArrayList<>(); relationList.stream().map( (relation)->{ Long otherId = relation.getOtherId(); ZInfoUser otherUser = getById(otherId); UserRelationDto userRelationDto = new UserRelationDto(); BeanUtils.copyProperties(otherUser,userRelationDto); userRelationDto.setRelation(relation.getRelation()); userRelationDto.setId(relation.getId()); otherUserList.add(userRelationDto); return relation; } ).collect(Collectors.toList()); return AjaxResult.success(otherUserList); } /** * 检查传入对方的id是否存在 * @param zfRelation */ private void checkRelation(ZfRelation zfRelation){ LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZInfoUser::getUserId, zfRelation.getOtherId()); ZInfoUser zInfoUser2 = getOne(lqw); if (zInfoUser2==null){ throw new RuntimeException("对方的id不存在"); } List<ZfRelation> list = zfRelationService.list(lqw); return AjaxResult.success(list); } @Override @Transactional public AjaxResult addRelation(ZfRelation zfRelation) { checkRelation(zfRelation); //获取自己的id并传入 SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); zfRelation.setMyId(userId); zfRelationService.save(zfRelation); return AjaxResult.success(); } @@ -149,19 +118,14 @@ @Override @Transactional public AjaxResult updateRelation(ZfRelation zfRelation) { checkRelation(zfRelation); zfRelationService.updateById(zfRelation); return AjaxResult.success(); } @Override public AjaxResult deleteRelation(Long[] ids) { boolean flag = zfRelationService.removeByIds(Arrays.asList(ids)); if (flag){ return AjaxResult.success(); }else { return AjaxResult.error(); } zfRelationService.removeByIds(Arrays.asList(ids)); return AjaxResult.success(); } /** zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelBaseServiceImpl.java
@@ -1,10 +1,28 @@ package com.ruoyi.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.MapUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.*; import com.ruoyi.domain.ZTravelBase; import com.ruoyi.domain.ZTravelBase; import com.ruoyi.domain.ZTravelBase; import com.ruoyi.mapper.ZTravelBaseMapper; import com.ruoyi.service.ZTravelBaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; /** * <p> @@ -17,4 +35,98 @@ @Service public class ZTravelBaseServiceImpl extends ServiceImpl<ZTravelBaseMapper, ZTravelBase> implements ZTravelBaseService { @Autowired ZTravelBaseService zTravelBaseService; @Override public AjaxResult selectDataList(String fid, ZTravelBase zTravelBase, Integer pageNum, Integer pageSize) { LambdaQueryWrapper<ZTravelBase> lqw = buildCondition(zTravelBase, fid); Page<ZTravelBase> pageBean = new Page<>(pageNum, pageSize); Page<ZTravelBase> pageResult = page(pageBean, lqw); List<ZTravelBase> beanRecords = pageResult.getRecords();//得到查询出来的数据 HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords); return AjaxResult.success(data); } @Override public List<ZTravelBase> selectByIds(Long[] ids) { List<ZTravelBase> list = new ArrayList<>(); if(ids.length!=0) list = listByIds(Arrays.asList(ids)); else list = list(); return list; } @Override public AjaxResult mySave(ZTravelBase zTravelBase) { //检查是否有重复数据插入 LambdaQueryWrapper<ZTravelBase> lqw = uniqueCondition(zTravelBase); List<ZTravelBase> list = list(lqw); if(list.size()>0){ throw new RuntimeException("请勿新增重复数据"); } if (save(zTravelBase)) { return AjaxResult.success(); }else { return AjaxResult.error(); } } @Override public AjaxResult importExcel(MultipartFile file) { ExcelUtil<ZTravelBase> util = new ExcelUtil<>(ZTravelBase.class); List<ZTravelBase> dataList = null; try { dataList = util.importExcel(file.getInputStream()); } catch (Exception e) { throw new RuntimeException("没有按照规则导入数据"); } assert dataList != null; for (ZTravelBase zTravelBase : dataList) { zTravelBaseService.mySave(zTravelBase); } return AjaxResult.success(); } private LambdaQueryWrapper<ZTravelBase> uniqueCondition(ZTravelBase zTravelBase) { LambdaQueryWrapper<ZTravelBase> lqw = new LambdaQueryWrapper<>(); lqw.eq(zTravelBase.getFeeId()!=null,ZTravelBase::getFeeId,zTravelBase.getFeeId()) .eq(StringUtils.isNotEmpty(zTravelBase.getAddress()),ZTravelBase::getAddress,zTravelBase.getAddress()) .eq(StringUtils.isNotEmpty(zTravelBase.getPeople()),ZTravelBase::getPeople,zTravelBase.getPeople()) .eq(StringUtils.isNotEmpty(zTravelBase.getTitle()),ZTravelBase::getTitle,zTravelBase.getTitle()) .eq(StringUtils.isNotEmpty(zTravelBase.getTravelPeriod()),ZTravelBase::getTravelPeriod,zTravelBase.getTravelPeriod()) .eq(StringUtils.isNotEmpty(zTravelBase.getCertificate()),ZTravelBase::getCertificate,zTravelBase.getCertificate()) .eq(StringUtils.isNotEmpty(zTravelBase.getRemark()),ZTravelBase::getRemark,zTravelBase.getRemark()) .eq(zTravelBase.getTotalPrice()!=null,ZTravelBase::getTotalPrice,zTravelBase.getTotalPrice()) .eq(zTravelBase.getSelf()!=null,ZTravelBase::getSelf,zTravelBase.getSelf()); return lqw; } private LambdaQueryWrapper<ZTravelBase> buildCondition(ZTravelBase zTravelBase, String fid) { LambdaQueryWrapper<ZTravelBase> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZTravelBase::getFeeId,fid) .between(zTravelBase.getHappenStartTime()!=null && zTravelBase.getHappenEndTime()!=null,ZTravelBase::getHappenTime,zTravelBase.getHappenStartTime(),zTravelBase.getHappenEndTime()) .like(StringUtils.isNotEmpty(zTravelBase.getAddress()),ZTravelBase::getAddress,zTravelBase.getAddress()) .like(StringUtils.isNotEmpty(zTravelBase.getPeople()),ZTravelBase::getPeople,zTravelBase.getPeople()) .like(StringUtils.isNotEmpty(zTravelBase.getTitle()),ZTravelBase::getTitle,zTravelBase.getTitle()); lqw.orderByDesc(ZTravelBase::getCreateTime); return lqw; } } zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceDetailServiceImpl.java
New file @@ -0,0 +1,20 @@ package com.ruoyi.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.ZTravelPriceDetail; import com.ruoyi.mapper.ZTravelPriceDetailMapper; import com.ruoyi.service.ZTravelPriceDetailService; import com.ruoyi.service.ZTravelPriceService; import org.springframework.stereotype.Service; /** * @Author Jinquan_Ou * @Description * @Date 2023-05-27 18:53 * @Version 1.0.0 **/ @Service public class ZTravelPriceDetailServiceImpl extends ServiceImpl<ZTravelPriceDetailMapper, ZTravelPriceDetail> implements ZTravelPriceDetailService { } zhang-content/src/main/java/com/ruoyi/service/impl/ZTravelPriceServiceImpl.java
@@ -1,15 +1,37 @@ package com.ruoyi.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.MapUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.domain.ZTravelBase; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.ZTravelPrice; import com.ruoyi.domain.ZTravelPriceDetail; import com.ruoyi.domain.dto.PriceDto; import com.ruoyi.mapper.ZTravelPriceMapper; import com.ruoyi.service.ZTravelBaseService; import com.ruoyi.service.ZTravelPriceDetailService; import com.ruoyi.service.ZTravelPriceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import java.util.*; import java.util.stream.Collectors; /** * <p> * 服务实现类 * 服务实现类 * </p> * * @author ojq @@ -18,4 +40,323 @@ @Service public class ZTravelPriceServiceImpl extends ServiceImpl<ZTravelPriceMapper, ZTravelPrice> implements ZTravelPriceService { @Autowired ZTravelPriceServiceImpl zTravelPriceService; @Autowired ZTravelPriceDetailService zTravelPriceDetailService; @Autowired ZTravelBaseService zTravelBaseService; // private LambdaQueryWrapper<ZTravelPrice> uniqueCondition(ZTravelPrice zTravelPrice){ // LambdaQueryWrapper<ZTravelPrice> lqw = new LambdaQueryWrapper<>(); // lqw.eq(zTravelPrice.getMyId()!=null,ZTravelPrice::getMyId,zTravelPrice.getMyId()) // .eq(zTravelPrice.getStartTime()!=null,ZTravelPrice::getStartTime,zTravelPrice.getStartTime()) // .eq(zTravelPrice.getEndTime()!=null,ZTravelPrice::getEndTime,zTravelPrice.getEndTime()) // .eq(zTravelPrice.getTotalDay()!=null,ZTravelPrice::getTotalDay,zTravelPrice.getTotalDay()) // .eq(StringUtils.isNotEmpty(zTravelPrice.getTitle()),ZTravelPrice::getTitle,zTravelPrice.getTitle()); //// .eq(zTravelPrice.getEat()!=null,ZTravelPrice::getEat,zTravelPrice.getEat()) //// .eq(zTravelPrice.getStay()!=null,ZTravelPrice::getStay,zTravelPrice.getStay()) //// .eq(zTravelPrice.getTraffic()!=null,ZTravelPrice::getTraffic,zTravelPrice.getTraffic()) //// .eq(zTravelPrice.getShopping()!=null,ZTravelPrice::getShopping,zTravelPrice.getShopping()); // return lqw; // } private LambdaQueryWrapper<ZTravelPrice> buildCondition(ZTravelPrice zTravelPrice, Long userId) { LambdaQueryWrapper<ZTravelPrice> lqw = new LambdaQueryWrapper<>(); lqw.eq(ZTravelPrice::getMyId, userId) .eq(zTravelPrice.getTotalDay() != null, ZTravelPrice::getTotalDay, zTravelPrice.getTotalDay()) .le(zTravelPrice.getEnd() != null, ZTravelPrice::getEndTime, zTravelPrice.getEnd()) .ge(zTravelPrice.getStart() != null, ZTravelPrice::getStartTime, zTravelPrice.getStart()); lqw.orderBy(true, true, ZTravelPrice::getStartTime); return lqw; } /** * 分页查找 */ @Override public AjaxResult selectDataList(ZTravelPrice zTravelPrice, Integer pageNum, Integer pageSize) { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); LambdaQueryWrapper<ZTravelPrice> lqw = buildCondition(zTravelPrice, userId); Page<ZTravelPrice> pageBean = new Page<>(pageNum, pageSize); Page<ZTravelPrice> pageResult = page(pageBean, lqw); List<ZTravelPrice> priceList = pageResult.getRecords();//得到查询出来的数据 //查询费用详情 for (ZTravelPrice price : priceList) { LambdaQueryWrapper<ZTravelPriceDetail> detailLqw = new LambdaQueryWrapper<>(); detailLqw.eq(ZTravelPriceDetail::getFeeId,price.getId()); List<ZTravelPriceDetail> detailList = zTravelPriceDetailService.list(detailLqw); price.setDetailList(detailList); } HashMap<String, Object> data = MapUtils.getResult(pageResult, priceList); return AjaxResult.success(data); } @Override public List<ZTravelPrice> selectCondition(ZTravelPrice zTravelPrice) { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); LambdaQueryWrapper<ZTravelPrice> lqw = buildCondition(zTravelPrice, userId); return list(lqw); } @Override public List<ZTravelPrice> selectByIds(Long[] ids) { List<ZTravelPrice> list = new ArrayList<>(); if (ids.length != 0) list = listByIds(Arrays.asList(ids)); else list = list(); return list; } @Override @Transactional public AjaxResult mySave(PriceDto priceDto) { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); List<ZTravelPriceDetail> detailList = priceDto.getDetailList(); //生成费用表id String priceId = IdUtils.fastSimpleUUID(); //得到总天数 long count = detailList.stream().map(ZTravelPriceDetail::getHappenTime).distinct().count(); Integer totalDay = Math.toIntExact(count); //先插入明细表 //collectList还没有添加每日金额字段 List<ZTravelPriceDetail> collectList = detailList.stream().peek((priceDetail) -> { priceDetail.setFeeId(priceId); if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) { throw new RuntimeException("如果没有对应的费用,前端要传个0过来"); } Double totalCost = priceDetail.getEat() + priceDetail.getStay() + priceDetail.getTraffic() + priceDetail.getEntrance() + priceDetail.getShopping(); priceDetail.setTotalCost(totalCost); }).collect(Collectors.toList()); //按日期分组 Map<String, List<ZTravelPriceDetail>> groupByTimeMap = collectList.stream().collect(Collectors.groupingBy(ZTravelPriceDetail::getHappenTime)); //将每日金额字段的值也添加上 for (String key : groupByTimeMap.keySet()) { List<ZTravelPriceDetail> groupByTimeList = groupByTimeMap.get(key); Double dayTotalCost = 0d; for (ZTravelPriceDetail detail : groupByTimeList) { dayTotalCost += detail.getTotalCost(); } for (ZTravelPriceDetail detail : groupByTimeList){ detail.setDayCost(dayTotalCost); } } //开始插入费用详情数据 for (String key : groupByTimeMap.keySet()) { List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key); for (ZTravelPriceDetail detail : dataList) { zTravelPriceDetailService.save(detail); } } //再插入费用记录统计表 //先得到各个详情费用的总和 Double eatTotal = 0d; Double stayTotal = 0d; Double trafficTotal = 0d; Double entranceTotal = 0d; Double shoppingTotal = 0d; Double totalFee = 0d; for (String key : groupByTimeMap.keySet()) { List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key); for (ZTravelPriceDetail priceDetail : dataList) { if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) { throw new RuntimeException("如果没有对应的费用,前端要传个0过来"); } eatTotal+=priceDetail.getEat(); stayTotal+=priceDetail.getStay(); trafficTotal+=priceDetail.getTraffic(); entranceTotal+=priceDetail.getEntrance(); shoppingTotal+=priceDetail.getShopping(); totalFee+=priceDetail.getTotalCost(); } } ZTravelPrice zTravelPrice = new ZTravelPrice(); zTravelPrice.setId(priceId); zTravelPrice.setStartTime(priceDto.getStartTime()); zTravelPrice.setEndTime(priceDto.getEndTime()); zTravelPrice.setTotalDay(totalDay); zTravelPrice.setTitle(priceDto.getTitle()); zTravelPrice.setEat(eatTotal); zTravelPrice.setStay(stayTotal); zTravelPrice.setTraffic(trafficTotal); zTravelPrice.setEntrance(entranceTotal); zTravelPrice.setShopping(shoppingTotal); zTravelPrice.setTotalCost(totalFee); zTravelPrice.setMyId(userId); //插入费用记录统计 zTravelPriceService.save(zTravelPrice); return AjaxResult.success(); } @Override public AjaxResult myUpdate(PriceDto priceDto) { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); List<ZTravelPriceDetail> detailList = priceDto.getDetailList(); //得到总天数 long count = detailList.stream().map(ZTravelPriceDetail::getHappenTime).distinct().count(); Integer totalDay = Math.toIntExact(count); List<ZTravelPriceDetail> collectList = detailList.stream().peek((priceDetail) -> { if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) { throw new RuntimeException("如果没有对应的费用,前端要传个0过来"); } Double totalCost = priceDetail.getEat() + priceDetail.getStay() + priceDetail.getTraffic() + priceDetail.getEntrance() + priceDetail.getShopping(); priceDetail.setTotalCost(totalCost); }).collect(Collectors.toList()); //按日期分组 Map<String, List<ZTravelPriceDetail>> groupByTimeMap = collectList.stream().collect(Collectors.groupingBy(ZTravelPriceDetail::getHappenTime)); //将每日金额字段的值也添加上 for (String key : groupByTimeMap.keySet()) { List<ZTravelPriceDetail> groupByTimeList = groupByTimeMap.get(key); Double dayTotalCost = 0d; for (ZTravelPriceDetail detail : groupByTimeList) { dayTotalCost += detail.getTotalCost(); } for (ZTravelPriceDetail detail : groupByTimeList){ detail.setDayCost(dayTotalCost); } } //开始修改费用详情数据 for (String key : groupByTimeMap.keySet()) { List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key); for (ZTravelPriceDetail detail : dataList) { zTravelPriceDetailService.updateById(detail); } } //再修改费用记录统计表 //先得到各个详情费用的总和 Double eatTotal = 0d; Double stayTotal = 0d; Double trafficTotal = 0d; Double entranceTotal = 0d; Double shoppingTotal = 0d; Double totalFee = 0d; for (String key : groupByTimeMap.keySet()) { List<ZTravelPriceDetail> dataList = groupByTimeMap.get(key); for (ZTravelPriceDetail priceDetail : dataList) { if (priceDetail.getEat() == null || priceDetail.getStay() == null || priceDetail.getTraffic() == null || priceDetail.getEntrance() == null || priceDetail.getShopping() == null) { throw new RuntimeException("如果没有对应的费用,前端要传个0过来"); } eatTotal+=priceDetail.getEat(); stayTotal+=priceDetail.getStay(); trafficTotal+=priceDetail.getTraffic(); entranceTotal+=priceDetail.getEntrance(); shoppingTotal+=priceDetail.getShopping(); totalFee+=priceDetail.getTotalCost(); } } ZTravelPrice zTravelPrice = new ZTravelPrice(); zTravelPrice.setId(priceDto.getId()); zTravelPrice.setStartTime(priceDto.getStartTime()); zTravelPrice.setEndTime(priceDto.getEndTime()); zTravelPrice.setTotalDay(totalDay); zTravelPrice.setTitle(priceDto.getTitle()); zTravelPrice.setEat(eatTotal); zTravelPrice.setStay(stayTotal); zTravelPrice.setTraffic(trafficTotal); zTravelPrice.setEntrance(entranceTotal); zTravelPrice.setShopping(shoppingTotal); zTravelPrice.setTotalCost(totalFee); zTravelPrice.setMyId(userId); //修改统计表 zTravelPriceService.updateById(zTravelPrice); return AjaxResult.success(); } @Override @Transactional public AjaxResult myRemove(String[] ids) { for (String feeId : ids) { //删除旅游经历 zTravelBaseService.remove(new LambdaQueryWrapper<ZTravelBase>().eq(ZTravelBase::getFeeId,feeId)); //删除费用详情 zTravelPriceDetailService.remove(new LambdaQueryWrapper<ZTravelPriceDetail>().eq(ZTravelPriceDetail::getFeeId,feeId)); //删除费用记录 zTravelPriceService.remove(new LambdaQueryWrapper<ZTravelPrice>().eq(ZTravelPrice::getId,feeId)); } return AjaxResult.success(); } // @Override // public AjaxResult importExcel(MultipartFile file) { // // } // @Override // @Transactional // public AjaxResult importExcel(MultipartFile file) { // // ExcelUtil<ZTravelPrice> util = new ExcelUtil<>(ZTravelPrice.class); // List<ZTravelPrice> dataList = null; // try { // dataList = util.importExcel(file.getInputStream()); // } catch (Exception e) { // throw new RuntimeException("没有按照规则导入数据"); // } // // assert dataList != null; // // for (ZTravelPrice zTravelPrice : dataList) { // zTravelPriceService.mySave(zTravelPrice); // } // // return AjaxResult.success(); // // } }