|
|
@ -18,7 +18,11 @@ import com.yxt.anrui.buscenter.biz.buscenterfile.BuscenterFileService; |
|
|
|
import com.yxt.anrui.buscenter.biz.busdiscountpackagehandoverlist.BusDiscountpackageHandoverListService; |
|
|
|
import com.yxt.anrui.portal.api.sysrole.SysRoleFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysrole.SysRoleVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoDetailsVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUser; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.common.base.config.component.DocPdfComponent; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
@ -62,6 +66,10 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
private CommonContractFeign commonContractFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffinfoFeign sysStaffinfoFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 筛选条件 |
|
|
@ -84,12 +92,18 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getRecUserSid())) { |
|
|
|
qw.eq("recUserSid", query.getRecUserSid()); |
|
|
|
} |
|
|
|
if (null != query.getState()) { |
|
|
|
if (null != query.getState()) { |
|
|
|
if (query.getState() == 3) { |
|
|
|
qw.eq("transferStateKey", "004"); |
|
|
|
} else { |
|
|
|
qw.eq("transferStateKey", "003"); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (null != query.getState()) { |
|
|
|
if (query.getState() == 3) { |
|
|
|
qw.eq("state", query.getState()); |
|
|
|
qw.eq("transferStateKey", "004"); |
|
|
|
} else { |
|
|
|
qw.ne("state", 3); |
|
|
|
qw.ne("transferStateKey", "004"); |
|
|
|
} |
|
|
|
} |
|
|
|
String createStartTime = query.getCreateStartTime(); |
|
|
@ -131,33 +145,14 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
for (BusDiscountpackageHandoverVo record : records) { |
|
|
|
if (null != record) { |
|
|
|
// 待准备 服务站人员 ture 销售专员 false
|
|
|
|
if (null != record.getState() && record.getState() == 1) { |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
record.setShowHandover(false); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
record.setShowHandover(true); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getTransferStateKey())) { |
|
|
|
if ("002".equals(record.getTransferStateKey())) { |
|
|
|
record.setShowToDoHandover(false); |
|
|
|
record.setShowHandover(true); |
|
|
|
} |
|
|
|
} |
|
|
|
// 待交接 服务站人员 false 销售专员 ture
|
|
|
|
if (null != record.getState() && record.getState() == 2) { |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
record.setShowToDoHandover(true); |
|
|
|
break; |
|
|
|
} else { |
|
|
|
record.setShowToDoHandover(false); |
|
|
|
} |
|
|
|
} |
|
|
|
if ("003".equals(record.getTransferStateKey())) { |
|
|
|
record.setShowToDoHandover(true); |
|
|
|
record.setShowHandover(false); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(record.getContractNo())) { |
|
|
@ -186,6 +181,8 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
dto.setSid(sid); |
|
|
|
dto.fillEntity(entity); |
|
|
|
entity.setVins(dto.getVinNo()); |
|
|
|
entity.setTransferStateKey("002"); |
|
|
|
entity.setTransferStateValue("待移交"); |
|
|
|
boolean save = this.save(entity); |
|
|
|
if (save) { |
|
|
|
List<BusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
@ -254,11 +251,31 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
* @throws ParseException |
|
|
|
* @throws |
|
|
|
*/ |
|
|
|
public int toDohandover(BusDiscountpackageHandoverDto dto) throws ParseException { |
|
|
|
public int toDohandover(BusDiscountpackageHandoverDto dto) { |
|
|
|
String sid = dto.getSid(); |
|
|
|
String userSid = dto.getCreateBySid(); |
|
|
|
String mobile = ""; |
|
|
|
String userName = ""; |
|
|
|
BusDiscountpackageHandover busDiscountpackageHandover = fetchBySid(sid); |
|
|
|
dto.setCreateBySid(busDiscountpackageHandover.getCreateBySid()); |
|
|
|
if (sysUserFeign.selectBySid(userSid).getSuccess()) { |
|
|
|
SysUser user = sysUserFeign.selectBySid(userSid).getData(); |
|
|
|
if (null != user) { |
|
|
|
if (StringUtils.isNotBlank(user.getMobile())) { |
|
|
|
mobile = user.getMobile(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(user.getStaffSid())) { |
|
|
|
SysStaffinfoDetailsVo staffinfoDetailsVo = sysStaffinfoFeign.fetchBySid(user.getStaffSid()).getData(); |
|
|
|
if (null != staffinfoDetailsVo) { |
|
|
|
if (StringUtils.isNotBlank(staffinfoDetailsVo.getName())) { |
|
|
|
userName = staffinfoDetailsVo.getName(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
int i = 0; |
|
|
|
//根据当前用户sid查询用户角色
|
|
|
|
List<SysRoleVo> roleVoList = sysRoleFeign.fetchByUserSid(userSid).getData(); |
|
|
@ -267,12 +284,10 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
dto.setState("3"); |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
dto.setRecTime(currentDate); |
|
|
|
if (StringUtils.isNotBlank(dto.getState())) { |
|
|
|
dto.setTransferStateKey("004"); |
|
|
|
dto.setTransferStateValue("已移交"); |
|
|
|
dto.setRecTime(new Date()); |
|
|
|
if (StringUtils.isNotBlank(dto.getTransferStateKey())) { |
|
|
|
i = this.updateBySid(dto.toMap(), sid); |
|
|
|
} |
|
|
|
List<BuscenterFile> busFiles = dto.getBusFiles(); |
|
|
@ -280,37 +295,17 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
this.uploadPicture(dto); |
|
|
|
} |
|
|
|
} else if ((sysRoleVo.getName()).contains("服务站长")) { |
|
|
|
dto.setState("2"); |
|
|
|
if (StringUtils.isNotBlank(dto.getState())) { |
|
|
|
dto.setTransferStateKey("003"); |
|
|
|
dto.setTransferStateValue("移交中"); |
|
|
|
dto.setTransferUserSid(userSid); |
|
|
|
dto.setTransferName(userName); |
|
|
|
dto.setTransferPhone(mobile); |
|
|
|
if (StringUtils.isNotBlank(dto.getTransferStateKey())) { |
|
|
|
i = this.updateBySid(dto.toMap(), sid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (i > 0) { |
|
|
|
List<BusDiscountpackageHandoverListDto> listDtos = dto.getBusDiscountpackageHandoverLists(); |
|
|
|
for (BusDiscountpackageHandoverListDto listDto : listDtos) { |
|
|
|
String listDtoSid = listDto.getSid(); |
|
|
|
//判断当前登录用户角色是否为销售专员
|
|
|
|
if (null != roleVoList) { |
|
|
|
for (SysRoleVo sysRoleVo : roleVoList) { |
|
|
|
//如果当前登录用户角色包含分公司销售专员,将当前用户sid保存到查询条件中
|
|
|
|
if ("分公司销售专员".equals(sysRoleVo.getName())) { |
|
|
|
listDto.setState("3"); |
|
|
|
} else if ((sysRoleVo.getName()).contains("服务站长")) { |
|
|
|
listDto.setState("2"); |
|
|
|
} |
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
listDto.setModifyTime(currentDate); |
|
|
|
if (StringUtils.isNotBlank(listDto.getState())) { |
|
|
|
busDiscountpackageHandoverListService.updateStateBySid(listDto.getState(), listDto.getModifyTime(), listDtoSid); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return i; |
|
|
|
} |
|
|
|
|
|
|
@ -667,15 +662,15 @@ public class BusDiscountpackageHandoverService extends MybatisBaseService<BusDis |
|
|
|
BusDiscountpackageHandoverDto bdhDto = new BusDiscountpackageHandoverDto(); |
|
|
|
BeanUtils.copyProperties(bdhDto, dto); |
|
|
|
bdhDto.setSid(dto.getSid()); |
|
|
|
bdhDto.setState("3"); |
|
|
|
// bdhDto.setState("3");
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String currentTime = simpleDateFormat.format(System.currentTimeMillis()); |
|
|
|
Date currentDate = simpleDateFormat.parse(currentTime); |
|
|
|
bdhDto.setRecTime(currentDate); |
|
|
|
List<BuscenterFile> busFiles = bdhDto.getBusFiles(); |
|
|
|
if (StringUtils.isNotBlank(bdhDto.getState())) { |
|
|
|
i = this.updateBySid(bdhDto.toMap(), sid); |
|
|
|
} |
|
|
|
// if (StringUtils.isNotBlank(bdhDto.getState())) {
|
|
|
|
// i = this.updateBySid(bdhDto.toMap(), sid);
|
|
|
|
// }
|
|
|
|
if (null != busFiles && i > 0) { |
|
|
|
this.uploadPicture(bdhDto); |
|
|
|
} |
|
|
|