21 changed files with 631 additions and 0 deletions
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualdetails; |
||||
|
|
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:29 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScmVehicleActualDetails extends BaseEntity { |
||||
|
private static final long serialVersionUID = 8008152391857378580L; |
||||
|
@ApiModelProperty(value = "车辆未售买断申请sid") |
||||
|
private String vehicleActualSid; |
||||
|
@ApiModelProperty(value = "车架号") |
||||
|
private String vinNo; |
||||
|
@ApiModelProperty(value = "车型名称") |
||||
|
private String modelName; |
||||
|
@ApiModelProperty(value = "入库日期") |
||||
|
private Date inboundDate; |
||||
|
@ApiModelProperty(value = "入库价") |
||||
|
private String inboundPrice; |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualdetails; |
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:35 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScmVehicleActualDetailsDto implements Dto { |
||||
|
private static final long serialVersionUID = 4387929122120092628L; |
||||
|
|
||||
|
@ApiModelProperty(value = "车架号") |
||||
|
private String vinNo; |
||||
|
@ApiModelProperty(value = "车型名称") |
||||
|
private String modelName; |
||||
|
@ApiModelProperty(value = "入库日期") |
||||
|
private Date inboundDate; |
||||
|
@ApiModelProperty(value = "入库价") |
||||
|
private String inboundPrice; |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualdetails; |
||||
|
|
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 18:09 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-scm-ScmVehicleActualDetails", |
||||
|
name = "anrui-scm", |
||||
|
path = "v1/scmvehicleactualdetails", |
||||
|
fallback = ScmVehicleActualDetailsFeignFallback.class) |
||||
|
public interface ScmVehicleActualDetailsFeign { |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualdetails; |
||||
|
|
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 18:10 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Component |
||||
|
public class ScmVehicleActualDetailsFeignFallback { |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualsales; |
||||
|
|
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 11:33 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScmVehicleActualSales extends BaseEntity { |
||||
|
private static final long serialVersionUID = -8236776276492093631L; |
||||
|
@ApiModelProperty(value = "申请人") |
||||
|
private String applicationName; |
||||
|
@ApiModelProperty(value = "买断") |
||||
|
private String reason; |
||||
|
@ApiModelProperty(value = "节点状态") |
||||
|
private String nodeState; |
||||
|
@ApiModelProperty(value = "流程定义id") |
||||
|
private String procDefId; |
||||
|
@ApiModelProperty(value = "环节定义的sid") |
||||
|
private String nodeSid; |
||||
|
@ApiModelProperty(value = "流程实例的sid") |
||||
|
private String procInstSid; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualsales; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetailsDto; |
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:22 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScmVehicleActualSalesDto implements Dto { |
||||
|
private static final long serialVersionUID = 3125388598762096051L; |
||||
|
|
||||
|
@ApiModelProperty(value = "sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty(value = "申请人sid") |
||||
|
private String userSid; |
||||
|
@ApiModelProperty(value = "申请人") |
||||
|
private String applicationName; |
||||
|
@ApiModelProperty(value = "申请日期") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
@ApiModelProperty(value = "买断原因") |
||||
|
private String reason; |
||||
|
@ApiModelProperty(value = "车辆列表") |
||||
|
private List<ScmVehicleActualDetailsDto> detailsList; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualsales; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 11:57 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-scm-ScmVehicleActualSales", |
||||
|
name = "anrui-scm", |
||||
|
path = "v1/scmvehicleactualsales", |
||||
|
fallback = ScmVehicleActualSalesFeignFallback.class) |
||||
|
public interface ScmVehicleActualSalesFeign { |
||||
|
|
||||
|
@ApiOperation("分页列表") |
||||
|
@PostMapping("/listPage") |
||||
|
@ResponseBody |
||||
|
ResultBean<PagerVo<ScmVehicleActualSalesVo>> listPage(@RequestBody PagerQuery<ScmVehicleActualSalesQuery> pagerQuery); |
||||
|
|
||||
|
@ApiOperation("新增或修改") |
||||
|
@PostMapping("/saveOrUpdate") |
||||
|
@ResponseBody |
||||
|
ResultBean saveOrUpdate(@RequestBody ScmVehicleActualSalesDto scmVehicleActualSalesDto); |
||||
|
|
||||
|
@ApiOperation("提交") |
||||
|
@PostMapping("/submitVehicleSales") |
||||
|
@ResponseBody |
||||
|
ResultBean submitVehicleSales(@RequestBody ScmVehicleActualSalesDto scmVehicleActualSalesDto); |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualsales; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 11:59 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Component |
||||
|
public class ScmVehicleActualSalesFeignFallback implements ScmVehicleActualSalesFeign{ |
||||
|
@Override |
||||
|
public ResultBean<PagerVo<ScmVehicleActualSalesVo>> listPage(PagerQuery<ScmVehicleActualSalesQuery> pagerQuery) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean saveOrUpdate(ScmVehicleActualSalesDto scmVehicleActualSalesDto) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean submitVehicleSales(ScmVehicleActualSalesDto scmVehicleActualSalesDto) { |
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualsales; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:11 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScmVehicleActualSalesQuery implements Query { |
||||
|
private static final long serialVersionUID = 970443773657128722L; |
||||
|
@ApiModelProperty(value = "申请日期开始时间") |
||||
|
private String applyStartDate; |
||||
|
@ApiModelProperty(value = "申请日期结束时间") |
||||
|
private String applyEndDate; |
||||
|
@ApiModelProperty(value = "状态") |
||||
|
private String nodeState; |
||||
|
@ApiModelProperty(value = "车架号") |
||||
|
private String vinNo; |
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.yxt.anrui.scm.api.scmvehicleactualsales; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:02 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ScmVehicleActualSalesVo implements Vo { |
||||
|
private static final long serialVersionUID = -8518464944096578672L; |
||||
|
|
||||
|
@ApiModelProperty(value = "sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty(value = "节点状态") |
||||
|
private String nodeState; |
||||
|
@ApiModelProperty(value = "申请人") |
||||
|
private String applicationName; |
||||
|
@ApiModelProperty(value = "申请日期") |
||||
|
private String createTime; |
||||
|
@ApiModelProperty(value = "买断原因") |
||||
|
private String reason; |
||||
|
@ApiModelProperty(value = "台数") |
||||
|
private Integer num; |
||||
|
|
||||
|
@ApiModelProperty(value = "流程状态") //若不为0则办理不能点击
|
||||
|
private Integer flowState; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.yxt.anrui.scm.biz.scmvehicleactualdetails; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetails; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 18:12 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ScmVehicleActualDetailsMapper extends BaseMapper<ScmVehicleActualDetails> { |
||||
|
|
||||
|
List<ScmVehicleActualDetails> selectBySaleSid(String sid); |
||||
|
|
||||
|
int deleteBySaleSid(String sid); |
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
<?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="com.yxt.anrui.scm.biz.scmvehicleactualdetails.ScmVehicleActualDetailsMapper"> |
||||
|
<select id="selectBySaleSid" resultType="com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetails"> |
||||
|
select * |
||||
|
from scm_vehicle_actual_details |
||||
|
where vehicleActualSid = #{sid} |
||||
|
</select> |
||||
|
|
||||
|
<delete id="deleteBySaleSid"> |
||||
|
delete |
||||
|
from scm_vehicle_actual_details |
||||
|
where vehicleActualSid = #{sid} |
||||
|
</delete> |
||||
|
</mapper> |
@ -0,0 +1,17 @@ |
|||||
|
package com.yxt.anrui.scm.biz.scmvehicleactualdetails; |
||||
|
|
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetailsFeign; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 18:09 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Api(tags = "车辆未售买断管理") |
||||
|
@RequestMapping("v1/scmvehicleactualsales") |
||||
|
@Controller |
||||
|
public class ScmVehicleActualDetailsRest implements ScmVehicleActualDetailsFeign { |
||||
|
} |
@ -0,0 +1,58 @@ |
|||||
|
package com.yxt.anrui.scm.biz.scmvehicleactualdetails; |
||||
|
|
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetails; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetailsDto; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 18:11 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ScmVehicleActualDetailsService extends MybatisBaseService<ScmVehicleActualDetailsMapper, ScmVehicleActualDetails> { |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* |
||||
|
* @param detailsList |
||||
|
* @param saleSid |
||||
|
*/ |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void saveDetails(List<ScmVehicleActualDetailsDto> detailsList, String saleSid) { |
||||
|
ScmVehicleActualDetails scmVehicleActualDetails = null; |
||||
|
for (ScmVehicleActualDetailsDto dto : detailsList) { |
||||
|
scmVehicleActualDetails = new ScmVehicleActualDetails(); |
||||
|
BeanUtils.copyProperties(dto, scmVehicleActualDetails, scmVehicleActualDetails.getSid()); |
||||
|
scmVehicleActualDetails.setVehicleActualSid(saleSid); |
||||
|
save(scmVehicleActualDetails); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询 |
||||
|
* |
||||
|
* @param sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public List<ScmVehicleActualDetails> selectBySaleSid(String sid) { |
||||
|
return baseMapper.selectBySaleSid(sid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除原车辆退库详细并新增 |
||||
|
* |
||||
|
* @param sid 车辆退库sid |
||||
|
* @param detailsList 退库车辆详细 |
||||
|
*/ |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void updateListByReturnSid(String sid, List<ScmVehicleActualDetailsDto> detailsList) { |
||||
|
baseMapper.deleteBySaleSid(sid); |
||||
|
saveDetails(detailsList, sid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.yxt.anrui.scm.biz.scmvehicleactualsales; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSales; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:43 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface ScmVehicleActualSalesMapper extends BaseMapper<ScmVehicleActualSales> { |
||||
|
/** |
||||
|
* 分页列表 |
||||
|
* |
||||
|
* @param page 分页 |
||||
|
* @param qw 查询条件 |
||||
|
* @return |
||||
|
*/ |
||||
|
IPage<ScmVehicleActualSalesVo> pagerList(IPage<ScmVehicleActualSalesVo> page, @Param(Constants.WRAPPER) QueryWrapper<ScmVehicleActualSalesVo> qw); |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
<?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="com.yxt.anrui.scm.biz.scmvehicleactualsales.ScmVehicleActualSalesMapper"> |
||||
|
<select id="pagerList" resultType="com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesVo"> |
||||
|
select sv.sid, |
||||
|
sv.applicationName, |
||||
|
sv.createTime, |
||||
|
sv.reason, |
||||
|
(select count(*) from scm_vehicle_actual_details sa where sa.vehicleActualSid = sv.sid) as num |
||||
|
from scm_vehicle_actual_sales sv |
||||
|
${ew.customSqlSegment} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,45 @@ |
|||||
|
package com.yxt.anrui.scm.biz.scmvehicleactualsales; |
||||
|
|
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesDto; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesFeign; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesQuery; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesVo; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 15:05 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Api(tags = "车辆未售买断管理") |
||||
|
@RequestMapping("v1/scmvehicleactualsales") |
||||
|
@Controller |
||||
|
public class ScmVehicleActualSalesRest implements ScmVehicleActualSalesFeign { |
||||
|
|
||||
|
@Autowired |
||||
|
private ScmVehicleActualSalesService scmVehicleActualSalesService; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<PagerVo<ScmVehicleActualSalesVo>> listPage(PagerQuery<ScmVehicleActualSalesQuery> pagerQuery) { |
||||
|
ResultBean<PagerVo<ScmVehicleActualSalesVo>> rb = ResultBean.fireFail(); |
||||
|
PagerVo<ScmVehicleActualSalesVo> pv = scmVehicleActualSalesService.listPage(pagerQuery); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean saveOrUpdate(ScmVehicleActualSalesDto scmVehicleActualSalesDto) { |
||||
|
return scmVehicleActualSalesService.saveOrUpdateVehicleSales(scmVehicleActualSalesDto); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean submitVehicleSales(ScmVehicleActualSalesDto scmVehicleActualSalesDto) { |
||||
|
return scmVehicleActualSalesService.submitVehicleSales(scmVehicleActualSalesDto); |
||||
|
} |
||||
|
} |
@ -0,0 +1,155 @@ |
|||||
|
package com.yxt.anrui.scm.biz.scmvehicleactualsales; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormLinkFeign; |
||||
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormStateVo; |
||||
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
||||
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualdetails.ScmVehicleActualDetails; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSales; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesDto; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesQuery; |
||||
|
import com.yxt.anrui.scm.api.scmvehicleactualsales.ScmVehicleActualSalesVo; |
||||
|
import com.yxt.anrui.scm.biz.scmvehicleactualdetails.ScmVehicleActualDetailsService; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.springframework.beans.BeanUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/4/8 17:42 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Service |
||||
|
public class ScmVehicleActualSalesService extends MybatisBaseService<ScmVehicleActualSalesMapper, ScmVehicleActualSales> { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysFormLinkFeign sysFormLinkFeign; |
||||
|
@Autowired |
||||
|
private ScmVehicleActualDetailsService scmVehicleActualDetailsService; |
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserFeign sysUserFeign; |
||||
|
@Autowired |
||||
|
private SysStaffOrgFeign sysStaffOrgFeign; |
||||
|
|
||||
|
/** |
||||
|
* 分页列表 |
||||
|
* |
||||
|
* @param pagerQuery 查询条件 |
||||
|
* @return |
||||
|
*/ |
||||
|
public PagerVo<ScmVehicleActualSalesVo> listPage(PagerQuery<ScmVehicleActualSalesQuery> pagerQuery) { |
||||
|
IPage<ScmVehicleActualSalesVo> page = pagerList(pagerQuery); |
||||
|
PagerVo<ScmVehicleActualSalesVo> pv = new PagerVo<>(); |
||||
|
PagerVo<ScmVehicleActualSalesVo> pv1 = PagerUtil.pageToVo(page, pv); |
||||
|
List<ScmVehicleActualSalesVo> voList = pv1.getRecords(); |
||||
|
if (voList.size() > 0) { |
||||
|
for (int i = 0; i < voList.size(); i++) { |
||||
|
ResultBean<SysFormStateVo> resultBean = sysFormLinkFeign.selectStateByBusinessSid(voList.get(i).getSid()); |
||||
|
if (resultBean.getSuccess() && resultBean.getData() != null) { |
||||
|
SysFormStateVo formState = resultBean.getData(); |
||||
|
voList.get(i).setNodeState(formState.getNodeState()); |
||||
|
voList.get(i).setFlowState(formState.getFlowState()); |
||||
|
} else { |
||||
|
voList.get(i).setFlowState(0); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return pv1; |
||||
|
} |
||||
|
|
||||
|
private IPage<ScmVehicleActualSalesVo> pagerList(PagerQuery<ScmVehicleActualSalesQuery> pagerQuery) { |
||||
|
IPage<ScmVehicleActualSalesVo> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
QueryWrapper<ScmVehicleActualSalesVo> qw = buildQueryWrapper(pagerQuery.getParams()); |
||||
|
return baseMapper.pagerList(page, qw); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<ScmVehicleActualSalesVo> buildQueryWrapper(ScmVehicleActualSalesQuery params) { |
||||
|
QueryWrapper<ScmVehicleActualSalesVo> qw = new QueryWrapper<>(); |
||||
|
if (params != null) { |
||||
|
//申请日期
|
||||
|
//状态
|
||||
|
//车架号
|
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ResultBean saveOrUpdateVehicleSales(ScmVehicleActualSalesDto scmVehicleActualSalesDto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String sid = scmVehicleActualSalesDto.getSid(); |
||||
|
if (StringUtils.isBlank(sid)) { |
||||
|
//新增
|
||||
|
ScmVehicleActualSales scmVehicleActualSales = new ScmVehicleActualSales(); |
||||
|
BeanUtils.copyProperties(scmVehicleActualSalesDto, scmVehicleActualSales, scmVehicleActualSales.getSid()); |
||||
|
boolean isSave = save(scmVehicleActualSales); |
||||
|
if (!isSave) { |
||||
|
return rb.setMsg("保存失败"); |
||||
|
} else { |
||||
|
sid = scmVehicleActualSales.getSid(); |
||||
|
if (scmVehicleActualSalesDto.getDetailsList().size() > 0) { |
||||
|
scmVehicleActualDetailsService.saveDetails(scmVehicleActualSalesDto.getDetailsList(), scmVehicleActualSales.getSid()); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
//编辑
|
||||
|
//验证数据是否可更改
|
||||
|
if (checkCouldChange(sid)) { |
||||
|
return rb.setMsg("该条信息不可更改"); |
||||
|
} |
||||
|
int i = updateBySid(scmVehicleActualSalesDto, sid); |
||||
|
//查询details中是否有关于sales的该条sid数据
|
||||
|
List<ScmVehicleActualDetails> scmVehicleActualDetailsList = scmVehicleActualDetailsService.selectBySaleSid(sid); |
||||
|
if (scmVehicleActualDetailsList.size() > 0) { |
||||
|
scmVehicleActualDetailsService.updateListByReturnSid(sid, scmVehicleActualSalesDto.getDetailsList()); |
||||
|
} |
||||
|
} |
||||
|
return rb.success().setData(sid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 判断是否可删除 |
||||
|
* |
||||
|
* @param sid sid |
||||
|
* @return |
||||
|
*/ |
||||
|
private boolean checkCouldChange(String sid) { |
||||
|
ScmVehicleActualSales scmVehicleActualSales = fetchBySid(sid); |
||||
|
// 判断是否可以更改(是否走了流程,更改了状态)
|
||||
|
if (StringUtils.isNotBlank(scmVehicleActualSales.getNodeState())) { |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询用户是否设置了部门 |
||||
|
* |
||||
|
* @param userSid 用户sid |
||||
|
* @return |
||||
|
*/ |
||||
|
private String checkUserOrg(String userSid) { |
||||
|
String orgSid = ""; |
||||
|
String staffSid = sysUserFeign.selectBySid(userSid).getData().getStaffSid(); |
||||
|
ResultBean<String> resultBean = sysStaffOrgFeign.getSysStaffOrgSidListByStaffSid(staffSid); |
||||
|
if (resultBean.getSuccess()) { |
||||
|
orgSid = resultBean.getData(); |
||||
|
} |
||||
|
return orgSid; |
||||
|
} |
||||
|
|
||||
|
public ResultBean submitVehicleSales(ScmVehicleActualSalesDto scmVehicleActualSalesDto) { |
||||
|
return null; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue