|
|
@ -11,10 +11,13 @@ import com.ruoyi.ck.utils.Result; |
|
|
|
import com.ruoyi.common.annotation.Log; |
|
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysDictData; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysRole; |
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser; |
|
|
|
import com.ruoyi.common.core.page.TableDataInfo; |
|
|
|
import com.ruoyi.common.enums.BusinessType; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil; |
|
|
|
import com.ruoyi.process.general.service.IProcessService; |
|
|
@ -78,6 +81,10 @@ public class SysCustomerController extends BaseController |
|
|
|
@Autowired |
|
|
|
private IProcessService processService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ISysUserService userService; |
|
|
|
@Autowired |
|
|
|
private ISysPostService sysPostService; |
|
|
|
|
|
|
|
@RequiresPermissions("system:customer:view") |
|
|
|
@GetMapping() |
|
|
@ -96,7 +103,6 @@ public class SysCustomerController extends BaseController |
|
|
|
{ |
|
|
|
SysUser curUser = ShiroUtils.getSysUser(); |
|
|
|
Long userId = curUser.getUserId(); |
|
|
|
Set<String> roleKeys = roleService.selectRoleKeys(userId); |
|
|
|
// 业务员角色只能看到自己创建的数据
|
|
|
|
startPage(); |
|
|
|
List<SysCustomerVo> list = sysCustomerService.selectSysCustomerList(sysCustomerVo); |
|
|
@ -137,6 +143,7 @@ public class SysCustomerController extends BaseController |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult addSave(SysCustomer sysCustomer) |
|
|
|
{ |
|
|
|
//判断是否客户对象增加重复
|
|
|
|
SysCustomerVo sysCustomer1 = new SysCustomerVo(); |
|
|
|
sysCustomer1.setEnterpriseName(sysCustomer.getEnterpriseName()); |
|
|
|
sysCustomer1.setCustomerPurser(sysCustomer.getCustomerPurser()); |
|
|
@ -147,22 +154,31 @@ public class SysCustomerController extends BaseController |
|
|
|
"事业部 : "+ sysCustomerVo2.getCustomerPurser() + |
|
|
|
" 业务员 : " + sysCustomerVo2.getBusinessMembers()); |
|
|
|
} |
|
|
|
Integer ok = sysCustomerService.insertSysCustomer(sysCustomer); |
|
|
|
SysUser sysUser = ShiroUtils.getSysUser(); |
|
|
|
List<SysPost> sysPostsList = sysPostService.selectPostsByUserId(sysUser.getUserId()); |
|
|
|
sysPostsList.get(0).getPostName(); |
|
|
|
String operPeople = sysUser.getDept().getDeptName() + "/" + sysPostsList.get(0).getPostName()+"/" + sysUser.getUserName(); |
|
|
|
//通过用户获取部门信息
|
|
|
|
// 使用状态-否
|
|
|
|
sysCustomer.setUseStatus("0"); |
|
|
|
// 审核状态-待审核
|
|
|
|
sysCustomer.setAuditStatus("0"); |
|
|
|
//添加操作记录
|
|
|
|
SysCustomerOper sysCustomerOper = new SysCustomerOper(); |
|
|
|
sysCustomerOper.setPurser(sysCustomer.getCustomerPurser()); |
|
|
|
sysCustomerOper.setEnterpriseCode(sysCustomer.getEnterpriseCode()); |
|
|
|
sysCustomerOper.setEnterpriseName(sysCustomer.getEnterpriseName()); |
|
|
|
sysCustomerOper.setOper("新增"); |
|
|
|
sysCustomerOper.setOperPeople(ShiroUtils.getLoginName()); |
|
|
|
sysCustomerOper.setOper("新建"); |
|
|
|
sysCustomerOper.setOperPeople(operPeople); |
|
|
|
sysCustomerOper.setOperStatus(sysCustomer.getAuditStatus()); |
|
|
|
sysCustomerOper.setCreateTime(new Date()); |
|
|
|
sysCustomerOper.setOperStatus(ok > 0?"0":"1"); |
|
|
|
// 使用状态-否
|
|
|
|
sysCustomer.setUseStatus("0"); |
|
|
|
// 审核状态-待审核
|
|
|
|
sysCustomer.setAuditStatus("0"); |
|
|
|
sysCustomerService.submitApply(sysCustomer); |
|
|
|
sysCustomerOper.setCreateTime(DateUtils.getNowDate()); |
|
|
|
//根据是否有流程实例,判断是否新增成功
|
|
|
|
ProcessInstance processInstance = sysCustomerService.submitApply(sysCustomer); |
|
|
|
if(processInstance != null){ |
|
|
|
sysCustomerOper.setOperStatus("0"); |
|
|
|
}else{ |
|
|
|
sysCustomerOper.setOperStatus("1"); |
|
|
|
} |
|
|
|
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper); |
|
|
|
return AjaxResult.success("添加成功,等待审核"); |
|
|
|
} |
|
|
@ -199,35 +215,35 @@ public class SysCustomerController extends BaseController |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult editSave(SysCustomer sysCustomer) |
|
|
|
{ |
|
|
|
SysUser sysUser = ShiroUtils.getSysUser(); |
|
|
|
List<SysPost> sysPostsList = sysPostService.selectPostsByUserId(sysUser.getUserId()); |
|
|
|
String operPeople = sysUser.getDept().getDeptName() + "/" + sysPostsList.get(0).getPostName()+"/" + sysUser.getUserName(); |
|
|
|
//添加操作记录
|
|
|
|
sysCustomer.setUseStatus("0"); |
|
|
|
sysCustomer.setAuditStatus("0"); |
|
|
|
SysCustomerOper sysCustomerOper = new SysCustomerOper(); |
|
|
|
sysCustomerOper.setPurser(sysCustomer.getCustomerPurser()); |
|
|
|
sysCustomerOper.setEnterpriseCode(sysCustomerOper.getEnterpriseCode()); |
|
|
|
sysCustomerOper.setEnterpriseName(sysCustomer.getEnterpriseName()); |
|
|
|
sysCustomerOper.setOper("修改"); |
|
|
|
sysCustomerOper.setOperPeople(ShiroUtils.getLoginName()); |
|
|
|
sysCustomerOper.setOperPeople(operPeople); |
|
|
|
sysCustomerOper.setOperStatus(sysCustomer.getAuditStatus()); |
|
|
|
ProcessInstance processInstance = sysCustomerService.updateSysCustomerVo(sysCustomer); |
|
|
|
if(processInstance != null){ |
|
|
|
sysCustomerOper.setOperStatus("0"); |
|
|
|
}else{ |
|
|
|
sysCustomerOper.setOperStatus("1"); |
|
|
|
} |
|
|
|
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper); |
|
|
|
//审核客户表
|
|
|
|
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer)); |
|
|
|
return AjaxResult.success("编辑成功,等待审核"); |
|
|
|
} |
|
|
|
|
|
|
|
@RequiresPermissions("system:customer:audit") |
|
|
|
@Log(title = "客户基本信息", businessType = BusinessType.UPDATE) |
|
|
|
@PostMapping("/audit") |
|
|
|
@ResponseBody |
|
|
|
public AjaxResult editaudit(SysCustomer sysCustomer) |
|
|
|
public AjaxResult editaudit(SysCustomerVo sysCustomer) |
|
|
|
{ |
|
|
|
//添加操作记录
|
|
|
|
SysCustomerOper sysCustomerOper = new SysCustomerOper(); |
|
|
|
sysCustomerOper.setPurser(sysCustomer.getCustomerPurser()); |
|
|
|
sysCustomerOper.setEnterpriseCode(sysCustomerOper.getEnterpriseCode()); |
|
|
|
sysCustomerOper.setEnterpriseName(sysCustomer.getEnterpriseName()); |
|
|
|
sysCustomerOper.setOper("审核"); |
|
|
|
sysCustomerOper.setOperPeople(ShiroUtils.getLoginName()); |
|
|
|
sysCustomerOper.setOperStatus(sysCustomer.getAuditStatus()); |
|
|
|
sysCustomerOper.setRemark(sysCustomer.getRemark()); |
|
|
|
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper); |
|
|
|
//审核客户表
|
|
|
|
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer)); |
|
|
|
} |
|
|
@ -369,10 +385,17 @@ public class SysCustomerController extends BaseController |
|
|
|
boolean saveEntityBoolean = BooleanUtils.toBoolean(saveEntity); |
|
|
|
String instanceId = sysCustomerVo.getInstanceId(); |
|
|
|
String instanceType = sysCustomerVo.getInstanceType(); |
|
|
|
boolean approvedFlag = processService.complete(taskId, instanceId, sysCustomerVo.getApplyTitle(), sysCustomerVo.getCustomsCode(), "SysCustomer", new HashMap<String, Object>(), request); |
|
|
|
boolean approvedFlag = processService.complete(taskId, instanceId, sysCustomerVo.getApplyTitle(), |
|
|
|
sysCustomerVo.getCustomsCode(), "customer", new HashMap<String, Object>(), request); |
|
|
|
SysUser sysUser = ShiroUtils.getSysUser(); |
|
|
|
SysCustomerOper sysCustomerOper = new SysCustomerOper(); |
|
|
|
List<SysPost> sysPostsList = sysPostService.selectPostsByUserId(sysUser.getUserId()); |
|
|
|
String operPeople = sysUser.getDept().getDeptName() + "/" + sysPostsList.get(0).getPostName()+"/" + sysUser.getUserName(); |
|
|
|
sysCustomerOper.setOper("审核通过"); |
|
|
|
if(!approvedFlag){ |
|
|
|
// 审核状态-审核拒绝
|
|
|
|
sysCustomerVo.setAuditStatus("2"); |
|
|
|
sysCustomerOper.setOper("审核拒绝"); |
|
|
|
} |
|
|
|
// 如果任务已结束更新业务表状态
|
|
|
|
boolean processIsFinish = processService.judgeProcessIsFinish(instanceId); |
|
|
@ -381,25 +404,42 @@ public class SysCustomerController extends BaseController |
|
|
|
sysCustomerVo.setAuditStatus("1"); |
|
|
|
// 提交
|
|
|
|
if("submit".equals(instanceType)){ |
|
|
|
sysCustomerOper.setOper("审核通过"); |
|
|
|
// 使用状态-是
|
|
|
|
sysCustomerVo.setUseStatus("1"); |
|
|
|
} |
|
|
|
// 作废
|
|
|
|
else if("cancel".equals(instanceType)){ |
|
|
|
sysCustomerOper.setOper("作废"); |
|
|
|
// 使用状态-已作废
|
|
|
|
sysCustomerVo.setUseStatus("2"); |
|
|
|
} |
|
|
|
// 恢复
|
|
|
|
else if("restore".equals(instanceType)){ |
|
|
|
sysCustomerOper.setOper("恢复"); |
|
|
|
// 使用状态-是
|
|
|
|
sysCustomerVo.setUseStatus("1"); |
|
|
|
} |
|
|
|
sysCustomerVo.setUseStatus("1"); |
|
|
|
sysCustomerOper.setPurser(sysCustomerVo.getCustomerPurser()); |
|
|
|
sysCustomerOper.setEnterpriseCode(sysCustomerOper.getEnterpriseCode()); |
|
|
|
sysCustomerOper.setEnterpriseName(sysCustomerVo.getEnterpriseName()); |
|
|
|
sysCustomerOper.setOper(instanceType); |
|
|
|
sysCustomerOper.setOperPeople(operPeople); |
|
|
|
} |
|
|
|
sysCustomerService.updateSysCustomer(sysCustomerVo); |
|
|
|
sysCustomerService.updateSysCustomer(sysCustomerVo); |
|
|
|
// 驳回申请后继续申请,可能修改表单
|
|
|
|
if (saveEntityBoolean) { |
|
|
|
sysCustomerOper.setOper("驳回申请"); |
|
|
|
sysCustomerService.updateSysCustomer(sysCustomerVo); |
|
|
|
} |
|
|
|
sysCustomerOper.setPurser(sysCustomerVo.getCustomerPurser()); |
|
|
|
sysCustomerOper.setEnterpriseCode(sysCustomerOper.getEnterpriseCode()); |
|
|
|
sysCustomerOper.setEnterpriseName(sysCustomerVo.getEnterpriseName()); |
|
|
|
sysCustomerOper.setOperPeople(operPeople); |
|
|
|
sysCustomerOper.setOperStatus(sysCustomerVo.getAuditStatus()); |
|
|
|
sysCustomerOper.setCreateTime(DateUtils.getNowDate()); |
|
|
|
sysCustomerOperService.insertSysCustomerOper(sysCustomerOper); |
|
|
|
return success("任务已完成"); |
|
|
|
} |
|
|
|
@ModelAttribute("/preloadObj") |
|
|
|