Commit d71e4140 authored by shiyu's avatar shiyu

寄售单流程修改

parent f4af76be
......@@ -73,6 +73,21 @@ public class ConsignSaleController {
}
@ApiOperation(value = "用户寄售商品确认签收")
@PostMapping("/confirmReceive")
public Result confirmReceive(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】用户寄售商品确认签收,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("saleId", "寄售单号").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(ResultCode.PARAM_ERROR.getCode(), validator.getErrorInfo());
}
return consignSaleService.confirmReceive(dto);
}
@ApiOperation(value = "实物鉴定")
@PostMapping("/identify")
public Result identify(@RequestBody ConsignSaleRequestDto dto) {
......@@ -91,10 +106,11 @@ public class ConsignSaleController {
}
@ApiOperation(value = "完成寄售")
@PostMapping("/finish")
public Result finish(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】完成寄售,请求参数:{}", JSON.toJSONString(dto));
@ApiOperation(value = "用户商品确认售出")
@PostMapping("/finishSale")
public Result finishSale(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】用户商品确认售出,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("saleId", "寄售单号").must().string()
.set("dealPrice", "成交价格").must().number()
......@@ -105,7 +121,24 @@ public class ConsignSaleController {
if (StringUtils.isEmpty(dto.getRemark())) {
return Result.failed("成交平台必填");
}
return consignSaleService.finish(dto);
return consignSaleService.finishSale(dto);
}
@ApiOperation(value = "完成用户结款,上传凭证")
@PostMapping("/finishSettlement")
public Result finishSettlement(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】完成用户结款,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("saleId", "寄售单号").must().string()
.set("credential", "结款凭证").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(ResultCode.PARAM_ERROR.getCode(), validator.getErrorInfo());
}
if (StringUtils.isEmpty(dto.getRemark())) {
return Result.failed("成交平台必填");
}
return consignSaleService.finishSettlement(dto);
}
......
package com.wwdz.ch.admin.entity.vo;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.UserVo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.List;
......@@ -31,4 +33,9 @@ public class ConsignSaleDetailVo implements Entity {
* 寄售单信息
*/
private List<ConsignSaleRecordVo> consignSaleRecordVoList;
/**
* 发布人信息
*/
private UserVo userVo;
}
......@@ -28,6 +28,12 @@ public interface ConsignSaleService {
*/
Result imgValuate(ConsignSaleRequestDto dto);
/**
* 用户寄售商品确认签收
* @param dto
* @return
*/
Result confirmReceive(ConsignSaleRequestDto dto);
/**
* 实物鉴定
......@@ -37,11 +43,18 @@ public interface ConsignSaleService {
Result identify(ConsignSaleRequestDto dto);
/**
* 完成寄售
* 货品售出
* @param dto
* @return
*/
Result finishSale(ConsignSaleRequestDto dto);
/**
* 完成结款,上传凭证
* @param dto
* @return
*/
Result finish(ConsignSaleRequestDto dto);
Result finishSettlement(ConsignSaleRequestDto dto);
/**
* 取消寄售
......
......@@ -132,4 +132,50 @@ public class ConsignSaleEnum {
}
public enum AppletNodeDescEnum {
CREATE_ORDER("下单成功", "", "0"),
VALUATE("平台依据图文估价", "等待平台进行初步估价,一般在2小时以内完成。", "10,15,20,23"),
SEND("送货至平台", "", "30"),
IDENTIFY("平台实物鉴定并定价", "平台签收后,会在1~3天完成货品的鉴定和估价", "40,50,53,60"),
CONSIGN_SALEING("平台寄售中", "", "70"),
PRE_PAY("货品售出,待结款", "货品售出后,平台会在20天内完成打款。如果实际的售出价低于预估价,则会在售出后由客服通知您具体情况。", "80"),
FINISH_PAT("平台完成结款", "", "90"),
CANCEL("取消寄售", "", "100,101"),
;
private String node;
private String des;
private String targetOperateType;
AppletNodeDescEnum(String node, String des, String targetOperateType) {
this.node = node;
this.des = des;
this.targetOperateType = targetOperateType;
}
public static ConsignSaleEnum.AppletNodeDescEnum getNameByCode(String targetOperateType) {
for (ConsignSaleEnum.AppletNodeDescEnum appletNodeDescEnum : ConsignSaleEnum.AppletNodeDescEnum.values()) {
if (appletNodeDescEnum.getTargetOperateType().contains(targetOperateType)) {
return appletNodeDescEnum;
}
}
return null;
}
public String getNode() {
return node;
}
public String getDes() {
return des;
}
public String getTargetOperateType() {
return targetOperateType;
}
}
}
......@@ -21,6 +21,7 @@ dts:
officialaccount-token: Uu6GHYOiP1xJ6GaBMyXfnITufAGJTe3Q
officialaccount-key: noeN1amYRvzrVmE2GnC5VnsIfgPEmv6bhX54wJOARlM
get-officialaccount-accesstoken-url: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s
officialaccount-templetId: WJkhzyY0_7AYqh19_ujK9yZhj4HohF8ETJvG5NYA9A8
#腾讯IM配置
im:
......
......@@ -20,6 +20,7 @@ dts:
officialaccount-token: Uu6GHYOiP1xJ6GaBMyXfnITufAGJTe3Q
officialaccount-key: noeN1amYRvzrVmE2GnC5VnsIfgPEmv6bhX54wJOARlM
get-officialaccount-accesstoken-url: https://api.weixin.qq.com/cgi-bin/stable_token
officialaccount-templetId: WJkhzyY0_7AYqh19_ujK9yZhj4HohF8ETJvG5NYA9A8
#腾讯IM配置
......
......@@ -40,4 +40,21 @@ public interface ConsignSaleDao {
* @return
*/
List<ConsignSale> findByPage(ConsignSaleRequestDto dto);
/**
* 查询图文鉴定状态待用户确认的寄售单
* @param dto
* @return
*/
List<ConsignSale> findImgValuateConfirmOrdersByPage(ConsignSaleRequestDto dto);
/**
* 查询实物鉴定状态待用户确认的寄售单
* @param dto
* @return
*/
List<ConsignSale> findValuateConfirmOrdersByPage(ConsignSaleRequestDto dto);
}
......@@ -16,6 +16,11 @@ public interface ConsignSaleRecordDao {
int insert(String saleId, String content, int type, String remark);
/**
* 查询记录
* @param saleId
......
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2023/11/28
* @date 2023/12/18
*/
@Data
public class ConsignSale implements Entity {
......@@ -66,6 +66,21 @@ public class ConsignSale implements Entity {
*/
private Integer systemState;
/**
* 快递公司编码
*/
private String logisticsCode;
/**
* 运单号
*/
private String waybill;
/**
* 结款凭证
*/
private String credential;
/**
* 创建时间
*/
......@@ -95,6 +110,9 @@ public class ConsignSale implements Entity {
sb.append(", dealPrice=").append(dealPrice);
sb.append(", customState=").append(customState);
sb.append(", systemState=").append(systemState);
sb.append(", logisticsCode=").append(logisticsCode);
sb.append(", waybill=").append(waybill);
sb.append(", credential=").append(credential);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
......@@ -125,6 +143,9 @@ public class ConsignSale implements Entity {
&& (this.getDealPrice() == null ? other.getDealPrice() == null : this.getDealPrice().equals(other.getDealPrice()))
&& (this.getCustomState() == null ? other.getCustomState() == null : this.getCustomState().equals(other.getCustomState()))
&& (this.getSystemState() == null ? other.getSystemState() == null : this.getSystemState().equals(other.getSystemState()))
&& (this.getLogisticsCode() == null ? other.getLogisticsCode() == null : this.getLogisticsCode().equals(other.getLogisticsCode()))
&& (this.getWaybill() == null ? other.getWaybill() == null : this.getWaybill().equals(other.getWaybill()))
&& (this.getCredential() == null ? other.getCredential() == null : this.getCredential().equals(other.getCredential()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
}
......@@ -144,6 +165,9 @@ public class ConsignSale implements Entity {
result = prime * result + ((getDealPrice() == null) ? 0 : getDealPrice().hashCode());
result = prime * result + ((getCustomState() == null) ? 0 : getCustomState().hashCode());
result = prime * result + ((getSystemState() == null) ? 0 : getSystemState().hashCode());
result = prime * result + ((getLogisticsCode() == null) ? 0 : getLogisticsCode().hashCode());
result = prime * result + ((getWaybill() == null) ? 0 : getWaybill().hashCode());
result = prime * result + ((getCredential() == null) ? 0 : getCredential().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
return result;
......@@ -168,6 +192,9 @@ public class ConsignSale implements Entity {
dealPrice("deal_price", "dealPrice", "INTEGER", false),
customState("custom_state", "customState", "INTEGER", false),
systemState("system_state", "systemState", "INTEGER", false),
logisticsCode("logistics_code", "logisticsCode", "VARCHAR", false),
waybill("waybill", "waybill", "VARCHAR", false),
credential("credential", "credential", "VARCHAR", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false);
......
package com.wwdz.ch.db.domain;
public class UserVo {
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class UserVo implements Entity {
private String nickname;
private String avatar;
private String phone;
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
}
......@@ -73,6 +73,11 @@ public class ConsignSaleRequestDto extends BaseRequestDto implements Entity {
*/
private Integer systemState;
/**
* 系统状态
*/
private List<Integer> systemStateList;
/**
* 创建时间
*/
......@@ -85,4 +90,23 @@ public class ConsignSaleRequestDto extends BaseRequestDto implements Entity {
private String remark;
/**
* 快递公司编码
*/
private String logisticsCode;
/**
* 运单号
*/
private String waybill;
/**
* 用户是否同意寄售
*/
private Boolean agree;
/**
* 结款凭证
*/
private String credential;
}
......@@ -68,5 +68,27 @@ public class ConsignSaleDaoImpl implements ConsignSaleDao {
}
@Override
public List<ConsignSale> findImgValuateConfirmOrdersByPage(ConsignSaleRequestDto dto) {
ConsignSaleExample example = new ConsignSaleExample();
ConsignSaleExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
criteria.andSystemStateEqualTo(dto.getSystemState());
criteria.andImgValuationIsNotNull();
example.orderBy(" sale_time asc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return consignSaleMapper.selectByExample(example);
}
@Override
public List<ConsignSale> findValuateConfirmOrdersByPage(ConsignSaleRequestDto dto) {
ConsignSaleExample example = new ConsignSaleExample();
ConsignSaleExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
criteria.andSystemStateEqualTo(dto.getSystemState());
criteria.andImgValuationIsNotNull();
example.orderBy(" sale_time asc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return consignSaleMapper.selectByExample(example);
}
}
......@@ -14,6 +14,7 @@ import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
......@@ -28,6 +29,16 @@ public class ConsignSaleRecordDaoImpl implements ConsignSaleRecordDao {
}
@Override
public int insert(String saleId, String content, int type, String remark) {
ConsignSaleRecord cancelConsignSaleRecord = new ConsignSaleRecord();
cancelConsignSaleRecord.setSaleId(saleId);
cancelConsignSaleRecord.setCreateTime(new Date());
cancelConsignSaleRecord.setContent(content);
cancelConsignSaleRecord.setType(type);
return consignSaleRecordMapper.insert(cancelConsignSaleRecord);
}
@Override
public List<ConsignSaleRecord> find(String saleId) {
ConsignSaleRecordExample example = new ConsignSaleRecordExample();
......
......@@ -13,6 +13,9 @@
<result column="deal_price" jdbcType="INTEGER" property="dealPrice" />
<result column="custom_state" jdbcType="INTEGER" property="customState" />
<result column="system_state" jdbcType="INTEGER" property="systemState" />
<result column="logistics_code" jdbcType="VARCHAR" property="logisticsCode" />
<result column="waybill" jdbcType="VARCHAR" property="waybill" />
<result column="credential" jdbcType="VARCHAR" property="credential" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
......@@ -76,7 +79,7 @@
</sql>
<sql id="Base_Column_List">
id, sale_id, item_id, user_id, sale_time, user_price, img_valuation, valuation, deal_price,
custom_state, system_state, create_time, update_time
custom_state, system_state, logistics_code, waybill, credential, create_time, update_time
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.ConsignSaleExample" resultMap="BaseResultMap">
select
......@@ -105,14 +108,15 @@
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, sale_id, item_id, user_id, sale_time, user_price, img_valuation, valuation, deal_price,
custom_state, system_state, create_time, update_time
custom_state, system_state, logistics_code, waybill, credential, create_time, update_time
</otherwise>
</choose>
from consign_sale
......@@ -137,14 +141,15 @@
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, sale_id, item_id, user_id, sale_time, user_price, img_valuation, valuation, deal_price,
custom_state, system_state, create_time, update_time
custom_state, system_state, logistics_code, waybill, credential, create_time, update_time
</otherwise>
</choose>
from consign_sale
......@@ -167,12 +172,14 @@
insert into consign_sale (sale_id, item_id, user_id,
sale_time, user_price, img_valuation,
valuation, deal_price, custom_state,
system_state, create_time, update_time
system_state, logistics_code, waybill,
credential, create_time, update_time
)
values (#{saleId,jdbcType=VARCHAR}, #{itemId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT},
#{saleTime,jdbcType=TIMESTAMP}, #{userPrice,jdbcType=INTEGER}, #{imgValuation,jdbcType=VARCHAR},
#{valuation,jdbcType=INTEGER}, #{dealPrice,jdbcType=INTEGER}, #{customState,jdbcType=INTEGER},
#{systemState,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
#{systemState,jdbcType=INTEGER}, #{logisticsCode,jdbcType=VARCHAR}, #{waybill,jdbcType=VARCHAR},
#{credential,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.ConsignSale">
......@@ -211,6 +218,15 @@
<if test="systemState != null">
system_state,
</if>
<if test="logisticsCode != null">
logistics_code,
</if>
<if test="waybill != null">
waybill,
</if>
<if test="credential != null">
credential,
</if>
<if test="createTime != null">
create_time,
</if>
......@@ -249,6 +265,15 @@
<if test="systemState != null">
#{systemState,jdbcType=INTEGER},
</if>
<if test="logisticsCode != null">
#{logisticsCode,jdbcType=VARCHAR},
</if>
<if test="waybill != null">
#{waybill,jdbcType=VARCHAR},
</if>
<if test="credential != null">
#{credential,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -299,6 +324,15 @@
<if test="record.systemState != null">
system_state = #{record.systemState,jdbcType=INTEGER},
</if>
<if test="record.logisticsCode != null">
logistics_code = #{record.logisticsCode,jdbcType=VARCHAR},
</if>
<if test="record.waybill != null">
waybill = #{record.waybill,jdbcType=VARCHAR},
</if>
<if test="record.credential != null">
credential = #{record.credential,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
......@@ -323,6 +357,9 @@
deal_price = #{record.dealPrice,jdbcType=INTEGER},
custom_state = #{record.customState,jdbcType=INTEGER},
system_state = #{record.systemState,jdbcType=INTEGER},
logistics_code = #{record.logisticsCode,jdbcType=VARCHAR},
waybill = #{record.waybill,jdbcType=VARCHAR},
credential = #{record.credential,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
......@@ -362,6 +399,15 @@
<if test="systemState != null">
system_state = #{systemState,jdbcType=INTEGER},
</if>
<if test="logisticsCode != null">
logistics_code = #{logisticsCode,jdbcType=VARCHAR},
</if>
<if test="waybill != null">
waybill = #{waybill,jdbcType=VARCHAR},
</if>
<if test="credential != null">
credential = #{credential,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
......@@ -383,6 +429,9 @@
deal_price = #{dealPrice,jdbcType=INTEGER},
custom_state = #{customState,jdbcType=INTEGER},
system_state = #{systemState,jdbcType=INTEGER},
logistics_code = #{logisticsCode,jdbcType=VARCHAR},
waybill = #{waybill,jdbcType=VARCHAR},
credential = #{credential,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
......@@ -414,14 +463,15 @@
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, sale_id, item_id, user_id, sale_time, user_price, img_valuation, valuation, deal_price,
custom_state, system_state, create_time, update_time
custom_state, system_state, logistics_code, waybill, credential, create_time, update_time
</otherwise>
</choose>
from consign_sale
......@@ -433,4 +483,5 @@
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
package com.wwdz.ch.wx.entity.vo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
/**
* 小程序展示寄售单节点时间线
*/
@Data
public class AppletStateNodeVo implements Entity {
private String node;
private String desc;
private Date time;
private Boolean passed;
}
package com.wwdz.ch.wx.entity.vo;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class ConsignSaleAppletVo implements Entity {
/**
* 商品图片
*/
private String image;
/**
* 商品id
*/
private String itemId;
/**
* 商品名称
*/
private String name;
/**
* 寄售单号
*/
private String saleId;
/**
* 下单时间
*/
private Date saleTime;
/**
* 寄出时间
*/
private Date sendTime;
/**
* 送货方式:自行寄出
*/
private String sendType;
/**
* 物流公司
*/
private String logisticsCode;
/**
* 物流公司名称
*/
private String logisticsName;
/**
* 快递单号
*/
private String waybill;
/**
* 完成时间
*/
private Date finishTime;
/**
* 寄售单状态时间线
*/
private List<AppletStateNodeVo> nodeVoList;
}
......@@ -20,6 +20,7 @@ import com.wwdz.ch.db.domain.Item;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.dto.request.CoinRequestDto;
import com.wwdz.ch.db.dto.request.ConsignSaleRequestDto;
import com.wwdz.ch.wx.entity.vo.AppletStateNodeVo;
import com.wwdz.ch.wx.service.ConsignSaleService;
import com.wwdz.user.api.service.user.UserReadService;
import com.xxdxxs.utils.EntityMapper;
......@@ -78,8 +79,8 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
consignSale.setCreateTime(now);
consignSale.setUpdateTime(now);
//目前创建了寄售单客户显示的状态就是寄售中
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.CONSIGN_SALEING.getCode());
//创建了寄售单客户显示的状态是待寄出
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.PRE_CONSIGN.getCode());
consignSale.setSystemState(ConsignSaleEnum.SaleForSysStateEnum.WAIT_IMG_VALUATE.getCode());
String saleId = IdUtils.getOrderNumber(CONSIGN_SALE_ORDER_PREFIX);
consignSale.setSaleId(saleId);
......@@ -177,9 +178,115 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
@Override
public Result findDetail(ConsignSaleRequestDto dto) {
String saleId = dto.getSaleId();
List<ConsignSaleRecord> consignSaleRecordList = consignSaleRecordDao.find(saleId);
consignSaleRecordList.forEach(consignSaleRecord -> {
AppletStateNodeVo appletStateNodeVo = new AppletStateNodeVo();
});
return null;
}
@Override
public Result confirmForImgValuate(ConsignSaleRequestDto dto) {
try {
//满意初步估价
if (dto.getAgree()) {
ConsignSale consignSale = new ConsignSale();
consignSale.setSaleId(dto.getSaleId());
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.PRE_CONSIGN.getCode());
consignSale.setSystemState(ConsignSaleEnum.SaleForSysStateEnum.WAIT_CONSIGN.getCode());
consignSaleDao.update(consignSale);
//插入操作记录,用户满意初步估价
consignSaleRecordDao.insert(dto.getSaleId(), "满意,继续寄售", ConsignSaleEnum.OperateTypeEnum.USER_CONFIRM_VALUATE.getCode(), null);
//插入操作记录,待用户寄出
consignSaleRecordDao.insert(dto.getSaleId(), "", ConsignSaleEnum.OperateTypeEnum.WAIT_USER_SEND.getCode(), null);
} else {
//不满意初步估价,取消寄售
ConsignSale consignSale = new ConsignSale();
consignSale.setSaleId(dto.getSaleId());
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.CANCEL.getCode());
consignSale.setSystemState(ConsignSaleEnum.SaleForSysStateEnum.CANCEL.getCode());
consignSaleDao.update(consignSale);
//商品下架
itemDao.updateOnSale(dto.getItemId(), ItemStateEnum.SHELVE.getCode());
//插入操作记录,用户不满意初步估价
consignSaleRecordDao.insert(dto.getSaleId(), "不满意,取消寄售", ConsignSaleEnum.OperateTypeEnum.USER_CONFIRM_VALUATE.getCode(), null);
//插入操作记录,用户主动取消
consignSaleRecordDao.insert(dto.getSaleId(), "用户主动取消", ConsignSaleEnum.OperateTypeEnum.CUSTOM_CANCEL.getCode(), null);
}
return Result.success();
} catch (Exception e) {
logger.info("图文鉴定后用户确认 error : {}", e);
}
return Result.failed();
}
@Override
public Result userSend(ConsignSaleRequestDto dto) {
try {
//用户寄出商品,状态改为已寄出,后台为待收货
ConsignSale consignSale = new ConsignSale();
consignSale.setSaleId(dto.getSaleId());
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.CONSIGNED.getCode());
consignSale.setSystemState(ConsignSaleEnum.SaleForSysStateEnum.WAIT_TAKE.getCode());
consignSaleDao.update(consignSale);
//插入操作记录,平台待收货
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("物流公司:");
stringBuffer.append(dto.getLogisticsCode() + "; ");
stringBuffer.append("快递单号:");
stringBuffer.append(dto.getWaybill());
consignSaleRecordDao.insert(dto.getSaleId(), stringBuffer.toString(), ConsignSaleEnum.OperateTypeEnum.USER_SEND.getCode(), null);
return Result.success();
} catch (Exception e) {
logger.info("用户寄出商品 error : {}", e);
}
return Result.failed();
}
@Override
public Result confirmForIdentify(ConsignSaleRequestDto dto) {
try {
//满意建议零售价估价
if (dto.getAgree()) {
ConsignSale consignSale = new ConsignSale();
consignSale.setSaleId(dto.getSaleId());
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.CONSIGN_SALEING.getCode());
consignSale.setSystemState(ConsignSaleEnum.SaleForSysStateEnum.CONSIGN_SALEING.getCode());
consignSaleDao.update(consignSale);
//插入操作记录,用户满意建议零售价
consignSaleRecordDao.insert(dto.getSaleId(), "满意,继续寄售", ConsignSaleEnum.OperateTypeEnum.USER_CONFIRM_IDENTIFY.getCode(), null);
//插入操作记录,待用户寄出
consignSaleRecordDao.insert(dto.getSaleId(), "", ConsignSaleEnum.OperateTypeEnum.SALEING.getCode(), null);
} else {
//不满意建议零售价,取消寄售
ConsignSale consignSale = new ConsignSale();
consignSale.setSaleId(dto.getSaleId());
consignSale.setCustomState(ConsignSaleEnum.SaleForUserStateEnum.CANCEL.getCode());
consignSale.setSystemState(ConsignSaleEnum.SaleForSysStateEnum.CANCEL.getCode());
consignSaleDao.update(consignSale);
//商品下架
itemDao.updateOnSale(dto.getItemId(), ItemStateEnum.SHELVE.getCode());
//插入操作记录,用户不满意建议零售价
consignSaleRecordDao.insert(dto.getSaleId(), "不满意,取消寄售", ConsignSaleEnum.OperateTypeEnum.USER_CONFIRM_IDENTIFY.getCode(), null);
//插入操作记录,用户主动取消
consignSaleRecordDao.insert(dto.getSaleId(), "用户主动取消", ConsignSaleEnum.OperateTypeEnum.CUSTOM_CANCEL.getCode(), null);
}
return Result.success();
} catch (Exception e) {
logger.info("图文鉴定后用户确认 error : {}", e);
}
return Result.failed();
}
@Override
public Result customCancel(ConsignSaleRequestDto dto) {
try {
......
......@@ -37,6 +37,28 @@ public interface ConsignSaleService {
Result findDetail(ConsignSaleRequestDto dto);
/**
* 图文鉴定后用户确认
* @param dto
* @return
*/
Result confirmForImgValuate(ConsignSaleRequestDto dto);
/**
* 用户寄出商品
* @param dto
* @return
*/
Result userSend(ConsignSaleRequestDto dto);
/**
* 实物鉴定后用户确认
* @param dto
* @return
*/
Result confirmForIdentify(ConsignSaleRequestDto dto);
/**
* 客户取消寄售
* @param dto
......
......@@ -3,27 +3,23 @@ package com.wwdz.ch.wx.web;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.domain.ConsignSale;
import com.wwdz.ch.db.dto.request.AiAssistantRequestDto;
import com.wwdz.ch.db.dto.request.ConsignSaleRequestDto;
import com.wwdz.ch.wx.entity.request.ItemRequestDto;
import com.wwdz.ch.wx.service.ConsignSaleService;
import com.wwdz.ch.wx.service.ItemService;
import com.xxdxxs.service.FormHandler;
import com.xxdxxs.utils.StringUtils;
import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* 寄售单
......@@ -56,7 +52,7 @@ public class ConsignSaleController {
return Result.failed("请至少上传一张图片");
}
//先发布商品
dto.setPrice(StringUtils.isBlank(dto.getPrice()) ? "0" : dto.getPrice());
dto.setPrice(StringUtils.isEmpty(dto.getPrice()) ? "0" : dto.getPrice());
dto.setIsOnSale(true);
Result addItemResult = itemService.add(dto);
if (!addItemResult.getSuccess()) {
......@@ -108,6 +104,46 @@ public class ConsignSaleController {
}
@ApiOperation(value = "图文鉴定后用户确认")
@PostMapping("/confirmForImgValuate")
public Result confirmForImgValuate(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】图文鉴定后用户确认,请求参数:{}", JSON.toJSONString(dto));
if (StringUtils.isEmpty(dto.getSaleId()) || StringUtils.isEmpty(dto.getItemId()) || ObjectUtils.isEmpty(dto.getAgree())) {
return Result.failed(ResultCode.PARAM_ERROR.getMessage());
}
return consignSaleService.confirmForImgValuate(dto);
}
@ApiOperation(value = "用户寄出商品")
@PostMapping("/userSend")
public Result userSend(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】用户寄出商品,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("logisticsCode", "快递公司编码").must().string()
.set("waybill", "运单号").must().string()
.set("saleId", "寄售单号").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(ResultCode.PARAM_ERROR.getCode(), validator.getErrorInfo());
}
return consignSaleService.userSend(dto);
}
@ApiOperation(value = "实物鉴定后用户确认")
@PostMapping("/confirmForIdentify")
public Result confirmForIdentify(@RequestBody ConsignSaleRequestDto dto) {
logger.info("【请求开始】实物鉴定后用户确认,请求参数:{}", JSON.toJSONString(dto));
if (StringUtils.isEmpty(dto.getSaleId()) || StringUtils.isEmpty(dto.getItemId())|| ObjectUtils.isEmpty(dto.getAgree())) {
return Result.failed(ResultCode.PARAM_ERROR.getMessage());
}
return consignSaleService.confirmForIdentify(dto);
}
@ApiOperation(value = "用户取消寄售单")
@PostMapping("/cancel")
public Result cancel(@RequestBody ConsignSaleRequestDto dto) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment