Commit 4871e6a1 by qwmqiuwenmin

fix

parent e4806b26
......@@ -32,5 +32,7 @@ public interface AuditApiService {
Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus);
AuditDTO findById(String auditId);
void update(AuditDTO audit);
}
......@@ -26,4 +26,8 @@ public interface StaffClerkRelationApiService {
*/
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
String insert(StaffClerkRelationDTO staffClerkRelation);
}
......@@ -47,4 +47,6 @@ public interface TabHaobanStaffClerkRelationMapper {
* @return
*/
TabHaobanStaffClerkRelation getBindByClerkId(@Param("clerkId") String clerkId,@Param("wxEnterpriseId") String wxEnterpriseId);
TabHaobanStaffClerkRelation getByCodeAndEnterpriseId(@Param("clerkCode")String clerkCode, @Param("enterpriseId")String enterpriseId);
}
\ No newline at end of file
......@@ -40,4 +40,8 @@ public interface StaffClerkRelationService {
*/
public StaffClerkRelationDTO getBindByClerkId(String clerkId,String wxEnterpriseId);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
String insert(StaffClerkRelationDTO staffClerkRelation);
}
......@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
......@@ -67,4 +68,20 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
TabHaobanStaffClerkRelation relation = mapper.getBindByClerkId(clerkId, wxEnterpriseId);
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class,relation);
}
@Override
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getByCodeAndEnterpriseId(clerkCode,enterpriseId));
}
@Override
public String insert(StaffClerkRelationDTO staffClerkRelation) {
String uuid = StringUtil.randomUUID();
staffClerkRelation.setStaffClerkRelationId(uuid);
staffClerkRelation.setCreateTime(new Date());
staffClerkRelation.setUpdateTime(new Date());
staffClerkRelation.setStatusFlag(1);
TabHaobanStaffClerkRelation relation = EntityUtil.changeEntityByJSON(TabHaobanStaffClerkRelation.class, staffClerkRelation);
mapper.insert(relation);
return uuid;
}
}
......@@ -390,4 +390,14 @@ public class AuditApiServiceImpl implements AuditApiService{
tabHaobanBatchAuditLogMapper.insert(batTab);
}
@Override
public AuditDTO findById(String auditId) {
return EntityUtil.changeEntityByJSON(AuditDTO.class, auditMapper.selectByPrimaryKey(auditId));
}
@Override
public void update(AuditDTO audit) {
audit.setUpdateTime(new Date());
auditMapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanAudit.class, audit));
}
}
......@@ -104,4 +104,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkRelatinService.bind(staffClerkRelationDTO);
return response;
}
@Override
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) {
return staffClerkRelatinService.getByCodeAndEnterpriseId(clerkCode,enterpriseId);
}
@Override
public String insert(StaffClerkRelationDTO staffClerkRelation) {
return staffClerkRelatinService.insert(staffClerkRelation);
}
}
......@@ -211,4 +211,14 @@
from tab_haoban_staff_clerk_relation
where clerk_id = #{clerkId,jdbcType=VARCHAR} and wx_enterprise_id=#{wxEnterpriseId} and status=1
</select>
<select id="getByCodeAndEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_staff_clerk_relation
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
and enterprise_id = #{enterpriseId}
and clerk_code = #{clerkCode}
</select>
</mapper>
\ No newline at end of file
......@@ -20,8 +20,15 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult2;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.AuditVO;
......@@ -34,6 +41,15 @@ public class AuditController extends WebBaseController{
@Autowired
private AuditApiService auditApiService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private SyncHaobanToGicServiceApi syncHaobanToGicServiceApi;
@RequestMapping("clerk-apply-list")
public HaobanResponse staffStoreList(String staffId,String wxEnterpriseId,BasePageInfo pageInfo){
if(StringUtils.isAnyBlank(staffId,wxEnterpriseId)){
......@@ -110,4 +126,77 @@ public class AuditController extends WebBaseController{
}
@RequestMapping("clerk-audit")
public HaobanResponse clerkAudit(String auditId,String auditReason,Integer auditStatus,String wxEnterpriseId,String staffId){
if(StringUtils.isAnyBlank(auditId,wxEnterpriseId)){
return resultResponse(HaoBanErrCode.ERR_2);
}
if(auditStatus == null){
return resultResponse(HaoBanErrCode.ERR_2);
}
AuditDTO audit = auditApiService.findById(auditId);
if(audit == null){
return resultResponse(HaoBanErrCode.ERR_10017);
}
StaffDTO staff = staffApiService.selectById(staffId);
if(staff != null){
audit.setAuditName(staff.getStaffName());
}
if(auditStatus == 1){
String oldValue = audit.getOldValue();
String clerkCode = "";
String enterpriseId = "";
String clerkId = "";
String wxUserId = "";
String phoneNumber = "";
String nationCode = "";
Integer sex = null;
JSONObject json = JSON.parseObject(oldValue);
clerkCode = json.getString("clerkCode");
enterpriseId = json.getString("enterpriseId");
clerkId = json.getString("clerkId");
wxUserId = json.getString("wxUserId");
sex = json.getInteger("sex");
phoneNumber = json.getString("phoneNumber");
nationCode = json.getString("nationCode");
String storeId = audit.getCommitStoreId();
if(audit.getAuditType() == 2){
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationApiService.getByCodeAndEnterpriseId(clerkCode,enterpriseId);
if(staffClerkRelation != null){
return resultResponse(HaoBanErrCode.ERR_111117);
}else{
staffClerkRelation = new StaffClerkRelationDTO();
staffClerkRelation.setEnterpriseId(enterpriseId);
staffClerkRelation.setClerkCode(clerkCode);
staffClerkRelation.setClerkId(clerkId);
staffClerkRelation.setStoreId(storeId);
staffClerkRelation.setWxEnterpriseId(wxEnterpriseId);
staffClerkRelation.setWxUserId(wxUserId);
staffClerkRelationApiService.insert(staffClerkRelation);
audit.setAuditStatus(1);
}
}
if(audit.getAuditType() == 3){
boolean flag = syncHaobanToGicServiceApi.syncClerkToGicClerkAdd(storeId, clerkCode, sex, staff.getStaffName(), phoneNumber, nationCode, null);
if(!flag){
return resultResponse(HaoBanErrCode.ERR_10010);
}
audit.setAuditStatus(1);
}
if(audit.getAuditType() == 4){
syncHaobanToGicServiceApi.delGicClerk(clerkId);
audit.setAuditStatus(1);
}
}else if(auditStatus == 2){
audit.setAuditStatus(2);
}else if(auditStatus == 3){
audit.setAuditStatus(3);
}
auditApiService.update(audit);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
......@@ -202,6 +202,8 @@ public enum HaoBanErrCode {
ERR_10016(10016,"导购不存在"),
ERR_10017(10017,"审核记录不存在"),
ERR_999(999, "操作失败"),
ERR_DEFINE(-888, "自定义错误"),
......
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