| | |
| | | import doumeemes.dao.ext.dto.SalaryParamDTO; |
| | | import doumeemes.service.business.SalaryParamService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartResolver; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(salaryParamService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "批量导入计划", notes = "批量导入计划", httpMethod = "POST", position = 6) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "folder", value = "文件夹", required = true, paramType = "query", dataType = "String", dataTypeClass = String.class), |
| | | }) |
| | | @PostMapping(value = "/importBatch", headers = "content-type=multipart/form-data") |
| | | // @RequiresPermissions("business:salaryparam:create") |
| | | public ApiResponse importBatch(String folder, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | CommonsMultipartResolver multipartResovler = new CommonsMultipartResolver(); |
| | | if (multipartResovler.isMultipart(request)) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | Iterator<String> it = multipartRequest.getFileNames(); |
| | | while (it.hasNext()) { |
| | | MultipartFile file = multipartRequest.getFile((String) it.next()); |
| | | salaryParamService.importPlans(file); |
| | | break; |
| | | } |
| | | } |
| | | return ApiResponse.success( null); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 自定义Realm,处理认证和权限 |
| | |
| | | if(com == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该账户异常!"); |
| | | } |
| | | |
| | | if(com.getStatus() == 0 ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过禁用!"); |
| | | } |
| | | if(com.getOepnValidDate().before(new Date())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过使用有效期!"); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * titleRows : 标题占几行 |
| | | * headerRows : 同占几行 |
| | | * excel常规导入(默认只读取第一张sheet工作簿) |
| | | */ |
| | | public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass){ |
| | |
| | | } |
| | | return list; |
| | | } |
| | | } |
| | | } |
| | |
| | | package doumeemes.dao.ext.dto; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import cn.afterturn.easypoi.excel.annotation.ExcelTarget; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | |
| | | */ |
| | | @Data |
| | | @ApiModel("绩效工资配置导入") |
| | | @ExcelTarget("SalaryParamImportDTO") |
| | | public class SalaryParamImportDTO { |
| | | |
| | | @Excel(name="计价方式",orderNum ="1") |
| | |
| | | @Excel(name="工厂名称",orderNum ="2") |
| | | private String departName; |
| | | |
| | | @Excel(name="产品名称",orderNum ="3") |
| | | @Excel(name="物料名称",orderNum ="3") |
| | | private String materialName; |
| | | |
| | | @Excel(name="产品编码",orderNum ="4") |
| | | @Excel(name="物料编码",orderNum ="4") |
| | | private String materialCode; |
| | | |
| | | @Excel(name="工序名称",orderNum ="5") |
| | |
| | | private BigDecimal salary; |
| | | |
| | | @Excel(name="标准产出",orderNum ="7") |
| | | private Integer NUM; |
| | | private String num; |
| | | |
| | | @Excel(name="标准工时",orderNum ="8") |
| | | private String timesName; |
| | |
| | | @ExcelColumn(name="公司级组织编码(关联department表)") |
| | | private Integer departId; |
| | | |
| | | @ApiModelProperty(value = "物料ID(关联material表)", example = "1") |
| | | @ExcelColumn(name="物料ID(关联material表)") |
| | | @ApiModelProperty(value = "物料ID(该字段关联 material_distribute 表ID !!!! )", example = "1") |
| | | @ExcelColumn(name="物料ID(关联material_distribute表)") |
| | | private Integer materialId; |
| | | |
| | | @ApiModelProperty(value = "版本号") |
| | |
| | | @ApiModelProperty(value = "工序名称") |
| | | private String procedureName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "material id") |
| | | private Integer realMaterialId; |
| | | } |
| | |
| | | @ApiModelProperty(value = "羚羊平台应用参数,json格式存储{app_key:,aes_key:,app_secret:}" ) |
| | | private String lingyangInfo; |
| | | |
| | | @ApiModelProperty(value = "名称") |
| | | @ExcelColumn(name="名称") |
| | | private Byte status; |
| | | |
| | | } |
| | |
| | | private Integer distributNoDoneNum; |
| | | @ApiModelProperty(value = "库存是否满足 0不满足 1满足", example = "0") |
| | | private Integer isStock; |
| | | @ApiModelProperty(value = "是否延期") |
| | | private Boolean hasExpire; |
| | | @ApiModelProperty(value = "成品计划开始日期") |
| | | private Date workPlanPlanDate; |
| | | @ApiModelProperty(value = "成品计划结束日期") |
| | | private Date workPlanStartDate; |
| | | |
| | | |
| | | @ExcelColumn(name="物料名称",index = 1,width =15) |
| | |
| | | @ExcelColumn(name="销售订单") |
| | | private String salesOrder; |
| | | |
| | | @ApiModelProperty(value = "成品计划开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date workPlanStartDate; |
| | | // @ApiModelProperty(value = "成品计划开始时间") |
| | | // @JsonFormat(pattern = "yyyy-MM-dd") |
| | | // private Date workPlanStartDate; |
| | | |
| | | @ApiModelProperty(value = "成品计划结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | |
| | | import doumeemes.dao.business.model.Company; |
| | | import doumeemes.dao.business.model.CompanyLog; |
| | | import doumeemes.dao.business.model.CompanyOpen; |
| | | import doumeemes.dao.ext.vo.CompanyExtListVO; |
| | | import doumeemes.service.business.CompanyLogService; |
| | | import doumeemes.service.business.CompanyOpenService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import doumeemes.service.ext.DepartmentExtService; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | |
| | | @Autowired |
| | | CompanyLogService companyLogService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private DepartmentExtService departmentExtService; |
| | | |
| | | @Override |
| | | public Integer create(CompanyOpen companyOpen) { |
| | |
| | | company.setOepnValidDate(companyOpen.getValidDate()); |
| | | company.setOepnType(companyOpen.getOepnType()); |
| | | companyMapper.updateById(company); |
| | | |
| | | Company company1 = companyMapper.selectById(companyOpen.getCompanyId()); |
| | | |
| | | CompanyLog companyLog = new CompanyLog(); |
| | | companyLog.setDeleted((byte) Constants.ZERO); |
| | |
| | | companyLog.setUpdateType(Constants.CompanyUpdateType.UPDATE_VAIL_DATE.getKey()); |
| | | companyLog.setDetail("有效期从"+format.format(cyResult.getOepnValidDate())+"日调整至"+format.format(companyOpen.getValidDate())); |
| | | companyLogService.create(companyLog); |
| | | |
| | | initRedisCache(company1); |
| | | } |
| | | |
| | | private void initRedisCache(Company com) { |
| | | CompanyExtListVO c = new CompanyExtListVO(); |
| | | BeanUtils.copyProperties(com,c); |
| | | departmentExtService.loadComDepart(c); |
| | | departmentExtService.initCompnayCodesByCom(com); |
| | | } |
| | | |
| | | @Override |
| | |
| | | QueryWrapper<CompanyOpen> wrapper = new QueryWrapper<>(companyOpen); |
| | | return companyOpenMapper.selectList(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageData<CompanyOpen> findPage(PageWrap<CompanyOpen> pageWrap) { |
| | | IPage<CompanyOpen> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | |
| | | import doumeemes.dao.business.model.CompanyLog; |
| | | import doumeemes.dao.business.model.Multifiles; |
| | | import doumeemes.dao.ext.dto.DingDingConfig; |
| | | import doumeemes.dao.ext.vo.CompanyExtListVO; |
| | | import doumeemes.service.business.CompanyLogService; |
| | | import doumeemes.service.business.CompanyService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import doumeemes.service.business.MultifilesService; |
| | | import doumeemes.service.ext.DepartmentExtService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | |
| | | @Autowired |
| | | private CompanyLogService companyLogService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private DepartmentExtService departmentExtService; |
| | | |
| | | |
| | | @Override |
| | |
| | | update.setStatus(company.getStatus()); |
| | | update.setDingdingInfo(company.getDingdingInfo()); |
| | | companyMapper.updateById(update); |
| | | |
| | | Company company1 = companyMapper.selectById(company.getId()); |
| | | // 更新记录 |
| | | |
| | | if(Objects.nonNull(company.getStatus())){ |
| | |
| | | companyLogService.create(companyLog); |
| | | } |
| | | |
| | | initRedisCache(company1); |
| | | } |
| | | |
| | | |
| | | private void initRedisCache(Company com) { |
| | | CompanyExtListVO c = new CompanyExtListVO(); |
| | | BeanUtils.copyProperties(com,c); |
| | | departmentExtService.loadComDepart(c); |
| | | departmentExtService.initCompnayCodesByCom(com); |
| | | } |
| | | |
| | | private Boolean isParseObject(String dingdingInfo){ |
| | |
| | | QueryWrapper<Company> wrapper = new QueryWrapper<>(company); |
| | | return companyMapper.selectList(wrapper); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageData<Company> findPage(PageWrap<Company> pageWrap) { |
| | | IPage<Company> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | |
| | | |
| | | @Override |
| | | public Integer create(SalaryParam salaryParam) { |
| | | |
| | | |
| | | LoginUserInfo principal = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | SalaryParam insert = new SalaryParam(); |
| | |
| | | || Objects.isNull(s.getDepartName()) |
| | | || Objects.isNull(s.getMaterialCode()) |
| | | || Objects.isNull(s.getProcedureName()) |
| | | || Objects.isNull(s.getNUM())){ |
| | | || Objects.isNull(s.getNum())){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "导入数据内容有误!"); |
| | | } |
| | | }); |
| | |
| | | proceduresWrapper.lambda() |
| | | .eq(Procedures::getName,salaryParamImportDTO.getProcedureName()) |
| | | .eq(Procedures::getRootDepartId,department.getRootId()) |
| | | .eq(Procedures::getDepartId,department.getId()) |
| | | .eq(Procedures::getOrgId,department.getId()) |
| | | .last("limit 1"); |
| | | Procedures procedures = proceduresMapper.selectOne(proceduresWrapper); |
| | | if (Objects.isNull(procedures)){ |
| | |
| | | salaryParam.setProcedureId(procedures.getId()); |
| | | salaryParam.setMaterialId(material.getId()); |
| | | salaryParam.setSalary(salaryParamImportDTO.getSalary()); |
| | | salaryParam.setNum(new BigDecimal(salaryParamImportDTO.getNUM())); |
| | | |
| | | salaryParam.setNum(new BigDecimal(salaryParamImportDTO.getNum())); |
| | | salaryParam.setTimes(getIntegerTimes(salaryParamImportDTO.getTimesName())); |
| | | |
| | | Integer unqualified = Optional.ofNullable(salaryParamImportDTO.getUnqualified()).map(s -> { |
| | | if ("否".equals(s)) { |
| | | return 0; |
| | |
| | | m = Integer.parseInt(a.substring(hIndex >=0?hIndex+2:0,mIndex)); |
| | | } |
| | | if(sIndex > mIndex){ |
| | | s = Integer.parseInt(a.substring(mIndex >=0?mIndex+2:0,mIndex)); |
| | | s = Integer.parseInt(a.substring(mIndex >= 0 ? mIndex+2 : 0, sIndex)); |
| | | } |
| | | return h*3600+m*60+s; |
| | | }catch (Exception e){ |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | //加入redis缓存,存储企业信息 |
| | | RedisUtil.addObject(redisTemplate,Constants.RedisKeys.COM_DEPART_TREE_KEY+com.getId(),rootDepart); |
| | | } |
| | | @PostConstruct |
| | | @Override |
| | | public void loadAllDepart() { |
| | | QueryCompanyExtDTO dto = new QueryCompanyExtDTO(); |
| | |
| | | for (Department department:departmentList ) { |
| | | this.dealDepartmentData(department,user); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void dealDepartmentData(Department department,LoginUserInfo user){ |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | // p.setDistributNum(tp.getDistributNum()); |
| | | // p.setDoneNum(tp.getDoneNum()); |
| | | p.setIsStock(wStockExtService.isStockForPlan(p)); |
| | | if ( !p.getStatus().equals(Constants.PLAN_STATUS.done) && |
| | | !p.getStatus().equals(Constants.PLAN_STATUS.close)){ |
| | | if (Objects.nonNull(p.getPlanDate())){ |
| | | p.setHasExpire(DateUtil.toDateLocalDateTime(p.getWorkPlanPlanDate()).toLocalDate().isBefore(LocalDate.now())); |
| | | }else { |
| | | p.setHasExpire(false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return PageData.from(new PageInfo<>(result)); |
| | |
| | | i.setFinishUnQualifiedNum(Objects.isNull(plansExtListVO.getUnqulifiedNum())?Constants.ZERO:plansExtListVO.getUnqulifiedNum()); |
| | | i.setFinishNum(Objects.isNull(plansExtListVO.getDoneNum())?Constants.ZERO:plansExtListVO.getDoneNum()); |
| | | } |
| | | if (Objects.nonNull(i.getPlanDate())){ |
| | | i.setHasExpire(DateUtil.toDateLocalDateTime(i.getPlanDate()).toLocalDate().isBefore(LocalDate.now())); |
| | | }else { |
| | | i.setHasExpire(false); |
| | | |
| | | if ( !i.getStatus().equals(Constants.WORKPLANHISTORY_TYPE.done) && |
| | | !i.getStatus().equals(Constants.WORKPLANHISTORY_TYPE.close)){ |
| | | if (Objects.nonNull(i.getPlanDate())){ |
| | | i.setHasExpire(DateUtil.toDateLocalDateTime(i.getPlanDate()).toLocalDate().isBefore(LocalDate.now())); |
| | | }else { |
| | | i.setHasExpire(false); |
| | | } |
| | | } |
| | | |
| | | |
| | | }); |
| | | } |
| | | return PageData.from(new PageInfo<>(result)); |
| | |
| | | `dmodel`.`STATUS` AS DMODEL_STATUS, |
| | | `dmodel`.`VALID_TIME` AS DMODEL_VALID_TIME, |
| | | `dmodel`.`INVALID_TIME` AS DMODEL_INVALID_TIME, |
| | | `mmodel`.`ID` AS MMODEL_ID, |
| | | `mmodel`.`ID` AS realMaterialId, |
| | | `mmodel`.`DELETED` AS MMODEL_DELETED, |
| | | `mmodel`.`CREATE_USER` AS MMODEL_CREATE_USER, |
| | | `mmodel`.`CREATE_TIME` AS MMODEL_CREATE_TIME, |
| | |
| | | concat(`usermodel`.realname,' ',`usermodel`.mobile) as planUserName , `umodel`.name as unitName , |
| | | w.PLAN_CODE as workPlanCode , w.SALESORDER as salesOrder , |
| | | w.START_DATE as workPlanStartDate , w.PLAN_DATE as workPlanEndDate, |
| | | w.`PLAN_DATE` as workPlanPlanDate, |
| | | ifnull((select sum(worder.PLAN_NUM) from workorder worder where worder.PLAN_ID = a.id and worder.STATUS not in (7,8) ),0) as produceNum |
| | | |
| | | FROM `plans` `a` |