Browse Source

Merge branch 'master' of http://49.4.53.36:3000/hotel/hotel-saas-backend

覃浩 2 years ago
parent
commit
2eb2a1a1de
13 changed files with 960 additions and 0 deletions
  1. 419 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusAgreementOrderFeeController.java
  2. 185 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusCommodityRecordController.java
  3. 18 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/dto/BatchAgreementOrderSavaDto.java
  4. 58 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusAgreementOrderFee.java
  5. 110 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusCommodityRecord.java
  6. 53 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/AgreementOrderStatusEnum.java
  7. 54 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/ReturnGoodsStatusEnum.java
  8. 17 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusCommodityRecordMapper.java
  9. 5 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusCommodityRecordMapper.xml
  10. 2 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusAgreementOrderFeeService.java
  11. 14 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusCommodityRecordService.java
  12. 6 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusAgreementOrderFeeServiceImpl.java
  13. 19 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusCommodityRecordServiceImpl.java

+ 419 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusAgreementOrderFeeController.java

@@ -0,0 +1,419 @@
+package org.jeecg.modules.business.controller;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+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.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.CommonConstant;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.TokenUtils;
+import org.jeecg.common.util.oConvertUtils;
+
+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.jeecg.modules.business.dto.BatchAgreementOrderSavaDto;
+import org.jeecg.modules.business.entity.BusAgreementOrderFee;
+import org.jeecg.modules.business.entity.BusCommodityRecord;
+import org.jeecg.modules.business.entity.BusDict;
+import org.jeecg.modules.business.entity.BusSalesPersonPost;
+import org.jeecg.modules.business.enums.AgreementOrderStatusEnum;
+import org.jeecg.modules.business.enums.AgreenmentAccountStatus;
+import org.jeecg.modules.business.enums.AgreenmentCheckStatus;
+import org.jeecg.modules.business.enums.ReturnGoodsStatusEnum;
+import org.jeecg.modules.business.service.IBusAgreementOrderFeeService;
+import org.jeecg.modules.business.service.IBusCommodityRecordService;
+import org.jeecg.modules.order.service.ICesOrderLeaseGoodsService;
+import org.jeecg.modules.rooms.entity.CesGoods;
+import org.jeecg.modules.rooms.service.CesGoodsServiceImpl;
+import org.jeecg.modules.rooms.service.CesStockTypeServiceImpl;
+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:   2023-05-25
+ * @Version: V1.0
+ */
+@Api(tags="协议账单表")
+@RestController
+@RequestMapping("/business/busAgreementOrderFee")
+@Slf4j
+public class BusAgreementOrderFeeController extends JeecgController<BusAgreementOrderFee, IBusAgreementOrderFeeService> {
+	@Autowired
+	private IBusAgreementOrderFeeService busAgreementOrderFeeService;
+	 @Autowired
+	 private IBusCommodityRecordService busCommodityRecordService;
+	 @Resource
+	 private CesGoodsServiceImpl goodsService;
+	/**
+	 * 分页列表查询
+	 *
+	 * @param busAgreementOrderFee
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "协议账单表-分页列表查询")
+	@ApiOperation(value="协议账单表-分页列表查询", notes="协议账单表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BusAgreementOrderFee>> queryPageList(BusAgreementOrderFee busAgreementOrderFee,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<BusAgreementOrderFee> queryWrapper = QueryGenerator.initQueryWrapper(busAgreementOrderFee, req.getParameterMap());
+		Page<BusAgreementOrderFee> page = new Page<BusAgreementOrderFee>(pageNo, pageSize);
+		IPage<BusAgreementOrderFee> pageList = busAgreementOrderFeeService.page(page, queryWrapper);
+		pageList.getRecords().forEach(item->{
+			//处理客人信息
+			if (oConvertUtils.isEmpty(item.getOrderFeeId())){
+				item.setGuest("协议单位");
+			}else{
+				//根据关联的入住单找到客户信息
+			}
+		});
+		return Result.OK(pageList);
+	}
+
+	/**
+	 *   添加
+	 *
+	 * @param busAgreementOrderFee
+	 * @return
+	 */
+	@AutoLog(value = "协议账单表-添加")
+	@ApiOperation(value="协议账单表-添加", notes="协议账单表-添加")
+	//@RequiresPermissions("business:bus_agreement_order_fee:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BusAgreementOrderFee busAgreementOrderFee) {
+		busAgreementOrderFeeService.save(busAgreementOrderFee);
+		return Result.OK("添加成功!");
+	}
+
+	 /**
+	  *   添加
+	  *
+	  * @param busAgreementOrderFee
+	  * @return
+	  */
+	 @AutoLog(value = "协议账单表-入账")
+	 @ApiOperation(value="协议账单表-入账", notes="协议账单表-入账")
+	 //@RequiresPermissions("business:bus_agreement_order_fee:add")
+	 @PostMapping(value = "/addEntry")
+	 public Result<String> addEntry(@RequestBody BusAgreementOrderFee busAgreementOrderFee) {
+		 LoginUser user = TokenUtils.getAuthUser();
+		 busAgreementOrderFee.setCreateUserId(user.getId());
+		 busAgreementOrderFee.setCreatedTime(new Date());
+		 busAgreementOrderFee.setCreateUserId(user != null ?user.getId():"");
+		 //生成订单号
+		 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+		 String _fix = "";
+		 switch (busAgreementOrderFee.getType()){
+			 case 1:
+				 _fix = "S";
+			 	break;
+			 case 2:
+				 _fix = "T";
+				 break;
+			 case 3:
+				 _fix = "R";
+				 break;
+		 }
+		 busAgreementOrderFee.setOrderNo(_fix+sdf.format(System.currentTimeMillis()));
+		 busAgreementOrderFee.setStatus(AgreementOrderStatusEnum.NOT_SETTLEMENT.getKey());
+		 busAgreementOrderFee.setDelFlag(CommonConstant.DEL_FLAG_0);
+		 busAgreementOrderFeeService.save(busAgreementOrderFee);
+		 if (busAgreementOrderFee.getCommodityRecords() != null && busAgreementOrderFee.getCommodityRecords().size() > 0){
+			 List<BusCommodityRecord> commodityRecords = busAgreementOrderFee.getCommodityRecords();
+			 commodityRecords.forEach(item -> {
+				 item.setStatus(ReturnGoodsStatusEnum.NOT_RETURNED.getKey());
+				 item.setDelFlag(CommonConstant.DEL_FLAG_0);
+				 item.setReturnNumber(BigDecimal.valueOf(0));
+				 item.setAgreementOrderFeeId(busAgreementOrderFee.getId());
+				 if(!oConvertUtils.isNotEmpty(item.getCategoryTwoId())){
+					 CesGoods cesGoods = goodsService.getById(item.getGoodsId());
+					 if (cesGoods != null){
+					 	item.setCategoryTwoId(cesGoods.getGoodType());
+					 }
+				 }
+			 });
+			 busCommodityRecordService.saveBatch(commodityRecords);
+		 }
+		 return Result.OK("添加成功!");
+	 }
+
+	 /**
+	  *   退货
+	  *
+	  * @param busAgreementOrderFee
+	  * @return
+	  */
+	 @AutoLog(value = "协议账单表-退货")
+	 @ApiOperation(value="协议账单表-退货", notes="协议账单表-退货")
+	 //@RequiresPermissions("business:bus_agreement_order_fee:add")
+	 @PostMapping(value = "/addReturn")
+	 public Result<String> addReturn(@RequestBody BusAgreementOrderFee busAgreementOrderFee) {
+	 	if (oConvertUtils.isNotEmpty(busAgreementOrderFee.getId())){
+			BusAgreementOrderFee oldOrderFee = busAgreementOrderFeeService.getById(busAgreementOrderFee.getId());
+			if (oldOrderFee == null){
+				return Result.error("未找到对应数据");
+			}
+			BusAgreementOrderFee returnOrderFee = new BusAgreementOrderFee();
+			LoginUser user = TokenUtils.getAuthUser();
+			returnOrderFee.setCreateUserId(user.getId());
+			returnOrderFee.setCreatedTime(new Date());
+			returnOrderFee.setCreateUserId(user != null ?user.getId():"");
+			//生成订单号
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+			String _fix = "R";
+			returnOrderFee.setOrderNo(_fix+sdf.format(System.currentTimeMillis()));
+			returnOrderFee.setStatus(AgreementOrderStatusEnum.NOT_SETTLEMENT.getKey());
+			returnOrderFee.setDelFlag(CommonConstant.DEL_FLAG_0);
+			returnOrderFee.setCategoryId(oldOrderFee.getCategoryId());
+			returnOrderFee.setAgreementUnitId(oldOrderFee.getAgreementUnitId());
+			returnOrderFee.setPayPrice(busAgreementOrderFee.getPayPrice());
+			returnOrderFee.setRemarks(busAgreementOrderFee.getRemarks());
+			returnOrderFee.setType(busAgreementOrderFee.getType());
+
+			busAgreementOrderFeeService.save(returnOrderFee);
+
+			LambdaQueryWrapper<BusCommodityRecord> querCommodity = new LambdaQueryWrapper<BusCommodityRecord>();
+			querCommodity.eq(BusCommodityRecord::getAgreementOrderFeeId, busAgreementOrderFee.getId());
+			List<BusCommodityRecord> oldList = busCommodityRecordService.list(querCommodity);
+			if (oldList != null && oldList.size() > 0){
+				if (busAgreementOrderFee.getCommodityRecords() != null && busAgreementOrderFee.getCommodityRecords().size() > 0){
+					List<BusCommodityRecord> commodityRecords = busAgreementOrderFee.getCommodityRecords();
+//					oldList.forEach(item -> {
+//
+//					});
+					for(BusCommodityRecord item:oldList){
+						for(BusCommodityRecord record:commodityRecords){
+							if (record.getId().equals(item.getId())){
+								//退貨
+								item.setReturnNumber(record.getReturnNumber());
+							}
+						}
+					}
+					busCommodityRecordService.updateBatchById(oldList);
+				}
+			}
+			return Result.OK("退货成功!");
+		}else{
+			return Result.error("未找到对应数据");
+		}
+	 }
+
+	 /**
+	  *  批量结算
+	  *
+	  * @param batchAgreementOrderSavaDto
+	  * @return
+	  */
+	 @AutoLog(value = "协议账单表-批量结算")
+	 @ApiOperation(value="协议账单表-批量结算", notes="协议账单表-批量结算")
+	 @PostMapping(value = "/updateStatusBatch")
+	 public Result<String> updateStatusBatch(@RequestBody BatchAgreementOrderSavaDto batchAgreementOrderSavaDto) {
+		 if (batchAgreementOrderSavaDto == null) {
+			 return Result.error("参数错误");
+		 }
+		 BusAgreementOrderFee busAgreementOrderFee = batchAgreementOrderSavaDto.getBusAgreementOrderFee();
+		 LoginUser user = TokenUtils.getAuthUser();
+		 busAgreementOrderFee.setCreateUserId(user.getId());
+		 busAgreementOrderFee.setCreatedTime(new Date());
+		 busAgreementOrderFee.setCreateUserId(user != null ? user.getId() : "");
+		 //生成订单号
+		 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
+		 String _fix = "R";
+		 busAgreementOrderFee.setOrderNo(_fix + sdf.format(System.currentTimeMillis()));
+		 busAgreementOrderFee.setStatus(AgreementOrderStatusEnum.SETTLEMENT.getKey());
+		 busAgreementOrderFee.setDelFlag(CommonConstant.DEL_FLAG_0);
+		 busAgreementOrderFeeService.save(busAgreementOrderFee);
+
+		 QueryWrapper<BusAgreementOrderFee> querOrderFee = new QueryWrapper<BusAgreementOrderFee>();
+		 List<String> selectionList = Arrays.asList(batchAgreementOrderSavaDto.getOrderIds().split(","));
+		 querOrderFee.in("id", selectionList);
+		 List<BusAgreementOrderFee> orderFeeList = busAgreementOrderFeeService.list(querOrderFee);
+		 if (orderFeeList != null && orderFeeList.size() > 0) {
+			 orderFeeList.forEach(item -> {
+				 item.setStatus(AgreementOrderStatusEnum.SETTLEMENT.getKey());
+				 item.setSettlementOrderFeeId(busAgreementOrderFee.getId());
+			 });
+			 this.busAgreementOrderFeeService.updateBatchById(orderFeeList);
+		 }
+		 return Result.OK("结算成功!");
+	 }
+
+	 /**
+	  *  撤销结算
+	  *
+	  * @param busAgreementOrderFee
+	  * @return
+	  */
+	 @AutoLog(value = "协议账单表-撤销结算")
+	 @ApiOperation(value="协议账单表-撤销结算", notes="协议账单表-撤销结算")
+	 @RequestMapping(value = "/revoke", method = {RequestMethod.PUT,RequestMethod.POST})
+	 public Result<String> revoke(@RequestBody BusAgreementOrderFee busAgreementOrderFee) {
+		 BusAgreementOrderFee oldOrderFee = busAgreementOrderFeeService.getById(busAgreementOrderFee.getId());
+		 if (oldOrderFee != null) {
+		 	if (oldOrderFee.getType().equals(5)){
+				QueryWrapper<BusAgreementOrderFee> querOrderFee = new QueryWrapper<BusAgreementOrderFee>();
+				querOrderFee.eq("id", oldOrderFee.getId());
+				List<BusAgreementOrderFee> orderFeeList = busAgreementOrderFeeService.list(querOrderFee);
+				if (orderFeeList != null && orderFeeList.size() > 0) {
+					orderFeeList.forEach(item -> {
+						item.setStatus(AgreementOrderStatusEnum.NOT_SETTLEMENT.getKey());
+						item.setSettlementOrderFeeId("");
+					});
+					busAgreementOrderFeeService.updateBatchById(orderFeeList);
+				}
+				oldOrderFee.setDelFlag(CommonConstant.DEL_FLAG_1);
+				busAgreementOrderFeeService.updateById(oldOrderFee);
+			}else{
+		 		if (oConvertUtils.isNotEmpty(oldOrderFee.getSettlementOrderFeeId())){
+					BusAgreementOrderFee settlementModel = busAgreementOrderFeeService.getById(busAgreementOrderFee.getSettlementOrderFeeId());
+					if (settlementModel != null){
+						QueryWrapper<BusAgreementOrderFee> querOrderFee = new QueryWrapper<BusAgreementOrderFee>();
+						querOrderFee.eq("id", settlementModel.getId());
+						List<BusAgreementOrderFee> orderFeeList = busAgreementOrderFeeService.list(querOrderFee);
+						if (orderFeeList != null && orderFeeList.size() > 0) {
+							orderFeeList.forEach(item -> {
+								item.setStatus(AgreementOrderStatusEnum.NOT_SETTLEMENT.getKey());
+								item.setSettlementOrderFeeId("");
+							});
+							busAgreementOrderFeeService.updateBatchById(orderFeeList);
+						}
+						settlementModel.setDelFlag(CommonConstant.DEL_FLAG_1);
+						busAgreementOrderFeeService.updateById(settlementModel);
+					}
+				}
+				oldOrderFee.setStatus(AgreementOrderStatusEnum.NOT_SETTLEMENT.getKey());
+				oldOrderFee.setSettlementOrderFeeId("");
+				busAgreementOrderFeeService.updateById(oldOrderFee);
+			}
+
+
+		 }
+		 return Result.OK("编辑成功!");
+	 }
+
+	/**
+	 *  编辑
+	 *
+	 * @param busAgreementOrderFee
+	 * @return
+	 */
+	@AutoLog(value = "协议账单表-编辑")
+	@ApiOperation(value="协议账单表-编辑", notes="协议账单表-编辑")
+	//@RequiresPermissions("business:bus_agreement_order_fee:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BusAgreementOrderFee busAgreementOrderFee) {
+		busAgreementOrderFeeService.updateById(busAgreementOrderFee);
+		return Result.OK("编辑成功!");
+	}
+
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "协议账单表-通过id删除")
+	@ApiOperation(value="协议账单表-通过id删除", notes="协议账单表-通过id删除")
+	//@RequiresPermissions("business:bus_agreement_order_fee:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		busAgreementOrderFeeService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "协议账单表-批量删除")
+	@ApiOperation(value="协议账单表-批量删除", notes="协议账单表-批量删除")
+	//@RequiresPermissions("business:bus_agreement_order_fee:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.busAgreementOrderFeeService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "协议账单表-通过id查询")
+	@ApiOperation(value="协议账单表-通过id查询", notes="协议账单表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BusAgreementOrderFee> queryById(@RequestParam(name="id",required=true) String id) {
+		BusAgreementOrderFee busAgreementOrderFee = busAgreementOrderFeeService.getById(id);
+		if(busAgreementOrderFee==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(busAgreementOrderFee);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param busAgreementOrderFee
+    */
+    //@RequiresPermissions("business:bus_agreement_order_fee:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BusAgreementOrderFee busAgreementOrderFee) {
+        return super.exportXls(request, busAgreementOrderFee, BusAgreementOrderFee.class, "协议账单表");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("business:bus_agreement_order_fee:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, BusAgreementOrderFee.class);
+    }
+
+}

+ 185 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusCommodityRecordController.java

@@ -0,0 +1,185 @@
+package org.jeecg.modules.business.controller;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+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.util.oConvertUtils;
+
+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.jeecg.modules.business.entity.BusCommodityRecord;
+import org.jeecg.modules.business.service.IBusCommodityRecordService;
+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:   2023-05-25
+ * @Version: V1.0
+ */
+@Api(tags="协议单位-商品记录")
+@RestController
+@RequestMapping("/business/busCommodityRecord")
+@Slf4j
+public class BusCommodityRecordController extends JeecgController<BusCommodityRecord, IBusCommodityRecordService> {
+	@Autowired
+	private IBusCommodityRecordService busCommodityRecordService;
+
+	/**
+	 * 分页列表查询
+	 *
+	 * @param busCommodityRecord
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "协议单位-商品记录-分页列表查询")
+	@ApiOperation(value="协议单位-商品记录-分页列表查询", notes="协议单位-商品记录-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BusCommodityRecord>> queryPageList(BusCommodityRecord busCommodityRecord,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<BusCommodityRecord> queryWrapper = QueryGenerator.initQueryWrapper(busCommodityRecord, req.getParameterMap());
+		Page<BusCommodityRecord> page = new Page<BusCommodityRecord>(pageNo, pageSize);
+		IPage<BusCommodityRecord> pageList = busCommodityRecordService.page(page, queryWrapper);
+		pageList.getRecords().forEach(item->{
+			//可退数
+			BigDecimal _max = item.getBuyNumber().subtract(item.getReturnNumber());
+			item.setReturnMaxNumber(_max);
+			item.setReturnNumber(BigDecimal.valueOf(0));
+		});
+		return Result.OK(pageList);
+	}
+
+	/**
+	 *   添加
+	 *
+	 * @param busCommodityRecord
+	 * @return
+	 */
+	@AutoLog(value = "协议单位-商品记录-添加")
+	@ApiOperation(value="协议单位-商品记录-添加", notes="协议单位-商品记录-添加")
+	//@RequiresPermissions("business:bus_commodity_record_info:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BusCommodityRecord busCommodityRecord) {
+		busCommodityRecordService.save(busCommodityRecord);
+		return Result.OK("添加成功!");
+	}
+
+	/**
+	 *  编辑
+	 *
+	 * @param busCommodityRecord
+	 * @return
+	 */
+	@AutoLog(value = "协议单位-商品记录-编辑")
+	@ApiOperation(value="协议单位-商品记录-编辑", notes="协议单位-商品记录-编辑")
+	//@RequiresPermissions("business:bus_commodity_record_info:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BusCommodityRecord busCommodityRecord) {
+		busCommodityRecordService.updateById(busCommodityRecord);
+		return Result.OK("编辑成功!");
+	}
+
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "协议单位-商品记录-通过id删除")
+	@ApiOperation(value="协议单位-商品记录-通过id删除", notes="协议单位-商品记录-通过id删除")
+	//@RequiresPermissions("business:bus_commodity_record_info:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		busCommodityRecordService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "协议单位-商品记录-批量删除")
+	@ApiOperation(value="协议单位-商品记录-批量删除", notes="协议单位-商品记录-批量删除")
+	//@RequiresPermissions("business:bus_commodity_record_info:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.busCommodityRecordService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "协议单位-商品记录-通过id查询")
+	@ApiOperation(value="协议单位-商品记录-通过id查询", notes="协议单位-商品记录-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BusCommodityRecord> queryById(@RequestParam(name="id",required=true) String id) {
+		BusCommodityRecord busCommodityRecord = busCommodityRecordService.getById(id);
+		if(busCommodityRecord==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(busCommodityRecord);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param busCommodityRecord
+    */
+    //@RequiresPermissions("business:bus_commodity_record_info:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BusCommodityRecord busCommodityRecord) {
+        return super.exportXls(request, busCommodityRecord, BusCommodityRecord.class, "协议单位-商品记录");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    //@RequiresPermissions("business:bus_commodity_record_info:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, BusCommodityRecord.class);
+    }
+
+}

+ 18 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/dto/BatchAgreementOrderSavaDto.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.modules.business.entity.BusAgreementOrderFee;
+import org.jeecg.modules.business.entity.BusBookingBatch;
+import org.jeecg.modules.business.entity.BusBookingLayoutDayPrice;
+import org.jeecg.modules.business.entity.BusRoomBookingOrders;
+
+import java.util.List;
+
+@Data
+public class BatchAgreementOrderSavaDto {
+    @ApiModelProperty(value = "批次订单信息")
+    private BusAgreementOrderFee busAgreementOrderFee;
+
+    private String orderIds;
+}

+ 58 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusAgreementOrderFee.java

@@ -4,6 +4,8 @@ import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.util.Date;
 import java.math.BigDecimal;
+import java.util.List;
+
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -64,4 +66,60 @@ public class BusAgreementOrderFee implements Serializable {
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "结账时间")
     private Date settleTime;
+
+    /**项目名称*/
+    @Excel(name = "项目名称", width = 15)
+    @ApiModelProperty(value = "项目名称")
+    private java.lang.String projectName;
+    /**订单号*/
+    @Excel(name = "订单号", width = 15)
+    @ApiModelProperty(value = "订单号")
+    private java.lang.String orderNo;
+    /**类型(1-收款;2-退款)*/
+    @Excel(name = "类型(1-收款;2-退款)", width = 15)
+    @ApiModelProperty(value = "类型(1-收款;2-退款)")
+    private java.lang.Integer type;
+    /**金额*/
+    @Excel(name = "金额", width = 15)
+    @ApiModelProperty(value = "金额")
+    private java.math.BigDecimal payPrice;
+    /**支付方式*/
+    @Excel(name = "支付方式", width = 15)
+    @Dict(dictTable = "bus_room_pay_type_info", dicCode = "id", dicText = "name")
+    @ApiModelProperty(value = "支付方式")
+    private java.lang.String payType;
+    /**备注*/
+    @Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+    private java.lang.String remarks;
+    /**终端号*/
+    @Excel(name = "终端号", width = 15)
+    @ApiModelProperty(value = "终端号")
+    private java.lang.String terminalTrace;
+    /**状态(0-未结算;1-已结算)*/
+    @Excel(name = "状态(0-未结算;1-已结算)", width = 15)
+    @ApiModelProperty(value = "状态(0-未结算;1-已结算)")
+    private java.lang.Integer status;
+    /**类目*/
+    @Excel(name = "类目", width = 15)
+    @ApiModelProperty(value = "类目")
+    @Dict(dictTable = "ces_stock_type", dicCode = "id", dicText = "name")
+    private java.lang.String categoryId;
+    /**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    private transient List<BusCommodityRecord> commodityRecords;
+    private transient String guest;
+
+    /**关联的结算账单id*/
+    @Excel(name = "关联的结算账单id", width = 15)
+    @ApiModelProperty(value = "关联的结算账单id")
+    private String settlementOrderFeeId;
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    @Excel(name = "删除状态", width = 15,dicCode="del_flag")
+    @TableLogic
+    private Integer delFlag;
 }

+ 110 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusCommodityRecord.java

@@ -0,0 +1,110 @@
+package org.jeecg.modules.business.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 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:   2023-05-25
+ * @Version: V1.0
+ */
+@Data
+@TableName("bus_commodity_record_info")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="bus_commodity_record_info对象", description="协议单位-商品记录")
+public class BusCommodityRecord implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+	/**id*/
+	@TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private String id;
+	/**关联的协议账单id*/
+	@Excel(name = "关联的协议账单id", width = 15)
+    @ApiModelProperty(value = "关联的协议账单id")
+    private String agreementOrderFeeId;
+	/**类目*/
+	@Excel(name = "类目", width = 15)
+    @ApiModelProperty(value = "类目")
+    @Dict(dictTable = "ces_stock_type", dicCode = "id", dicText = "name")
+    private String categoryId;
+	/**二级类目*/
+	@Excel(name = "二级类目", width = 15)
+    @ApiModelProperty(value = "二级类目")
+    @Dict(dictTable = "ces_stock_type", dicCode = "id", dicText = "name")
+    private String categoryTwoId;
+	/**商品*/
+	@Excel(name = "商品", width = 15)
+    @Dict(dictTable = "ces_goods", dicCode = "id", dicText = "name")
+    @ApiModelProperty(value = "商品")
+    private String goodsId;
+	/**单价*/
+	@Excel(name = "单价", width = 15)
+    @ApiModelProperty(value = "单价")
+    private BigDecimal shopPrice;
+	/**数量*/
+	@Excel(name = "数量", width = 15)
+    @ApiModelProperty(value = "数量")
+    private BigDecimal buyNumber;
+    /**退货数量*/
+    @Excel(name = "退货数量", width = 15)
+    @ApiModelProperty(value = "退货数量")
+    private BigDecimal returnNumber;
+	/**购买人*/
+	@Excel(name = "购买人", width = 15)
+    @ApiModelProperty(value = "购买人")
+    private String purchaserName;
+	/**购买总价格*/
+	@Excel(name = "购买总价格", width = 15)
+    @ApiModelProperty(value = "购买总价格")
+    private BigDecimal amount;
+	/**备注*/
+	@Excel(name = "备注", width = 15)
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+	/**状态(0-未退货;1-已退货)*/
+	@Excel(name = "状态(0-未退货;1-已退货)", width = 15)
+    @ApiModelProperty(value = "状态(0-未退货;1-已退货)")
+    private Integer status;
+	/**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+	/**创建时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+	/**更新人*/
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+	/**更新时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern="yyyy-MM-dd")
+    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+    /**
+     * 删除状态(0,正常,1已删除)
+     */
+    @Excel(name = "删除状态", width = 15,dicCode="del_flag")
+    @TableLogic
+    private Integer delFlag;
+
+    private transient BigDecimal returnMaxNumber;
+}

+ 53 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/AgreementOrderStatusEnum.java

@@ -0,0 +1,53 @@
+package org.jeecg.modules.business.enums;
+import org.jeecg.common.system.annotation.EnumDict;
+import org.jeecg.common.system.vo.DictModel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@EnumDict("AgreementOrderStatusEnum")
+public enum AgreementOrderStatusEnum {
+    NOT_SETTLEMENT(1,"未结算"),
+    SETTLEMENT(2,"已结算");
+
+    Integer key;
+
+    String title;
+
+    AgreementOrderStatusEnum(Integer key, String title){
+        this.key = key;
+        this.title = title;
+    }
+    public Integer getKey() {
+        return key;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * 获取字典数据
+     * @return
+     */
+    public static List<DictModel> getDictList(){
+        List<DictModel> list = new ArrayList<>();
+        DictModel dictModel = null;
+        for(CouponsEventEnum e: CouponsEventEnum.values()){
+            dictModel = new DictModel();
+            dictModel.setValue(e.key.toString());
+            dictModel.setText(e.title);
+            list.add(dictModel);
+        }
+        return list;
+    }
+
+    public static AgreementOrderStatusEnum val(Integer key){
+        for(AgreementOrderStatusEnum bld: values()){
+            if(bld.key .equals(key)){
+                return bld;
+            }
+        }
+        return null;
+    }
+}

+ 54 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/enums/ReturnGoodsStatusEnum.java

@@ -0,0 +1,54 @@
+package org.jeecg.modules.business.enums;
+import org.jeecg.common.system.annotation.EnumDict;
+import org.jeecg.common.system.vo.DictModel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@EnumDict("ReturnGoodsStatusEnum")
+public enum ReturnGoodsStatusEnum {
+    NOT_RETURNED(0,"未退货"),
+    RETURNED(1,"已退货");
+
+    Integer key;
+
+    String title;
+
+    ReturnGoodsStatusEnum(Integer key, String title){
+        this.key = key;
+        this.title = title;
+    }
+    public Integer getKey() {
+        return key;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * 获取字典数据
+     * @return
+     */
+    public static List<DictModel> getDictList(){
+        List<DictModel> list = new ArrayList<>();
+        DictModel dictModel = null;
+        for(CouponsEventEnum e: CouponsEventEnum.values()){
+            dictModel = new DictModel();
+            dictModel.setValue(e.key.toString());
+            dictModel.setText(e.title);
+            list.add(dictModel);
+        }
+        return list;
+    }
+
+    public static ReturnGoodsStatusEnum val(Integer key){
+        for(ReturnGoodsStatusEnum bld: values()){
+            if(bld.key .equals(key)){
+                return bld;
+            }
+        }
+        return null;
+    }
+}
+

+ 17 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusCommodityRecordMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.business.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.business.entity.BusCommodityRecord;
+
+/**
+ * @Description: 协议单位-商品记录
+ * @Author: jeecg-boot
+ * @Date:   2023-05-25
+ * @Version: V1.0
+ */
+public interface BusCommodityRecordMapper extends BaseMapper<BusCommodityRecord> {
+
+}

+ 5 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/BusCommodityRecordMapper.xml

@@ -0,0 +1,5 @@
+<?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="org.jeecg.modules.business.mapper.BusCommodityRecordMapper">
+
+</mapper>

+ 2 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusAgreementOrderFeeService.java

@@ -1,7 +1,9 @@
 package org.jeecg.modules.business.service;
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.business.entity.BusAgreementOrderFee;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.business.entity.BusHotel;
 
 /**
  * @Description: bus_agreement_order_fee

+ 14 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IBusCommodityRecordService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.business.entity.BusCommodityRecord;
+
+/**
+ * @Description: 协议单位-商品记录
+ * @Author: jeecg-boot
+ * @Date:   2023-05-25
+ * @Version: V1.0
+ */
+public interface IBusCommodityRecordService extends IService<BusCommodityRecord> {
+
+}

+ 6 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusAgreementOrderFeeServiceImpl.java

@@ -1,12 +1,18 @@
 package org.jeecg.modules.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.business.entity.BusAgreementOrderFee;
+import org.jeecg.modules.business.entity.BusHotel;
 import org.jeecg.modules.business.mapper.BusAgreementOrderFeeMapper;
+import org.jeecg.modules.business.mapper.BusHotelMapper;
 import org.jeecg.modules.business.service.IBusAgreementOrderFeeService;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import javax.annotation.Resource;
+
 /**
  * @Description: bus_agreement_order_fee
  * @Author: jeecg-boot

+ 19 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusCommodityRecordServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.business.service.impl;
+
+import org.jeecg.modules.business.entity.BusCommodityRecord;
+import org.jeecg.modules.business.mapper.BusCommodityRecordMapper;
+import org.jeecg.modules.business.service.IBusCommodityRecordService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: 协议单位-商品记录
+ * @Author: jeecg-boot
+ * @Date:   2023-05-25
+ * @Version: V1.0
+ */
+@Service
+public class BusCommodityRecordServiceImpl extends ServiceImpl<BusCommodityRecordMapper, BusCommodityRecord> implements IBusCommodityRecordService {
+
+}