From a751ba885da1d226981efe6d5c49d5c352a852ce Mon Sep 17 00:00:00 2001 From: Gauthier LO Date: Fri, 13 Jun 2025 16:56:04 +0200 Subject: [PATCH] feat: shipping invoice remark --- .../admin/PlatformOrderController.java | 32 +++- .../admin/ShopOptionsController.java | 156 ++++++++++++++++++ .../modules/business/entity/ShopOptions.java | 113 +++++++++++++ .../business/mapper/ShopOptionsMapper.java | 19 +++ .../business/mapper/xml/ShopOptionsMapper.xml | 9 + .../business/service/IShopOptionsService.java | 17 ++ .../service/impl/InvoiceServiceImpl.java | 1 + .../service/impl/ShopOptionsServiceImpl.java | 28 ++++ 8 files changed, 366 insertions(+), 9 deletions(-) create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/ShopOptionsController.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/ShopOptions.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/ShopOptionsMapper.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/ShopOptionsMapper.xml create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IShopOptionsService.java create mode 100644 jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/ShopOptionsServiceImpl.java diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/PlatformOrderController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/PlatformOrderController.java index d7d940072..a53ce7823 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/PlatformOrderController.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/PlatformOrderController.java @@ -29,11 +29,8 @@ import org.jeecg.modules.business.domain.api.shouman.OrderCreationRequest; import org.jeecg.modules.business.domain.api.shouman.OrderCreationRequestBody; import org.jeecg.modules.business.domain.api.shouman.ShoumanOrderRequest; import org.jeecg.modules.business.domain.job.ThrottlingExecutorService; -import org.jeecg.modules.business.entity.Client; -import org.jeecg.modules.business.entity.PlatformOrder; -import org.jeecg.modules.business.entity.PlatformOrderContent; +import org.jeecg.modules.business.entity.*; import org.jeecg.modules.business.entity.Shouman.ShoumanOrder; -import org.jeecg.modules.business.entity.ShoumanOrderContent; import org.jeecg.modules.business.mapper.PlatformOrderContentMapper; import org.jeecg.modules.business.mapper.PlatformOrderMapper; import org.jeecg.modules.business.service.*; @@ -104,6 +101,8 @@ public class PlatformOrderController { @Autowired private IShopService shopService; @Autowired + private IShopOptionsService shopOptionsService; + @Autowired private ISecurityService securityService; @Autowired private ISysMessageService sysMessageService; @@ -669,15 +668,30 @@ public class PlatformOrderController { @PostMapping("/editOrdersRemark") public Result editOrdersRemark(@RequestBody InvoiceOrdersEditParam param) { + boolean isEmployee = securityService.checkIsEmployee(); String userId = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId(); - if(param.getInvoicingMethod() == PRESHIPPING) { + boolean hasRemarkInShippingInvoice = false; + List options = shopOptionsService.getByInvoiceNumber(param.getInvoiceNumber()); + for (ShopOptions option : options) { + if (option.getHasShippingInvoiceRemark()) { + hasRemarkInShippingInvoice = true; + break; + } + } + if((param.getInvoicingMethod() != null && param.getInvoicingMethod() == PRESHIPPING) || (hasRemarkInShippingInvoice && param.getInvoicingMethod() == null)) { ResponsesWithMsg mabangResponses = platformOrderMabangService.editOrdersRemark(param.getInvoiceNumber()); - if(!mabangResponses.getFailures().isEmpty()) - sysMessageService.sendProgress(userId, HttpStatus.BAD_REQUEST.value(),mabangResponses.getFailures(), "websocket.mabang.editOrdersRemarkError", "editOrdersRemark"); - else sysMessageService.sendProgress(userId, HttpStatus.OK.value(), null,"websocket.mabang.editOrdersRemarkSuccess", "editOrdersRemark"); + if(isEmployee) { + if (!mabangResponses.getFailures().isEmpty()) + sysMessageService.sendProgress(userId, HttpStatus.BAD_REQUEST.value(), mabangResponses.getFailures(), "websocket.mabang.editOrdersRemarkError", "editOrdersRemark"); + else + sysMessageService.sendProgress(userId, HttpStatus.OK.value(), null, "websocket.mabang.editOrdersRemarkSuccess", "editOrdersRemark"); + } return Result.OK(mabangResponses); } - sysMessageService.pushProgress(userId, "Method not supported"); + if(!hasRemarkInShippingInvoice && param.getInvoicingMethod() == null) { + return Result.OK(); + } + if (isEmployee) sysMessageService.pushProgress(userId, "Method not supported"); return Result.error(HttpStatus.NOT_FOUND.value(), "Invoicing method not supported"); } } \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/ShopOptionsController.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/ShopOptionsController.java new file mode 100644 index 000000000..519d69bb8 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/admin/ShopOptionsController.java @@ -0,0 +1,156 @@ +package org.jeecg.modules.business.controller.admin; + +import java.util.Arrays; +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.modules.business.entity.ShopOptions; +import org.jeecg.modules.business.service.IShopOptionsService; + +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.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 客户选项列表 + * @Author: jeecg-boot + * @Date: 2025-06-12 + * @Version: V1.0 + */ +@Api(tags="客户选项列表") +@RestController +@RequestMapping("/shopOptions") +@Slf4j +public class ShopOptionsController extends JeecgController { + @Autowired + private IShopOptionsService shopOptionsService; + + /** + * 分页列表查询 + * + * @param shopOptions + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "客户选项列表-分页列表查询") + @ApiOperation(value="客户选项列表-分页列表查询", notes="客户选项列表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ShopOptions shopOptions, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(shopOptions, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = shopOptionsService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param shopOptions + * @return + */ + @AutoLog(value = "客户选项列表-添加") + @ApiOperation(value="客户选项列表-添加", notes="客户选项列表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ShopOptions shopOptions) { + shopOptionsService.save(shopOptions); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param shopOptions + * @return + */ + @AutoLog(value = "客户选项列表-编辑") + @ApiOperation(value="客户选项列表-编辑", notes="客户选项列表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ShopOptions shopOptions) { + shopOptionsService.updateById(shopOptions); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "客户选项列表-通过id删除") + @ApiOperation(value="客户选项列表-通过id删除", notes="客户选项列表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + shopOptionsService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "客户选项列表-批量删除") + @ApiOperation(value="客户选项列表-批量删除", notes="客户选项列表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.shopOptionsService.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 queryById(@RequestParam(name="id",required=true) String id) { + ShopOptions shopOptions = shopOptionsService.getById(id); + if(shopOptions==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(shopOptions); + } + + /** + * 导出excel + * + * @param request + * @param shopOptions + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ShopOptions shopOptions) { + return super.exportXls(request, shopOptions, ShopOptions.class, "客户选项列表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ShopOptions.class); + } + +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/ShopOptions.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/ShopOptions.java new file mode 100644 index 000000000..dea7e05bf --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/ShopOptions.java @@ -0,0 +1,113 @@ +package org.jeecg.modules.business.entity; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.jeecg.common.aspect.annotation.Dict; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 客户选项列表 + * @Author: jeecg-boot + * @Date: 2025-06-12 + * @Version: V1.0 + */ +@Data +@TableName("shop_options") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="shop_options对象", description="客户选项列表") +public class ShopOptions implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @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; + /**店铺ID*/ + @Excel(name = "shop id", width = 15, dictTable = "shop", dicText = "erp_code", dicCode = "id") + @ApiModelProperty(value = "店铺ID") + @Dict(dictTable = "shop", dicText = "erp_code", dicCode = "id") + private java.lang.String shopId; + /**是否用余额*/ + @Excel(name = "是否使用余额", width = 15) + @ApiModelProperty(value = "是否使用余额") + private java.lang.Boolean useBalance; + /**是否可发票上显示账户余额*/ + @Excel(name = "是否可发票上显示账户余额", width = 15) + @ApiModelProperty(value = "是否可发票上显示账户余额") + private java.lang.Boolean showBalance; + /**余额阈值 default: -1.00 no limit, 0.00 if balance must be positive*/ + @Excel(name = "余额阈值", width = 15) + @ApiModelProperty(value = "余额阈值") + private java.lang.Integer balanceThreshold; + /**是否定时自动开票*/ + @Excel(name = "是否定时自动开票", width = 15) + @ApiModelProperty(value = "是否定时自动开票") + private java.lang.Boolean isAutoInvoice; + /**是否按订单时间顺序自动开票, only if threshhold >= 0*/ + @Excel(name = "是否按订单时间顺序自动开票", width = 15) + @ApiModelProperty(value = "是否按订单时间顺序自动开票") + private java.lang.Boolean isChronologicalOrder; + /**是否每周五 系统统一开票*/ + @Excel(name = "是否每周五系统统一开票", width = 15) + @ApiModelProperty(value = "是否每周五系统统一开票") + private java.lang.Boolean isBreakdownInvoice; + /**星期五自动开票是否开P+L, default: 0 = no only L,1 = P+L*/ + @Excel(name = "星期五自动开票是否开P+L, default: 0 = no only L,1 = P+L", width = 15) + @ApiModelProperty(value = "星期五自动开票是否开P+L, default: 0 = no only L,1 = P+L") + private java.lang.Boolean isCompleteInvoice; + /**是否客户可以自己开票*/ + @Excel(name = "是否客户可以自己开票", width = 15) + @ApiModelProperty(value = "是否客户可以自己开票") + private java.lang.Boolean canSelfInvoice; + /**是否可以开P票*/ + @Excel(name = "是否可以开P票", width = 15) + @ApiModelProperty(value = "是否可以开P票") + private java.lang.Boolean canSelfP; + /**是否可以开L票*/ + @Excel(name = "是否可以开L票", width = 15) + @ApiModelProperty(value = "是否可以开L票") + private java.lang.Boolean canSelfL; + /**是否可以开P+L票*/ + @Excel(name = "是否可以开P+L票", width = 15) + @ApiModelProperty(value = "是否可以开P+L票") + private java.lang.Boolean canSelfPL; + /**是否忽略库存数(7xxxx)*/ + @Excel(name = "是否忽略库存数(7xxxx)", width = 15) + @ApiModelProperty(value = "是否忽略库存数(7xxxx)") + private java.lang.Boolean isSelfIgnoreStock; + /**是否客户做库存*/ + @Excel(name = "是否客户做库存", width = 15) + @ApiModelProperty(value = "是否客户做库存") + private java.lang.Boolean hasStock; + /**是否开物流票写备注*/ + @Excel(name = "是否开物流票写备注", width = 15) + @ApiModelProperty(value = "是否开物流票写备注") + private java.lang.Boolean hasShippingInvoiceRemark; +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/ShopOptionsMapper.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/ShopOptionsMapper.java new file mode 100644 index 000000000..06a2dbab0 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/ShopOptionsMapper.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.business.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.business.entity.ShopOptions; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + * @Description: 客户选项列表 + * @Author: jeecg-boot + * @Date: 2025-06-12 + * @Version: V1.0 + */ +@Repository +public interface ShopOptionsMapper extends BaseMapper { + List getByInvoiceNumber(@Param("invoiceNumber") String invoiceNumber); +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/ShopOptionsMapper.xml b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/ShopOptionsMapper.xml new file mode 100644 index 000000000..32717c93e --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/xml/ShopOptionsMapper.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IShopOptionsService.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IShopOptionsService.java new file mode 100644 index 000000000..699b72207 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/IShopOptionsService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.business.service; + +import org.jeecg.modules.business.entity.ShopOptions; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * @Description: 客户选项列表 + * @Author: jeecg-boot + * @Date: 2025-06-12 + * @Version: V1.0 + */ +public interface IShopOptionsService extends IService { + + List getByInvoiceNumber(String invoiceNumber); +} diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/InvoiceServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/InvoiceServiceImpl.java index 9bcfaa835..95d322fba 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/InvoiceServiceImpl.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/InvoiceServiceImpl.java @@ -119,6 +119,7 @@ public class InvoiceServiceImpl extends ServiceImpl impl log.error("Shipping invoice {} is older than {}, client is not allowed to cancel it", invoiceNumber, CANCEL_DAYS_LIMIT); return false; } + platformOrderMabangService.deleteOrderRemark(invoiceNumber); platformOrderContentService.cancelInvoice(invoiceNumber, clientId); platformOrderService.cancelInvoice(invoiceNumber, clientId); shippingInvoiceService.cancelInvoice(id); diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/ShopOptionsServiceImpl.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/ShopOptionsServiceImpl.java new file mode 100644 index 000000000..0ee92c429 --- /dev/null +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/ShopOptionsServiceImpl.java @@ -0,0 +1,28 @@ +package org.jeecg.modules.business.service.impl; + +import org.jeecg.modules.business.entity.ShopOptions; +import org.jeecg.modules.business.mapper.ShopOptionsMapper; +import org.jeecg.modules.business.service.IShopOptionsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.util.List; + +/** + * @Description: 客户选项列表 + * @Author: jeecg-boot + * @Date: 2025-06-12 + * @Version: V1.0 + */ +@Service +public class ShopOptionsServiceImpl extends ServiceImpl implements IShopOptionsService { + + @Autowired + private ShopOptionsMapper shopOptionsMapper; + @Override + public List getByInvoiceNumber(String invoiceNumber) { + return shopOptionsMapper.getByInvoiceNumber(invoiceNumber); + } +}