56 changed files with 1402 additions and 126 deletions
@ -0,0 +1,115 @@ |
|||
package cc.hiver.core.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
public class ShopUserDto { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
@ApiModelProperty(value = "唯一标识") |
|||
private String id; |
|||
|
|||
@ApiModelProperty(value = "登录名") |
|||
private String username; |
|||
|
|||
@ApiModelProperty(value = "密码") |
|||
private String password; |
|||
|
|||
@ApiModelProperty(value = "用户名/昵称/姓名") |
|||
private String nickname; |
|||
|
|||
@ApiModelProperty(value = "手机") |
|||
private String mobile; |
|||
|
|||
@ApiModelProperty(value = "邮箱") |
|||
private String email; |
|||
|
|||
@ApiModelProperty(value = "省市县地址") |
|||
private String address; |
|||
|
|||
@ApiModelProperty(value = "街道地址") |
|||
private String street; |
|||
|
|||
@ApiModelProperty(value = "性别") |
|||
private String sex; |
|||
|
|||
@ApiModelProperty(value = "密码强度") |
|||
private String passStrength; |
|||
|
|||
@ApiModelProperty(value = "用户头像") |
|||
private String avatar; |
|||
|
|||
@ApiModelProperty(value = "用户类型 0-店铺 1-物流公司 2-客户") |
|||
private Integer type; |
|||
|
|||
@ApiModelProperty(value = "状态 默认0正常 -1拉黑") |
|||
private Integer status; |
|||
|
|||
@ApiModelProperty(value = "描述/详情/备注") |
|||
private String description; |
|||
|
|||
@ApiModelProperty(value = "所属部门id") |
|||
private String departmentId; |
|||
|
|||
@ApiModelProperty(value = "所属部门名称") |
|||
private String departmentTitle; |
|||
|
|||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
|||
@ApiModelProperty(value = "生日") |
|||
private Date birth; |
|||
|
|||
@ApiModelProperty(value = "邀请人ID") |
|||
private String inviteCode; |
|||
|
|||
@ApiModelProperty(value = "设备编号 推送用") |
|||
private String clientId; |
|||
|
|||
@ApiModelProperty(value = "小程序id") |
|||
private String miniProgramOpenid; |
|||
|
|||
@ApiModelProperty(value = "微信平台统一id") |
|||
private String unionid; |
|||
|
|||
@ApiModelProperty(value = "公众号id") |
|||
private String officialAccountOpenid; |
|||
|
|||
@ApiModelProperty(value = "微信昵称") |
|||
private String wechatName; |
|||
|
|||
@ApiModelProperty(value = "入库员标识:0:不是(数据库默认);1:是;") |
|||
private String warehouseKeeperFlag; |
|||
|
|||
public ShopUserDto(String id, String username, String password, String nickname, String mobile, String email, String address, String street, String sex, String passStrength, String avatar, Integer type, Integer status, String description, String departmentId, String departmentTitle, Date birth, String inviteCode, String clientId, String miniProgramOpenid, String unionid, String officialAccountOpenid, String wechatName, String warehouseKeeperFlag) { |
|||
this.id = id; |
|||
this.username = username; |
|||
this.password = password; |
|||
this.nickname = nickname; |
|||
this.mobile = mobile; |
|||
this.email = email; |
|||
this.address = address; |
|||
this.street = street; |
|||
this.sex = sex; |
|||
this.passStrength = passStrength; |
|||
this.avatar = avatar; |
|||
this.type = type; |
|||
this.status = status; |
|||
this.description = description; |
|||
this.departmentId = departmentId; |
|||
this.departmentTitle = departmentTitle; |
|||
this.birth = birth; |
|||
this.inviteCode = inviteCode; |
|||
this.clientId = clientId; |
|||
this.miniProgramOpenid = miniProgramOpenid; |
|||
this.unionid = unionid; |
|||
this.officialAccountOpenid = officialAccountOpenid; |
|||
this.wechatName = wechatName; |
|||
this.warehouseKeeperFlag = warehouseKeeperFlag; |
|||
} |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
package cc.hiver.mall.pojo.dto; |
|||
|
|||
import cc.hiver.core.entity.User; |
|||
import cc.hiver.mall.entity.Shop; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ShopUserDtoTwo { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "用户名称") |
|||
private String userName; |
|||
|
|||
@ApiModelProperty(value = "商铺名称") |
|||
private String shopName; |
|||
|
|||
@ApiModelProperty(value = "是否有维护成本权限 0:是;1否") |
|||
private Integer type; |
|||
|
|||
@ApiModelProperty(value = "店主名称") |
|||
private String shopOwnerName; |
|||
|
|||
@ApiModelProperty(value = "店主联系方式") |
|||
private String shopOwnerPhone; |
|||
|
|||
@ApiModelProperty(value = "打印方式") |
|||
private String printingMethod; |
|||
|
|||
@ApiModelProperty(value = "是否需要入库确认:0:不需要;1:需要(数据库默认为0)") |
|||
private String storeFlag; |
|||
|
|||
@ApiModelProperty(value = "入库员标识:0:不是(数据库默认);1:是;") |
|||
private String warehouseKeeperFlag; |
|||
|
|||
@ApiModelProperty(value = "店铺信息") |
|||
private Shop shop; |
|||
|
|||
@ApiModelProperty(value = "员工信息") |
|||
private User user; |
|||
|
|||
public ShopUserDtoTwo(String userName, String shopName, Integer type, String shopOwnerName, String shopOwnerPhone, String printingMethod, String storeFlag, String warehouseKeeperFlag, Shop shop, User user) { |
|||
this.userName = userName; |
|||
this.shopName = shopName; |
|||
this.type = type; |
|||
this.shopOwnerName = shopOwnerName; |
|||
this.shopOwnerPhone = shopOwnerPhone; |
|||
this.printingMethod = printingMethod; |
|||
this.storeFlag = storeFlag; |
|||
this.warehouseKeeperFlag = warehouseKeeperFlag; |
|||
this.shop = shop; |
|||
this.user = user; |
|||
} |
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
package cc.hiver.mall.purchaseconfirm.controller; |
|||
|
|||
|
|||
import cc.hiver.core.common.utils.ResultUtil; |
|||
import cc.hiver.core.common.utils.SecurityUtil; |
|||
import cc.hiver.core.common.vo.Result; |
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm; |
|||
import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmService; |
|||
import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 入库确认控制层 |
|||
* @author 王富康 |
|||
* @date 2025/3/9 |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@Api(tags = "入库确认控制层") |
|||
@RequestMapping("/hiver/app/purchaseConfirm/") |
|||
@Transactional |
|||
public class PurchaseConfirmController { |
|||
|
|||
@Autowired |
|||
private PurchaseConfirmService purchaseConfirmService; |
|||
|
|||
@Autowired |
|||
private SecurityUtil securityUtil; |
|||
|
|||
/** |
|||
* 新增入库确认信息 |
|||
* |
|||
* @param purchaseConfirm |
|||
* @return Result |
|||
* @author 王富康 |
|||
* @date 2024/6/1 |
|||
*/ |
|||
@RequestMapping(value = "/addPurchaseConfirm", method = RequestMethod.POST) |
|||
@ApiOperation("新增入库确认信息") |
|||
public Result addPurchaseConfirm(@RequestBody PurchaseConfirm purchaseConfirm) { |
|||
|
|||
try{ |
|||
purchaseConfirmService.addPurchaseConfirm(purchaseConfirm); |
|||
return ResultUtil.success("保存成功!"); |
|||
}catch (Exception e){ |
|||
log.error(e.getMessage(),e); |
|||
return ResultUtil.error("保存失败!"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 删除入库确认信息(更新删除标识) |
|||
* |
|||
* @param id |
|||
* @return Result |
|||
* @author 王富康 |
|||
* @date 2024/6/1 |
|||
*/ |
|||
@RequestMapping(value = "/deletePurchaseConfirm", method = RequestMethod.POST) |
|||
@ApiOperation("删除入库确认信息") |
|||
public Result deletePurchaseConfirm(String id) { |
|||
if (StringUtils.isEmpty(id)) { |
|||
return ResultUtil.error("入库确认信息id不能为空!"); |
|||
} |
|||
final boolean b = purchaseConfirmService.deletePurchaseConfirm(id); |
|||
if (b) { |
|||
return ResultUtil.success("删除成功!"); |
|||
} else { |
|||
return ResultUtil.error("删除失败!"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 根据入库单id查询入库确认表 |
|||
* @author 王富康 |
|||
* @date 2025/3/14 |
|||
* @param purchaseId |
|||
* @return Result |
|||
*/ |
|||
@RequestMapping(value = "/getPurchaseConfirmByPurchaseId", method = RequestMethod.POST) |
|||
@ApiOperation("根据入库单id查询入库确认表") |
|||
public Result getPurchaseConfirmByPurchaseId(String purchaseId) { |
|||
if (StringUtils.isEmpty(purchaseId)) { |
|||
return ResultUtil.error("入库单id不能为空!"); |
|||
} |
|||
final List<PurchaseConfirm> purchaseConfirms = purchaseConfirmService.getPurchaseConfirmByPurchaseId(purchaseId); |
|||
return new ResultUtil<>().setData(purchaseConfirms); |
|||
} |
|||
|
|||
// 根据商品id查询入库确认子表,在再联主表,返回该商品所有欠货数>0的记录,关联入库单时间和操作人。返回返回入库确认子表id、商品货号、名称、欠货数、入库时间、入库人
|
|||
@RequestMapping(value = "/getPurchaseConfirmDetailsByProductId", method = RequestMethod.POST) |
|||
@ApiOperation("根据商品id查询入库确认子表") |
|||
public Result getPurchaseConfirmDetailsByProductId(String productId) { |
|||
if (StringUtils.isEmpty(productId)) { |
|||
return ResultUtil.error("商品id不能为空!"); |
|||
} |
|||
final List<PurchaseConfirmVo> purchaseConfirmDetails = purchaseConfirmService.getPurchaseConfirmDetailsByProductId(productId); |
|||
return new ResultUtil<>().setData(purchaseConfirmDetails); |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package cc.hiver.mall.purchaseconfirm.controller; |
|||
|
|||
|
|||
import cc.hiver.core.common.utils.ResultUtil; |
|||
import cc.hiver.core.common.vo.Result; |
|||
import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmDetailsService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* 入库确认控制层 |
|||
* @author 王富康 |
|||
* @date 2025/3/9 |
|||
*/ |
|||
@Slf4j |
|||
@RestController |
|||
@Api(tags = "入库确认子表控制层") |
|||
@RequestMapping("/hiver/app/purchaseConfirmDetails/") |
|||
@Transactional |
|||
public class PurchaseConfirmDetailsController { |
|||
|
|||
@Autowired |
|||
private PurchaseConfirmDetailsService purchaseConfirmDetailsService; |
|||
|
|||
/** |
|||
* 根据入库确认表子表id更新未收货数 |
|||
* @author 王富康 |
|||
* @date 2025/3/9 |
|||
* @param id |
|||
* @param productCount |
|||
* @return Result |
|||
*/ |
|||
@RequestMapping(value = "/updateProductCount", method = RequestMethod.POST) |
|||
@ApiOperation("根据入库确认表子表id更新未收货数") |
|||
public Result updateProductCount(String id,String productCount) { |
|||
if (StringUtils.isEmpty(id)) { |
|||
return ResultUtil.error("入库确认表子表id不能为空!"); |
|||
} |
|||
try{ |
|||
purchaseConfirmDetailsService.updateProductCount(id,productCount); |
|||
return ResultUtil.success("更新成功!"); |
|||
}catch (Exception e){ |
|||
return ResultUtil.error("更新失败!"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package cc.hiver.mall.purchaseconfirm.entity; |
|||
|
|||
import cc.hiver.core.base.HiverBaseEntity; |
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import org.springframework.data.annotation.CreatedBy; |
|||
|
|||
import javax.persistence.Transient; |
|||
import java.util.List; |
|||
|
|||
@EqualsAndHashCode(callSuper = true) |
|||
@Data |
|||
@ApiModel(value = "入库确认表") |
|||
@TableName(value = "t_purchase_confirm", autoResultMap = true) |
|||
public class PurchaseConfirm extends HiverBaseEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "创建者") |
|||
@CreatedBy |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createByName; |
|||
|
|||
@ApiModelProperty(value = "入库单id") |
|||
private String purchaseId; |
|||
|
|||
@ApiModelProperty(value = "供应商id") |
|||
private String supplierId; |
|||
|
|||
@ApiModelProperty(value = "供应商名称") |
|||
private String supplierName; |
|||
|
|||
@ApiModelProperty(value = "入库单时间") |
|||
private String purchaseTime; |
|||
|
|||
@Transient |
|||
@TableField(exist = false) |
|||
@ApiModelProperty(value = "入库确认子表信息") |
|||
private List<PurchaseConfirmDetails> purchaseConfirmDetailsList; |
|||
|
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
package cc.hiver.mall.purchaseconfirm.entity; |
|||
|
|||
import cc.hiver.core.common.utils.SnowFlakeUtil; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.persistence.Id; |
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "入库确认-子表表") |
|||
@TableName(value = "t_purchase_confirm_details", autoResultMap = true) |
|||
public class PurchaseConfirmDetails implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@Id |
|||
@TableId |
|||
@ApiModelProperty(value = "唯一标识") |
|||
private String id = SnowFlakeUtil.nextId().toString(); |
|||
|
|||
@ApiModelProperty(value = "入库单id") |
|||
private String purchaseConfirmId; |
|||
|
|||
@ApiModelProperty(value = "商品id") |
|||
private String productId; |
|||
|
|||
@ApiModelProperty(value = "商品名称") |
|||
private String productName; |
|||
|
|||
@ApiModelProperty(value = "商品货号") |
|||
private String productSn; |
|||
|
|||
@ApiModelProperty(value = "未入库商品数量") |
|||
private String productCount; |
|||
|
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
package cc.hiver.mall.purchaseconfirm.mapper; |
|||
|
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Repository |
|||
public interface PurchaseConfirmDetailsMapper extends BaseMapper<PurchaseConfirmDetails> { |
|||
|
|||
/** |
|||
* 根据入库确认表子表id更新未收货数 |
|||
* @author 王富康 |
|||
* @date 2025/3/9 |
|||
* @param id |
|||
* @param productCount |
|||
*/ |
|||
void updateProductCount( @Param("id")String id, @Param("productCount")String productCount); |
|||
|
|||
/** |
|||
* 根据purchaseConfirmIds 查询子表信息 |
|||
* @author 王富康 |
|||
* @date 2025/3/14 |
|||
* @param purchaseConfirmIds |
|||
* @return List<PurchaseConfirmDetails> |
|||
*/ |
|||
List<PurchaseConfirmDetails> getDetailsByPurchaseConfirmIds(@Param("purchaseConfirmIds") List<String> purchaseConfirmIds); |
|||
|
|||
void deleteByPurchaseId(@Param("purchaseId") String purchaseId); |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package cc.hiver.mall.purchaseconfirm.mapper; |
|||
|
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm; |
|||
import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
@Repository |
|||
public interface PurchaseConfirmMapper extends BaseMapper<PurchaseConfirm> { |
|||
|
|||
boolean updatePurchaseConfirmDelFlag(String id, String s); |
|||
|
|||
Integer notConfirmPurductCount( @Param("supplierId") String supplierId); |
|||
|
|||
List<PurchaseConfirmVo> purchaseNotConfirmPurductCount(@Param("supplierId") String supplierId); |
|||
|
|||
List<PurchaseConfirmVo> productNotConfirmPurductCount(@Param("supplierId") String supplierId); |
|||
|
|||
int shopNotConfirmPurductCount(@Param("shopId") String shopId); |
|||
|
|||
List<PurchaseConfirmVo> supplierNotConfirmPurductCount(@Param("supplierIdList") List<String> supplierIds); |
|||
|
|||
List<PurchaseConfirm> selectByPurchaseId(@Param("purchaseId") String purchaseId); |
|||
|
|||
List<PurchaseConfirmVo> getPurchaseConfirmDetailsByProductId(@Param("productId")String productId); |
|||
|
|||
void deleteByPurchaseId(@Param("purchaseId") String purchaseId); |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
package cc.hiver.mall.purchaseconfirm.service; |
|||
|
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface PurchaseConfirmDetailsService extends IService<PurchaseConfirmDetails> { |
|||
|
|||
/** |
|||
* 根据入库确认表子表id更新未收货数 |
|||
* @author 王富康 |
|||
* @date 2025/3/9 |
|||
* @param id |
|||
* @param productCount |
|||
*/ |
|||
void updateProductCount(String id, String productCount); |
|||
|
|||
/** |
|||
* 根据purchaseConfirmIds 查询子表信息 |
|||
* @author 王富康 |
|||
* @date 2025/3/14 |
|||
* @param purchaseConfirmIds |
|||
* @return List<PurchaseConfirmDetails> |
|||
*/ |
|||
List<PurchaseConfirmDetails> getDetailsByPurchaseConfirmIds(List<String> purchaseConfirmIds); |
|||
|
|||
void deleteByPurchaseId(String purchaseId); |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package cc.hiver.mall.purchaseconfirm.service; |
|||
|
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm; |
|||
import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface PurchaseConfirmService extends IService<PurchaseConfirm> { |
|||
|
|||
/** |
|||
* 删除货号规则 |
|||
* |
|||
* @param id |
|||
* @return boolean |
|||
* @author 王富康 |
|||
* @date 2024/6/1 |
|||
*/ |
|||
boolean deletePurchaseConfirm(String id); |
|||
|
|||
Integer notConfirmPurductCount(String supplierId); |
|||
|
|||
List<PurchaseConfirmVo> purchaseNotConfirmPurductCount(String supplierId); |
|||
|
|||
List<PurchaseConfirmVo> productNotConfirmPurductCount(String supplierId); |
|||
|
|||
int shopNotConfirmPurductCount(String shopId); |
|||
|
|||
List<PurchaseConfirmVo> supplierNotConfirmPurductCount(List<String> supplierIds); |
|||
|
|||
void addPurchaseConfirm(PurchaseConfirm purchaseConfirm); |
|||
|
|||
/** |
|||
* 根据入库单id查询入库确认表 |
|||
* @author 王富康 |
|||
* @date 2025/3/14 |
|||
* @param purchaseId |
|||
* @return List<PurchaseConfirm> |
|||
*/ |
|||
List<PurchaseConfirm> getPurchaseConfirmByPurchaseId(String purchaseId); |
|||
|
|||
List<PurchaseConfirmVo> getPurchaseConfirmDetailsByProductId(String productId); |
|||
|
|||
void deleteByPurchaseId(String purchaseId); |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package cc.hiver.mall.purchaseconfirm.service.impl; |
|||
|
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails; |
|||
import cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmDetailsMapper; |
|||
import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmDetailsService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Service |
|||
public class PurchaseConfirmDetailsServiceImpl extends ServiceImpl<PurchaseConfirmDetailsMapper, PurchaseConfirmDetails> implements PurchaseConfirmDetailsService { |
|||
|
|||
@Autowired |
|||
private PurchaseConfirmDetailsMapper purchaseConfirmDetailsMapper; |
|||
|
|||
/** |
|||
* 根据入库确认表子表id更新未收货数 |
|||
* @author 王富康 |
|||
* @date 2025/3/9 |
|||
* @param id |
|||
* @param productCount |
|||
*/ |
|||
@Override |
|||
public void updateProductCount(String id, String productCount) { |
|||
purchaseConfirmDetailsMapper.updateProductCount(id, productCount); |
|||
} |
|||
|
|||
/** |
|||
* 根据purchaseConfirmIds 查询子表信息 |
|||
* @author 王富康 |
|||
* @date 2025/3/14 |
|||
* @param purchaseConfirmIds |
|||
* @return List<PurchaseConfirmDetails> |
|||
*/ |
|||
@Override |
|||
public List<PurchaseConfirmDetails> getDetailsByPurchaseConfirmIds(List<String> purchaseConfirmIds) { |
|||
return purchaseConfirmDetailsMapper.getDetailsByPurchaseConfirmIds(purchaseConfirmIds); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteByPurchaseId(String purchaseId) { |
|||
purchaseConfirmDetailsMapper.deleteByPurchaseId(purchaseId); |
|||
} |
|||
} |
|||
@ -0,0 +1,133 @@ |
|||
package cc.hiver.mall.purchaseconfirm.service.impl; |
|||
|
|||
import cc.hiver.core.common.constant.CommonConstant; |
|||
import cc.hiver.core.common.utils.SnowFlakeUtil; |
|||
import cc.hiver.mall.common.constant.PurchaseConstant; |
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm; |
|||
import cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails; |
|||
import cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmMapper; |
|||
import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmDetailsService; |
|||
import cc.hiver.mall.purchaseconfirm.service.PurchaseConfirmService; |
|||
import cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo; |
|||
import cc.hiver.mall.service.mybatis.PurchaseService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class PurchaseConfirmServiceImpl extends ServiceImpl<PurchaseConfirmMapper, PurchaseConfirm> implements PurchaseConfirmService { |
|||
|
|||
@Autowired |
|||
private PurchaseConfirmMapper purchaseConfirmMapper; |
|||
|
|||
@Autowired |
|||
private PurchaseConfirmDetailsService purchaseConfirmDetailsService; |
|||
|
|||
@Autowired |
|||
private PurchaseService purchaseService; |
|||
|
|||
|
|||
/** |
|||
* 删除货号规则 |
|||
* |
|||
* @param id |
|||
* @return boolean |
|||
* @author 王富康 |
|||
* @date 2024/6/1 |
|||
*/ |
|||
@Override |
|||
public boolean deletePurchaseConfirm(String id) { |
|||
return purchaseConfirmMapper.updatePurchaseConfirmDelFlag(id, String.valueOf(CommonConstant.DEL_FLAG_TRUE)); |
|||
} |
|||
|
|||
@Override |
|||
public Integer notConfirmPurductCount(String supplierId) { |
|||
return purchaseConfirmMapper.notConfirmPurductCount(supplierId); |
|||
} |
|||
|
|||
@Override |
|||
public List<PurchaseConfirmVo> purchaseNotConfirmPurductCount(String supplierId) { |
|||
return purchaseConfirmMapper.purchaseNotConfirmPurductCount(supplierId); |
|||
} |
|||
|
|||
@Override |
|||
public List<PurchaseConfirmVo> productNotConfirmPurductCount(String supplierId) { |
|||
return purchaseConfirmMapper.productNotConfirmPurductCount(supplierId); |
|||
} |
|||
|
|||
@Override |
|||
public int shopNotConfirmPurductCount(String shopId) { |
|||
return purchaseConfirmMapper.shopNotConfirmPurductCount(shopId); |
|||
} |
|||
|
|||
@Override |
|||
public List<PurchaseConfirmVo> supplierNotConfirmPurductCount(List<String> supplierIds) { |
|||
return purchaseConfirmMapper.supplierNotConfirmPurductCount(supplierIds); |
|||
} |
|||
|
|||
@Override |
|||
public void addPurchaseConfirm(PurchaseConfirm purchaseConfirm) { |
|||
final String id = SnowFlakeUtil.nextId().toString(); |
|||
purchaseConfirm.setId(id); |
|||
purchaseConfirmMapper.insert(purchaseConfirm); |
|||
// 批量保存子表是数据
|
|||
final List<PurchaseConfirmDetails> purchaseConfirmDetailsList = purchaseConfirm.getPurchaseConfirmDetailsList(); |
|||
for (PurchaseConfirmDetails purchaseConfirmDetails : purchaseConfirmDetailsList) { |
|||
purchaseConfirmDetails.setPurchaseConfirmId(id); |
|||
} |
|||
purchaseConfirmDetailsService.saveBatch(purchaseConfirmDetailsList); |
|||
|
|||
// 更新入库单位已确认入库。
|
|||
purchaseService.updataStoreFlag(purchaseConfirm.getPurchaseId(), PurchaseConstant.STORE_FLAG[0]); |
|||
} |
|||
|
|||
/** |
|||
* 根据入库单id查询入库确认表 |
|||
* @author 王富康 |
|||
* @date 2025/3/14 |
|||
* @param purchaseId |
|||
* @return List<PurchaseConfirm> |
|||
*/ |
|||
@Override |
|||
public List<PurchaseConfirm> getPurchaseConfirmByPurchaseId(String purchaseId) { |
|||
final List<PurchaseConfirm> purchaseConfirms = purchaseConfirmMapper.selectByPurchaseId(purchaseId); |
|||
// 查询子表信息。
|
|||
final List<String> purchaseConfirmIds = new ArrayList<>(); |
|||
for (PurchaseConfirm purchaseConfirm : purchaseConfirms) { |
|||
purchaseConfirmIds.add(purchaseConfirm.getId()); |
|||
} |
|||
// 根据purchaseConfirmIds 查询子表信息
|
|||
final List<PurchaseConfirmDetails> purchaseConfirmDetailsList = purchaseConfirmDetailsService.getDetailsByPurchaseConfirmIds(purchaseConfirmIds); |
|||
final Map<String,List<PurchaseConfirmDetails>> purchaseConfirmDetailMap = new HashMap<>(); |
|||
for (PurchaseConfirmDetails purchaseConfirmDetails : purchaseConfirmDetailsList) { |
|||
final String purchaseConfirmId = purchaseConfirmDetails.getPurchaseConfirmId(); |
|||
if(purchaseConfirmDetailMap.containsKey(purchaseConfirmId)){ |
|||
purchaseConfirmDetailMap.get(purchaseConfirmId).add(purchaseConfirmDetails); |
|||
}else{ |
|||
final List<PurchaseConfirmDetails> purchaseConfirmDetailsLists = new ArrayList<>(); |
|||
purchaseConfirmDetailsLists.add(purchaseConfirmDetails); |
|||
purchaseConfirmDetailMap.put(purchaseConfirmId,purchaseConfirmDetailsLists); |
|||
} |
|||
} |
|||
for (PurchaseConfirm purchaseConfirm : purchaseConfirms) { |
|||
purchaseConfirm.setPurchaseConfirmDetailsList(purchaseConfirmDetailMap.get(purchaseConfirm.getId())); |
|||
} |
|||
return purchaseConfirms; |
|||
} |
|||
|
|||
@Override |
|||
public List<PurchaseConfirmVo> getPurchaseConfirmDetailsByProductId(String productId) { |
|||
return purchaseConfirmMapper.getPurchaseConfirmDetailsByProductId(productId); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteByPurchaseId(String purchaseId) { |
|||
purchaseConfirmMapper.deleteByPurchaseId(purchaseId); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package cc.hiver.mall.purchaseconfirm.vo; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class PurchaseConfirmVo { |
|||
|
|||
@ApiModelProperty(value = "子表id") |
|||
private String purchaseConfirmDetailsId; |
|||
|
|||
@ApiModelProperty(value = "入库单id") |
|||
private String purchaseId; |
|||
|
|||
@ApiModelProperty(value = "入库人名") |
|||
private String createByName; |
|||
|
|||
@ApiModelProperty(value = "入库时间") |
|||
private String purchaseTime; |
|||
|
|||
@ApiModelProperty(value = "供应商id") |
|||
private String supplierId; |
|||
|
|||
@ApiModelProperty(value = "商品id") |
|||
private String productId; |
|||
|
|||
@ApiModelProperty(value = "商品名称") |
|||
private String productName; |
|||
|
|||
@ApiModelProperty(value = "商品货号") |
|||
private String productSn; |
|||
|
|||
@ApiModelProperty(value = "商品数量") |
|||
private Integer totalUnshippedCount; |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
<?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="cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmDetailsMapper"> |
|||
<resultMap id="BaseResultMap" type="cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirmDetails"> |
|||
<id column="id" jdbcType="VARCHAR" property="id" /> |
|||
<result column="purchase_confirm_id" jdbcType="VARCHAR" property="purchaseConfirmId" /> |
|||
<result column="product_id" jdbcType="VARCHAR" property="productId" /> |
|||
<result column="product_name" jdbcType="VARCHAR" property="productName" /> |
|||
<result column="product_sn" jdbcType="VARCHAR" property="productSn" /> |
|||
<result column="product_count" jdbcType="INTEGER" property="productCount" /> |
|||
</resultMap> |
|||
<sql id="Base_Column_List"> |
|||
id, purchase_confirm_id, product_id, product_name,product_sn,product_count |
|||
</sql> |
|||
|
|||
<!-- --> |
|||
<update id="updateProductCount" parameterType="java.lang.String"> |
|||
update t_purchase_confirm_details |
|||
set product_count = #{productCount,jdbcType=VARCHAR} |
|||
where id = #{id,jdbcType=VARCHAR} |
|||
</update> |
|||
|
|||
<select id="getDetailsByPurchaseConfirmIds" parameterType="java.lang.String" resultMap="BaseResultMap"> |
|||
select |
|||
<include refid="Base_Column_List"/> |
|||
from t_purchase_confirm_details |
|||
where product_count > 0 |
|||
and purchase_confirm_id in |
|||
<foreach close=")" collection="purchaseConfirmIds" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</select> |
|||
|
|||
<delete id="deleteByPurchaseId" parameterType="java.lang.String"> |
|||
delete from t_purchase_confirm_details |
|||
where purchase_confirm_id in ( |
|||
select id from t_purchase_confirm where purchase_id = #{purchaseId,jdbcType=VARCHAR} |
|||
) |
|||
</delete> |
|||
</mapper> |
|||
@ -0,0 +1,135 @@ |
|||
<?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="cc.hiver.mall.purchaseconfirm.mapper.PurchaseConfirmMapper"> |
|||
<resultMap id="BaseResultMap" type="cc.hiver.mall.purchaseconfirm.entity.PurchaseConfirm"> |
|||
<id column="id" jdbcType="VARCHAR" property="id" /> |
|||
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> |
|||
<result column="create_by_name" jdbcType="VARCHAR" property="createByName" /> |
|||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
|||
<result column="del_flag" jdbcType="INTEGER" property="delFlag" /> |
|||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" /> |
|||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |
|||
<result column="purchase_id" jdbcType="VARCHAR" property="purchaseId" /> |
|||
<result column="supplier_id" jdbcType="VARCHAR" property="supplierId" /> |
|||
<result column="supplier_name" jdbcType="VARCHAR" property="supplierName" /> |
|||
<result column="purchase_time" jdbcType="INTEGER" property="purchaseTime" /> |
|||
</resultMap> |
|||
<sql id="Base_Column_List"> |
|||
id, create_by,create_by_name, create_time, del_flag, update_by, update_time,purchase_id,supplier_id,supplier_name,purchase_time |
|||
</sql> |
|||
|
|||
<!-- --> |
|||
<update id="updatePurchaseConfirmDelFlag" parameterType="java.lang.String"> |
|||
update t_purchase_confirm |
|||
set del_flag = #{delFlag,jdbcType=VARCHAR} |
|||
where id = #{id,jdbcType=VARCHAR} |
|||
</update> |
|||
|
|||
<select id="notConfirmPurductCount" resultType="java.lang.Integer"> |
|||
SELECT |
|||
COALESCE(SUM(pcd.product_count), 0) AS total_product_count |
|||
FROM |
|||
t_purchase_confirm_details pcd |
|||
JOIN |
|||
t_purchase_confirm pc ON pcd.purchase_confirm_id = pc.id |
|||
WHERE |
|||
pc.supplier_id = #{supplierId,jdbcType=VARCHAR} |
|||
</select> |
|||
|
|||
<select id="purchaseNotConfirmPurductCount" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo"> |
|||
SELECT |
|||
pc.purchase_id, |
|||
pc.create_by_name, |
|||
pc.purchase_time, |
|||
COALESCE(SUM(pcd.product_count), 0) AS total_unshipped_count |
|||
FROM |
|||
t_purchase_confirm pc |
|||
JOIN |
|||
t_purchase_confirm_details pcd ON pc.id = pcd.purchase_confirm_id |
|||
WHERE |
|||
pcd.product_count > 0 -- 未发货的记录 |
|||
AND pc.supplier_id = #{supplierId,jdbcType=VARCHAR} |
|||
GROUP BY |
|||
pc.purchase_id,pc.create_by_name,pc.purchase_time; |
|||
</select> |
|||
|
|||
<select id="productNotConfirmPurductCount" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo"> |
|||
SELECT |
|||
pcd.product_id, |
|||
pcd.product_name, |
|||
pcd.product_sn, |
|||
COALESCE(SUM(pcd.product_count), 0) AS total_unshipped_count |
|||
FROM |
|||
t_purchase_confirm pc |
|||
JOIN |
|||
t_purchase_confirm_details pcd ON pc.id = pcd.purchase_confirm_id |
|||
WHERE |
|||
pcd.product_count > 0 |
|||
AND pc.supplier_id = #{supplierId,jdbcType=VARCHAR} |
|||
GROUP BY |
|||
pcd.product_id, |
|||
pcd.product_name, |
|||
pcd.product_sn; |
|||
</select> |
|||
|
|||
<select id="shopNotConfirmPurductCount" resultType="java.lang.Integer"> |
|||
SELECT |
|||
COALESCE(SUM(pcd.product_count), 0) AS total_product_count |
|||
FROM |
|||
t_purchase_confirm_details pcd |
|||
JOIN |
|||
t_purchase_confirm pc ON pcd.purchase_confirm_id = pc.id |
|||
JOIN |
|||
t_purchase p ON pc.purchase_id = p.id |
|||
WHERE |
|||
p.shop_id = #{shopId,jdbcType=VARCHAR} |
|||
</select> |
|||
|
|||
<select id="supplierNotConfirmPurductCount" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo"> |
|||
SELECT |
|||
pc.supplier_id, |
|||
COALESCE(SUM(pcd.product_count), 0) AS total_unshipped_count |
|||
FROM |
|||
t_purchase_confirm pc |
|||
JOIN |
|||
t_purchase_confirm_details pcd ON pc.id = pcd.purchase_confirm_id |
|||
WHERE |
|||
pcd.product_count > 0 -- 未发货的记录 |
|||
AND pc.supplier_id in |
|||
<foreach close=")" collection="supplierIdList" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
GROUP BY |
|||
pc.supplier_id; -- 根据 t_purchase_confirm_details 的 product_id 分组 |
|||
</select> |
|||
|
|||
<select id="selectByPurchaseId" resultMap="BaseResultMap"> |
|||
select |
|||
<include refid="Base_Column_List" /> |
|||
from t_purchase_confirm a |
|||
where a.purchase_id = #{purchaseId,jdbcType=VARCHAR} |
|||
</select> |
|||
|
|||
<select id="getPurchaseConfirmDetailsByProductId" resultType="cc.hiver.mall.purchaseconfirm.vo.PurchaseConfirmVo"> |
|||
SELECT |
|||
pcd.id as purchase_confirmdetails_id, |
|||
pcd.product_id, |
|||
pcd.product_name, |
|||
pcd.product_sn, |
|||
COALESCE(pcd.product_count, 0) AS total_unshipped_count, |
|||
pc.purchase_time, |
|||
pc.create_by_name |
|||
FROM |
|||
t_purchase_confirm_details pcd |
|||
left JOIN |
|||
t_purchase_confirm pc ON pc.id = pcd.purchase_confirm_id |
|||
WHERE |
|||
pcd.product_count > 0 |
|||
AND pcd.product_id = #{productId,jdbcType=VARCHAR} |
|||
</select> |
|||
|
|||
<delete id="deleteByPurchaseId" parameterType="java.lang.String"> |
|||
delete from t_purchase_confirm |
|||
where purchase_id = #{purchaseId,jdbcType=VARCHAR} |
|||
</delete> |
|||
</mapper> |
|||
Loading…
Reference in new issue